mirror of
https://github.com/FabricMC/fabric.git
synced 2024-11-14 19:25:23 -05:00
23w17a
This commit is contained in:
parent
07640e5410
commit
b3f2574b16
43 changed files with 200 additions and 235 deletions
|
@ -10,7 +10,7 @@ plugins {
|
|||
id "idea"
|
||||
id "maven-publish"
|
||||
id 'jacoco'
|
||||
id "fabric-loom" version "1.2.4" apply false
|
||||
id "fabric-loom" version "1.2.5" apply false
|
||||
id "com.diffplug.spotless" version "6.18.0"
|
||||
id "org.ajoberstar.grgit" version "3.1.0"
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||
|
|
|
@ -18,14 +18,13 @@ package net.fabricmc.fabric.test.lookup;
|
|||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup;
|
||||
|
@ -42,17 +41,17 @@ public class FabricApiLookupTest implements ModInitializer {
|
|||
public static final String MOD_ID = "fabric-lookup-api-v1-testmod";
|
||||
// Chute - Block without model that transfers item from the container above to the container below.
|
||||
// It's meant to work with unsided containers: chests, dispensers, droppers and hoppers.
|
||||
public static final ChuteBlock CHUTE_BLOCK = new ChuteBlock(FabricBlockSettings.of(Material.GENERIC));
|
||||
public static final ChuteBlock CHUTE_BLOCK = new ChuteBlock(FabricBlockSettings.of());
|
||||
public static final BlockItem CHUTE_ITEM = new BlockItem(CHUTE_BLOCK, new Item.Settings());
|
||||
public static BlockEntityType<ChuteBlockEntity> CHUTE_BLOCK_ENTITY_TYPE;
|
||||
// Cobble gen - Block without model that can generate infinite cobblestone when placed above a chute.
|
||||
// It's meant to test BlockApiLookup#registerSelf.
|
||||
public static final CobbleGenBlock COBBLE_GEN_BLOCK = new CobbleGenBlock(FabricBlockSettings.of(Material.GENERIC));
|
||||
public static final CobbleGenBlock COBBLE_GEN_BLOCK = new CobbleGenBlock(FabricBlockSettings.of());
|
||||
public static final BlockItem COBBLE_GEN_ITEM = new BlockItem(COBBLE_GEN_BLOCK, new Item.Settings());
|
||||
public static BlockEntityType<CobbleGenBlockEntity> COBBLE_GEN_BLOCK_ENTITY_TYPE;
|
||||
// Testing for item api lookups is done in the `item` package.
|
||||
|
||||
public static final InspectorBlock INSPECTOR_BLOCK = new InspectorBlock(FabricBlockSettings.of(Material.GENERIC));
|
||||
public static final InspectorBlock INSPECTOR_BLOCK = new InspectorBlock(FabricBlockSettings.of());
|
||||
public static final BlockItem INSPECTOR_ITEM = new BlockItem(INSPECTOR_BLOCK, new Item.Settings());
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,9 +20,9 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.minecraft.class_8514;
|
||||
import net.minecraft.registry.tag.GameEventTags;
|
||||
import net.minecraft.world.event.GameEvent;
|
||||
import net.minecraft.world.event.Vibrations;
|
||||
|
||||
/**
|
||||
* Provides a method for registering sculk sensor frequencies.
|
||||
|
@ -52,7 +52,7 @@ public final class SculkSensorFrequencyRegistry {
|
|||
throw new IllegalArgumentException("Attempted to register Sculk Sensor frequency for event "+event.getId()+" with frequency "+frequency+". Sculk Sensor frequencies must be between 1 and 15 inclusive.");
|
||||
}
|
||||
|
||||
final Object2IntOpenHashMap<GameEvent> map = (Object2IntOpenHashMap<GameEvent>) class_8514.field_44639;
|
||||
final Object2IntOpenHashMap<GameEvent> map = (Object2IntOpenHashMap<GameEvent>) Vibrations.FREQUENCIES;
|
||||
int replaced = map.put(event, frequency);
|
||||
|
||||
if (replaced != 0) {
|
||||
|
|
|
@ -61,7 +61,7 @@ transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider off
|
|||
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerBlasting (Ljava/util/function/Consumer;Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
|
||||
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerMultipleOptions (Ljava/util/function/Consumer;Lnet/minecraft/recipe/RecipeSerializer;Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;Ljava/lang/String;)V
|
||||
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerNetheriteUpgradeRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/Item;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/Item;)V
|
||||
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTrimRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/Item;)V
|
||||
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTrimRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;)V
|
||||
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offer2x2CompactingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
|
||||
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerCompactingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V
|
||||
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerCompactingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
|
||||
|
|
|
@ -19,7 +19,6 @@ package net.fabricmc.fabric.test.datagen;
|
|||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
|
@ -49,11 +48,11 @@ public class DataGeneratorTestContent implements ModInitializer {
|
|||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
SIMPLE_BLOCK = createBlock("simple_block", true, AbstractBlock.Settings.of(Material.GENERIC));
|
||||
BLOCK_WITHOUT_ITEM = createBlock("block_without_item", false, AbstractBlock.Settings.of(Material.GENERIC));
|
||||
BLOCK_WITHOUT_LOOT_TABLE = createBlock("block_without_loot_table", false, AbstractBlock.Settings.of(Material.GENERIC));
|
||||
BLOCK_WITH_VANILLA_LOOT_TABLE = createBlock("block_with_vanilla_loot_table", false, AbstractBlock.Settings.of(Material.GENERIC).dropsLike(Blocks.STONE));
|
||||
BLOCK_THAT_DROPS_NOTHING = createBlock("block_that_drops_nothing", false, AbstractBlock.Settings.of(Material.GENERIC).dropsNothing());
|
||||
SIMPLE_BLOCK = createBlock("simple_block", true, AbstractBlock.Settings.of());
|
||||
BLOCK_WITHOUT_ITEM = createBlock("block_without_item", false, AbstractBlock.Settings.of());
|
||||
BLOCK_WITHOUT_LOOT_TABLE = createBlock("block_without_loot_table", false, AbstractBlock.Settings.of());
|
||||
BLOCK_WITH_VANILLA_LOOT_TABLE = createBlock("block_with_vanilla_loot_table", false, AbstractBlock.Settings.of().dropsLike(Blocks.STONE));
|
||||
BLOCK_THAT_DROPS_NOTHING = createBlock("block_that_drops_nothing", false, AbstractBlock.Settings.of().dropsNothing());
|
||||
|
||||
ItemGroupEvents.modifyEntriesEvent(SIMPLE_ITEM_GROUP).register(entries -> entries.add(SIMPLE_BLOCK));
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public final class FabricDimensions {
|
|||
@Nullable
|
||||
public static <E extends Entity> E teleport(E teleported, ServerWorld destination, TeleportTarget target) {
|
||||
Preconditions.checkNotNull(target, "A target must be provided");
|
||||
Preconditions.checkState(!teleported.world.isClient, "Entities can only be teleported on the server side");
|
||||
Preconditions.checkState(!teleported.getWorld().isClient, "Entities can only be teleported on the server side");
|
||||
|
||||
return FabricDimensionInternals.changeDimension(teleported, destination, target);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ public final class FabricDimensionInternals {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E extends Entity> E changeDimension(E teleported, ServerWorld dimension, TeleportTarget target) {
|
||||
Preconditions.checkArgument(!teleported.world.isClient, "Entities can only be teleported on the server side");
|
||||
Preconditions.checkArgument(Thread.currentThread() == ((ServerWorld) teleported.world).getServer().getThread(), "Entities must be teleported from the main server thread");
|
||||
Preconditions.checkArgument(!teleported.getWorld().isClient, "Entities can only be teleported on the server side");
|
||||
Preconditions.checkArgument(Thread.currentThread() == ((ServerWorld) teleported.getWorld()).getServer().getThread(), "Entities must be teleported from the main server thread");
|
||||
|
||||
try {
|
||||
((Teleportable) teleported).fabric_setCustomTeleportTarget(target);
|
||||
|
|
|
@ -24,10 +24,13 @@ import com.mojang.brigadier.context.CommandContext;
|
|||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.argument.DimensionArgumentType;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
|
@ -36,9 +39,6 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.world.TeleportTarget;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionOptions;
|
||||
|
@ -75,7 +75,7 @@ public class FabricDimensionTest implements ModInitializer {
|
|||
Entity entity = COW.create(overworld);
|
||||
|
||||
if (entity == null) throw new AssertionError("Could not create entity!");
|
||||
if (!entity.world.getRegistryKey().equals(World.OVERWORLD)) throw new AssertionError("Entity starting world isn't the overworld");
|
||||
if (!entity.getWorld().getRegistryKey().equals(World.OVERWORLD)) throw new AssertionError("Entity starting world isn't the overworld");
|
||||
|
||||
TeleportTarget target = new TeleportTarget(Vec3d.ZERO, new Vec3d(1, 1, 1), 45f, 60f);
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class FabricDimensionTest implements ModInitializer {
|
|||
|
||||
if (teleported == null) throw new AssertionError("Entity didn't teleport");
|
||||
|
||||
if (!teleported.world.getRegistryKey().equals(WORLD_KEY)) throw new AssertionError("Target world not reached.");
|
||||
if (!teleported.getWorld().getRegistryKey().equals(WORLD_KEY)) throw new AssertionError("Target world not reached.");
|
||||
|
||||
if (!teleported.getPos().equals(target.position)) throw new AssertionError("Target Position not reached.");
|
||||
});
|
||||
|
@ -119,14 +119,14 @@ public class FabricDimensionTest implements ModInitializer {
|
|||
return 1;
|
||||
}
|
||||
|
||||
ServerWorld serverWorld = player.getWorld();
|
||||
ServerWorld serverWorld = player.method_51469();
|
||||
ServerWorld modWorld = getModWorld(context);
|
||||
|
||||
if (serverWorld != modWorld) {
|
||||
TeleportTarget target = new TeleportTarget(new Vec3d(0.5, 101, 0.5), Vec3d.ZERO, 0, 0);
|
||||
FabricDimensions.teleport(player, modWorld, target);
|
||||
|
||||
if (player.world != modWorld) {
|
||||
if (player.getWorld() != modWorld) {
|
||||
throw new CommandException(Text.literal("Teleportation failed!"));
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class FabricDimensionTest implements ModInitializer {
|
|||
}
|
||||
|
||||
TeleportTarget target = new TeleportTarget(player.getPos().add(5, 0, 0), player.getVelocity(), player.getYaw(), player.getPitch());
|
||||
FabricDimensions.teleport(player, (ServerWorld) player.world, target);
|
||||
FabricDimensions.teleport(player, (ServerWorld) player.getWorld(), target);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class FabricDimensionTest implements ModInitializer {
|
|||
return 1;
|
||||
}
|
||||
|
||||
Entity entity = player.world
|
||||
Entity entity = player.getWorld()
|
||||
.getOtherEntities(player, player.getBoundingBox().expand(100, 100, 100))
|
||||
.stream()
|
||||
.findFirst()
|
||||
|
@ -175,7 +175,7 @@ public class FabricDimensionTest implements ModInitializer {
|
|||
}
|
||||
|
||||
TeleportTarget target = new TeleportTarget(player.getPos(), player.getVelocity(), player.getYaw(), player.getPitch());
|
||||
FabricDimensions.teleport(entity, (ServerWorld) entity.world, target);
|
||||
FabricDimensions.teleport(entity, (ServerWorld) entity.getWorld(), target);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public interface FabricElytraItem {
|
|||
default void doVanillaElytraTick(LivingEntity entity, ItemStack chestStack) {
|
||||
int nextRoll = entity.getRoll() + 1;
|
||||
|
||||
if (!entity.world.isClient && nextRoll % 10 == 0) {
|
||||
if (!entity.getWorld().isClient && nextRoll % 10 == 0) {
|
||||
if ((nextRoll / 10) % 2 == 0) {
|
||||
chestStack.damage(1, entity, p -> p.sendEquipmentBreakStatus(EquipmentSlot.CHEST));
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ abstract class EntityMixin {
|
|||
Entity ret = cir.getReturnValue();
|
||||
|
||||
if (ret != null) {
|
||||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld((Entity) (Object) this, ret, (ServerWorld) this.world, (ServerWorld) ret.world);
|
||||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld((Entity) (Object) this, ret, (ServerWorld) this.world, (ServerWorld) ret.getWorld());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,6 @@ abstract class EntityMixin {
|
|||
@Inject(method = "teleport(Lnet/minecraft/server/world/ServerWorld;DDDLjava/util/Set;FF)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setRemoved(Lnet/minecraft/entity/Entity$RemovalReason;)V"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void afterEntityTeleportedToWorld(ServerWorld destination, double x, double y, double z, Set<PositionFlag> flags, float yaw, float pitch, CallbackInfoReturnable<Boolean> cir, float i, Entity newEntity) {
|
||||
Entity originalEntity = (Entity) (Object) this;
|
||||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld(originalEntity, newEntity, ((ServerWorld) originalEntity.world), destination);
|
||||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld(originalEntity, newEntity, ((ServerWorld) originalEntity.getWorld()), destination);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ abstract class LivingEntityMixin {
|
|||
private void onEntityKilledOther(DamageSource source, CallbackInfo ci, Entity attacker) {
|
||||
// FIXME: Cannot use shadowed fields from supermixins - needs a fix so people can use fabric api in a dev environment even though this is fine in this repo and prod.
|
||||
// A temporary fix is to just cast the mixin to LivingEntity and access the world field with a few ugly casts.
|
||||
ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.invoker().afterKilledOtherEntity((ServerWorld) ((LivingEntity) (Object) this).world, attacker, (LivingEntity) (Object) this);
|
||||
ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.invoker().afterKilledOtherEntity((ServerWorld) ((LivingEntity) (Object) this).getWorld(), attacker, (LivingEntity) (Object) this);
|
||||
}
|
||||
|
||||
@Inject(method = "onDeath", at = @At(value = "INVOKE", target = "net/minecraft/world/World.sendEntityStatus(Lnet/minecraft/entity/Entity;B)V"))
|
||||
|
@ -99,7 +99,7 @@ abstract class LivingEntityMixin {
|
|||
@Dynamic("method_18405: Synthetic lambda body for Optional.map in isSleepingInBed")
|
||||
@Inject(method = "method_18405", at = @At("RETURN"), cancellable = true)
|
||||
private void onIsSleepingInBed(BlockPos sleepingPos, CallbackInfoReturnable<Boolean> info) {
|
||||
BlockState bedState = ((LivingEntity) (Object) this).world.getBlockState(sleepingPos);
|
||||
BlockState bedState = ((LivingEntity) (Object) this).getWorld().getBlockState(sleepingPos);
|
||||
ActionResult result = EntitySleepEvents.ALLOW_BED.invoker().allowBed((LivingEntity) (Object) this, sleepingPos, bedState, info.getReturnValueZ());
|
||||
|
||||
if (result != ActionResult.PASS) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.mob.HostileEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.state.property.Property;
|
||||
|
@ -42,7 +43,6 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.Unit;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.fabricmc.fabric.api.entity.event.v1.EntitySleepEvents;
|
||||
|
@ -54,7 +54,7 @@ import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
|
|||
@Mixin(ServerPlayerEntity.class)
|
||||
abstract class ServerPlayerEntityMixin extends LivingEntityMixin {
|
||||
@Shadow
|
||||
public abstract ServerWorld getWorld();
|
||||
public abstract ServerWorld method_51469();
|
||||
|
||||
/**
|
||||
* Minecraft by default does not call Entity#onKilledOther for a ServerPlayerEntity being killed.
|
||||
|
@ -67,8 +67,8 @@ abstract class ServerPlayerEntityMixin extends LivingEntityMixin {
|
|||
|
||||
// If the damage source that killed the player was an entity, then fire the event.
|
||||
if (attacker != null) {
|
||||
attacker.onKilledOther(this.getWorld(), (ServerPlayerEntity) (Object) this);
|
||||
ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.invoker().afterKilledOtherEntity(this.getWorld(), attacker, (ServerPlayerEntity) (Object) this);
|
||||
attacker.onKilledOther(this.method_51469(), (ServerPlayerEntity) (Object) this);
|
||||
ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.invoker().afterKilledOtherEntity(this.method_51469(), attacker, (ServerPlayerEntity) (Object) this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ abstract class ServerPlayerEntityMixin extends LivingEntityMixin {
|
|||
*/
|
||||
@Inject(method = "worldChanged(Lnet/minecraft/server/world/ServerWorld;)V", at = @At("TAIL"))
|
||||
private void afterWorldChanged(ServerWorld origin, CallbackInfo ci) {
|
||||
ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.invoker().afterChangeWorld((ServerPlayerEntity) (Object) this, origin, this.getWorld());
|
||||
ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.invoker().afterChangeWorld((ServerPlayerEntity) (Object) this, origin, this.method_51469());
|
||||
}
|
||||
|
||||
@Inject(method = "copyFrom", at = @At("TAIL"))
|
||||
|
|
|
@ -46,7 +46,7 @@ abstract class LivingEntityMixin extends Entity {
|
|||
|
||||
if (!EntityElytraEvents.ALLOW.invoker().allowElytraFlight(self)) {
|
||||
// The entity is already fall flying by now, we just need to stop it.
|
||||
if (!world.isClient) {
|
||||
if (!getWorld().isClient) {
|
||||
setFlag(Entity.FALL_FLYING_FLAG_INDEX, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory;
|
|||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.damage.DamageTypes;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
|
@ -51,7 +50,7 @@ import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
|
|||
|
||||
public final class EntityEventTests implements ModInitializer {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EntityEventTests.class);
|
||||
public static final Block TEST_BED = new TestBedBlock(AbstractBlock.Settings.of(Material.GENERIC).strength(1, 1));
|
||||
public static final Block TEST_BED = new TestBedBlock(AbstractBlock.Settings.of().strength(1, 1));
|
||||
public static final Item DIAMOND_ELYTRA = new DiamondElytraItem();
|
||||
|
||||
@Override
|
||||
|
@ -126,7 +125,7 @@ public final class EntityEventTests implements ModInitializer {
|
|||
|
||||
EntitySleepEvents.START_SLEEPING.register((entity, sleepingPos) -> {
|
||||
LOGGER.info("Entity {} sleeping at {}", entity, sleepingPos);
|
||||
BlockState bedState = entity.world.getBlockState(sleepingPos);
|
||||
BlockState bedState = entity.getWorld().getBlockState(sleepingPos);
|
||||
|
||||
if (bedState.isOf(TEST_BED)) {
|
||||
boolean shouldBeOccupied = !entity.getStackInHand(Hand.MAIN_HAND).isOf(Items.ORANGE_WOOL);
|
||||
|
@ -146,12 +145,12 @@ public final class EntityEventTests implements ModInitializer {
|
|||
});
|
||||
|
||||
EntitySleepEvents.MODIFY_SLEEPING_DIRECTION.register((entity, sleepingPos, sleepingDirection) -> {
|
||||
return entity.world.getBlockState(sleepingPos).isOf(TEST_BED) ? Direction.NORTH : sleepingDirection;
|
||||
return entity.getWorld().getBlockState(sleepingPos).isOf(TEST_BED) ? Direction.NORTH : sleepingDirection;
|
||||
});
|
||||
|
||||
EntitySleepEvents.ALLOW_SLEEP_TIME.register((player, sleepingPos, vanillaResult) -> {
|
||||
// Yellow wool allows to sleep during the day
|
||||
if (player.world.isDay() && player.getStackInHand(Hand.MAIN_HAND).isOf(Items.YELLOW_WOOL)) {
|
||||
if (player.getWorld().isDay() && player.getStackInHand(Hand.MAIN_HAND).isOf(Items.YELLOW_WOOL)) {
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public abstract class ClientPlayerInteractionManagerMixin {
|
|||
|
||||
if (player.isSpectator()) return; // vanilla spectator check happens later, repeat it before the event to avoid false invocations
|
||||
|
||||
ActionResult result = UseBlockCallback.EVENT.invoker().interact(player, player.world, hand, blockHitResult);
|
||||
ActionResult result = UseBlockCallback.EVENT.invoker().interact(player, player.getWorld(), hand, blockHitResult);
|
||||
|
||||
if (result != ActionResult.PASS) {
|
||||
if (result == ActionResult.SUCCESS) {
|
||||
|
@ -113,14 +113,14 @@ public abstract class ClientPlayerInteractionManagerMixin {
|
|||
public void interactItem(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> info) {
|
||||
// hook interactBlock between the spectator check and sending the first packet to invoke the use item event first
|
||||
// this needs to be in interactBlock to avoid sending a packet in line with the event javadoc
|
||||
TypedActionResult<ItemStack> result = UseItemCallback.EVENT.invoker().interact(player, player.world, hand);
|
||||
TypedActionResult<ItemStack> result = UseItemCallback.EVENT.invoker().interact(player, player.getWorld(), hand);
|
||||
|
||||
if (result.getResult() != ActionResult.PASS) {
|
||||
if (result.getResult() == ActionResult.SUCCESS) {
|
||||
// send the move packet like vanilla to ensure the position+view vectors are accurate
|
||||
networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(player.getX(), player.getY(), player.getZ(), player.getYaw(), player.getPitch(), player.isOnGround()));
|
||||
// send interaction packet to the server with a new sequentially assigned id
|
||||
sendSequencedPacket((ClientWorld) player.world, id -> new PlayerInteractItemC2SPacket(hand, id));
|
||||
sendSequencedPacket((ClientWorld) player.getWorld(), id -> new PlayerInteractItemC2SPacket(hand, id));
|
||||
}
|
||||
|
||||
info.setReturnValue(result.getResult());
|
||||
|
|
|
@ -19,7 +19,7 @@ package net.fabricmc.fabric.impl.gamerule.widget;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.world.EditGameRulesScreen;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.text.OrderedText;
|
||||
|
@ -57,11 +57,11 @@ public final class DoubleRuleWidget extends EditGameRulesScreen.NamedRuleWidget
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawableHelper drawableHelper, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void render(DrawContext drawContext, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
// FIXME: Param names nightmare
|
||||
this.drawName(drawableHelper, y, x);
|
||||
this.drawName(drawContext, y, x);
|
||||
|
||||
this.textFieldWidget.setPosition(x + entryWidth - 44, y);
|
||||
this.textFieldWidget.render(drawableHelper, mouseX, mouseY, tickDelta);
|
||||
this.textFieldWidget.render(drawContext, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.world.EditGameRulesScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
|
@ -60,11 +60,11 @@ public final class EnumRuleWidget<E extends Enum<E>> extends EditGameRulesScreen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawableHelper drawableHelper, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void render(DrawContext drawContext, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
// FIXME: Param names nightmare
|
||||
this.drawName(drawableHelper, y, x);
|
||||
this.drawName(drawContext, y, x);
|
||||
|
||||
this.buttonWidget.setPosition(x + entryWidth - 89, y);
|
||||
this.buttonWidget.render(drawableHelper, mouseX, mouseY, tickDelta);
|
||||
this.buttonWidget.render(drawContext, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.function.Consumer;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
|
@ -49,7 +49,7 @@ public class FabricCreativeGuiComponents {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawableHelper drawableHelper, int mouseX, int mouseY, float float_1) {
|
||||
public void render(DrawContext drawContext, int mouseX, int mouseY, float float_1) {
|
||||
this.hovered = mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.width && mouseY < this.getY() + this.height;
|
||||
this.visible = extensions.fabric_isButtonVisible(type);
|
||||
this.active = extensions.fabric_isButtonEnabled(type);
|
||||
|
@ -58,11 +58,11 @@ public class FabricCreativeGuiComponents {
|
|||
int u = active && this.isHovered() ? 22 : 0;
|
||||
int v = active ? 0 : 12;
|
||||
|
||||
drawableHelper.drawTexture(BUTTON_TEX, this.getX(), this.getY(), u + (type == Type.NEXT ? 11 : 0), v, 11, 12);
|
||||
drawContext.drawTexture(BUTTON_TEX, this.getX(), this.getY(), u + (type == Type.NEXT ? 11 : 0), v, 11, 12);
|
||||
|
||||
if (this.hovered) {
|
||||
int pageCount = (int) Math.ceil((ItemGroups.getGroupsToDisplay().size() - COMMON_GROUPS.size()) / 9D);
|
||||
drawableHelper.method_51438(MinecraftClient.getInstance().textRenderer, Text.translatable("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, pageCount), mouseX, mouseY);
|
||||
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, Text.translatable("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, pageCount), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
|
@ -123,7 +123,7 @@ public abstract class CreativeInventoryScreenMixin<T extends ScreenHandler> exte
|
|||
}
|
||||
|
||||
@Inject(method = "renderTabTooltipIfHovered", at = @At("HEAD"), cancellable = true)
|
||||
private void renderTabTooltipIfHovered(DrawableHelper drawableHelper, ItemGroup itemGroup, int mx, int my, CallbackInfoReturnable<Boolean> info) {
|
||||
private void renderTabTooltipIfHovered(DrawContext drawContext, ItemGroup itemGroup, int mx, int my, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!fabric_isGroupVisible(itemGroup)) {
|
||||
info.setReturnValue(false);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public abstract class CreativeInventoryScreenMixin<T extends ScreenHandler> exte
|
|||
}
|
||||
|
||||
@Inject(method = "renderTabIcon", at = @At("HEAD"), cancellable = true)
|
||||
private void renderTabIcon(DrawableHelper drawableHelper, ItemGroup itemGroup, CallbackInfo info) {
|
||||
private void renderTabIcon(DrawContext drawContext, ItemGroup itemGroup, CallbackInfo info) {
|
||||
if (!fabric_isGroupVisible(itemGroup)) {
|
||||
info.cancel();
|
||||
}
|
||||
|
|
|
@ -26,14 +26,13 @@ import net.minecraft.block.AbstractBlock;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
|
@ -47,21 +46,21 @@ public final class MiningLevelTest implements ModInitializer {
|
|||
|
||||
/// Tagged blocks
|
||||
// sword + dynamic mining level tag
|
||||
public static final Block NEEDS_NETHERITE_SWORD = new Block(AbstractBlock.Settings.of(Material.GENERIC).strength(2, 3).requiresTool());
|
||||
public static final Block NEEDS_NETHERITE_SWORD = new Block(AbstractBlock.Settings.of().strength(2, 3).requiresTool());
|
||||
// sword + vanilla mining level tag
|
||||
public static final Block NEEDS_STONE_SWORD = new Block(AbstractBlock.Settings.of(Material.GENERIC).strength(2, 3).requiresTool());
|
||||
public static final Block NEEDS_STONE_SWORD = new Block(AbstractBlock.Settings.of().strength(2, 3).requiresTool());
|
||||
// any sword
|
||||
public static final Block NEEDS_ANY_SWORD = new Block(AbstractBlock.Settings.of(Material.GENERIC).strength(2, 3).requiresTool());
|
||||
public static final Block NEEDS_ANY_SWORD = new Block(AbstractBlock.Settings.of().strength(2, 3).requiresTool());
|
||||
// shears
|
||||
public static final Block NEEDS_SHEARS = new Block(AbstractBlock.Settings.of(Material.GENERIC).strength(2, 3).requiresTool());
|
||||
public static final Block NEEDS_SHEARS = new Block(AbstractBlock.Settings.of().strength(2, 3).requiresTool());
|
||||
// vanilla mineable tag + dynamic mining level tag
|
||||
public static final Block NEEDS_NETHERITE_PICKAXE = new Block(AbstractBlock.Settings.of(Material.GENERIC).strength(2, 3).requiresTool());
|
||||
public static final Block NEEDS_NETHERITE_PICKAXE = new Block(AbstractBlock.Settings.of().strength(2, 3).requiresTool());
|
||||
// vanilla mineable tag, requires tool (this type of block doesn't exist in vanilla)
|
||||
public static final Block NEEDS_AXE = new Block(AbstractBlock.Settings.of(Material.GENERIC).strength(2, 3).requiresTool());
|
||||
public static final Block NEEDS_AXE = new Block(AbstractBlock.Settings.of().strength(2, 3).requiresTool());
|
||||
// vanilla mineable tag, requires tool (this type of block doesn't exist in vanilla)
|
||||
public static final Block NEEDS_HOE = new Block(AbstractBlock.Settings.of(Material.GENERIC).strength(2, 3).requiresTool());
|
||||
public static final Block NEEDS_HOE = new Block(AbstractBlock.Settings.of().strength(2, 3).requiresTool());
|
||||
// vanilla mineable tag, requires tool (this type of block doesn't exist in vanilla)
|
||||
public static final Block NEEDS_SHOVEL = new Block(AbstractBlock.Settings.of(Material.GENERIC).strength(2, 3).requiresTool());
|
||||
public static final Block NEEDS_SHOVEL = new Block(AbstractBlock.Settings.of().strength(2, 3).requiresTool());
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.EntityTrackingListener;
|
||||
import net.minecraft.server.world.ServerChunkManager;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
|
||||
|
@ -33,7 +34,6 @@ import net.minecraft.util.math.ChunkPos;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.chunk.ChunkManager;
|
||||
import net.minecraft.server.world.EntityTrackingListener;
|
||||
|
||||
import net.fabricmc.fabric.mixin.networking.accessor.EntityTrackerAccessor;
|
||||
import net.fabricmc.fabric.mixin.networking.accessor.ThreadedAnvilChunkStorageAccessor;
|
||||
|
@ -109,7 +109,7 @@ public final class PlayerLookup {
|
|||
*/
|
||||
public static Collection<ServerPlayerEntity> tracking(Entity entity) {
|
||||
Objects.requireNonNull(entity, "Entity cannot be null");
|
||||
ChunkManager manager = entity.world.getChunkManager();
|
||||
ChunkManager manager = entity.getWorld().getChunkManager();
|
||||
|
||||
if (manager instanceof ServerChunkManager) {
|
||||
ThreadedAnvilChunkStorage storage = ((ServerChunkManager) manager).threadedAnvilChunkStorage;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.test.networking.channeltest;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
||||
import net.minecraft.text.Text;
|
||||
|
@ -51,8 +51,8 @@ final class ChannelList extends EntryListWidget<ChannelList.Entry> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawableHelper drawableHelper, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
drawableHelper.method_51438(ChannelList.this.client.textRenderer, Text.literal(this.channel.toString()).formatted(Formatting.WHITE), x, y);
|
||||
public void render(DrawContext drawContext, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
drawContext.drawTooltip(ChannelList.this.client.textRenderer, Text.literal(this.channel.toString()).formatted(Formatting.WHITE), x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.test.networking.channeltest;
|
||||
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.tooltip.Tooltip;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
|
@ -58,16 +58,16 @@ final class ChannelScreen extends Screen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawableHelper drawableHelper, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackgroundTexture(drawableHelper);
|
||||
this.channelList.render(drawableHelper, mouseX, mouseY, delta);
|
||||
super.render(drawableHelper, mouseX, mouseY, delta);
|
||||
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackgroundTexture(drawContext);
|
||||
this.channelList.render(drawContext, mouseX, mouseY, delta);
|
||||
super.render(drawContext, mouseX, mouseY, delta);
|
||||
|
||||
if (this.s2cButton.active && this.c2sButton.active) {
|
||||
final Text clickMe = Text.literal("Click S2C or C2S to view supported channels").formatted(Formatting.YELLOW);
|
||||
|
||||
final int textWidth = this.textRenderer.getWidth(clickMe);
|
||||
drawableHelper.method_51438(
|
||||
drawContext.drawTooltip(
|
||||
this.textRenderer,
|
||||
clickMe,
|
||||
(int) (this.width / 2.0F - (textWidth / 2.0F)),
|
||||
|
|
|
@ -16,14 +16,12 @@
|
|||
|
||||
package net.fabricmc.fabric.api.object.builder.v1.block;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.MapColor;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.resource.featuretoggle.FeatureFlag;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
|
@ -44,23 +42,18 @@ import net.fabricmc.fabric.mixin.object.builder.AbstractBlockSettingsAccessor;
|
|||
* FabricBlockSettings.of().
|
||||
*/
|
||||
public class FabricBlockSettings extends AbstractBlock.Settings {
|
||||
protected FabricBlockSettings(Material material, MapColor color) {
|
||||
super(material, color);
|
||||
}
|
||||
|
||||
protected FabricBlockSettings(Material material, Function<BlockState, MapColor> mapColorProvider) {
|
||||
super(material, mapColorProvider);
|
||||
protected FabricBlockSettings() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected FabricBlockSettings(AbstractBlock.Settings settings) {
|
||||
super(((AbstractBlockSettingsAccessor) settings).getMaterial(), ((AbstractBlockSettingsAccessor) settings).getMapColorProvider());
|
||||
this();
|
||||
// Mostly Copied from vanilla's copy method
|
||||
// Note: If new methods are added to Block settings, an accessor must be added here
|
||||
AbstractBlockSettingsAccessor thisAccessor = (AbstractBlockSettingsAccessor) this;
|
||||
AbstractBlockSettingsAccessor otherAccessor = (AbstractBlockSettingsAccessor) settings;
|
||||
|
||||
// Copied in vanilla: sorted by vanilla copy order
|
||||
thisAccessor.setMaterial(otherAccessor.getMaterial());
|
||||
this.hardness(otherAccessor.getHardness());
|
||||
this.resistance(otherAccessor.getResistance());
|
||||
this.collidable(otherAccessor.getCollidable());
|
||||
|
@ -89,20 +82,8 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
|
|||
this.emissiveLighting(otherAccessor.getEmissiveLightingPredicate());
|
||||
}
|
||||
|
||||
public static FabricBlockSettings of(Material material) {
|
||||
return of(material, material.getColor());
|
||||
}
|
||||
|
||||
public static FabricBlockSettings of(Material material, MapColor color) {
|
||||
return new FabricBlockSettings(material, color);
|
||||
}
|
||||
|
||||
public static FabricBlockSettings of(Material material, DyeColor color) {
|
||||
return new FabricBlockSettings(material, color.getMapColor());
|
||||
}
|
||||
|
||||
public static FabricBlockSettings of(Material material, Function<BlockState, MapColor> mapColor) {
|
||||
return new FabricBlockSettings(material, mapColor);
|
||||
public static FabricBlockSettings of() {
|
||||
return new FabricBlockSettings();
|
||||
}
|
||||
|
||||
public static FabricBlockSettings copyOf(AbstractBlock block) {
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.MapColor;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.resource.featuretoggle.FeatureSet;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
|
@ -35,9 +34,6 @@ import net.minecraft.util.Identifier;
|
|||
@Mixin(AbstractBlock.Settings.class)
|
||||
public interface AbstractBlockSettingsAccessor {
|
||||
/* GETTERS */
|
||||
@Accessor
|
||||
Material getMaterial();
|
||||
|
||||
@Accessor
|
||||
float getHardness();
|
||||
|
||||
|
@ -111,9 +107,6 @@ public interface AbstractBlockSettingsAccessor {
|
|||
FeatureSet getRequiredFeatures();
|
||||
|
||||
/* SETTERS */
|
||||
@Accessor
|
||||
void setMaterial(Material material);
|
||||
|
||||
@Accessor
|
||||
void setCollidable(boolean collidable);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
accessWidener v1 named
|
||||
extendable method net/minecraft/block/AbstractBlock$Settings <init> (Lnet/minecraft/block/Material;Ljava/util/function/Function;)V
|
||||
extendable method net/minecraft/block/AbstractBlock$Settings <init> (Lnet/minecraft/block/Material;Lnet/minecraft/block/MapColor;)V
|
||||
extendable method net/minecraft/block/AbstractBlock$Settings <init> ()V
|
||||
|
||||
accessible method net/minecraft/world/poi/PointOfInterestTypes register (Lnet/minecraft/registry/Registry;Lnet/minecraft/registry/RegistryKey;Ljava/util/Set;II)Lnet/minecraft/world/poi/PointOfInterestType;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.slf4j.Logger;
|
|||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
@ -160,7 +159,7 @@ public class RegistrySyncTest implements ModInitializer {
|
|||
|
||||
private static void registerBlocks(String namespace, int amount, int startingId) {
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Block block = new Block(AbstractBlock.Settings.of(Material.GENERIC));
|
||||
Block block = new Block(AbstractBlock.Settings.of());
|
||||
Registry.register(Registries.BLOCK, new Identifier(namespace, "block_" + (i + startingId)), block);
|
||||
|
||||
if (REGISTER_ITEMS) {
|
||||
|
|
|
@ -17,13 +17,12 @@
|
|||
package net.fabricmc.fabric.test.renderer.simple;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -45,7 +44,7 @@ public final class RendererTest implements ModInitializer {
|
|||
public static final BlockEntityType<FrameBlockEntity> FRAME_BLOCK_ENTITY = FabricBlockEntityTypeBuilder.create(FrameBlockEntity::new, FRAMES).build(null);
|
||||
|
||||
public static final Identifier PILLAR_ID = id("pillar");
|
||||
public static final Block PILLAR = new Block(FabricBlockSettings.of(Material.GENERIC));
|
||||
public static final Block PILLAR = new Block(FabricBlockSettings.of());
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.api.client.rendering.v1;
|
||||
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
|
@ -31,8 +31,8 @@ public interface HudRenderCallback {
|
|||
/**
|
||||
* Called after rendering the whole hud, which is displayed in game, in a world.
|
||||
*
|
||||
* @param drawableHelper the {@link DrawableHelper} instance
|
||||
* @param drawContext the {@link DrawContext} instance
|
||||
* @param tickDelta Progress for linearly interpolating between the previous and current game state
|
||||
*/
|
||||
void onHudRender(DrawableHelper drawableHelper, float tickDelta);
|
||||
void onHudRender(DrawContext drawContext, float tickDelta);
|
||||
}
|
||||
|
|
|
@ -23,14 +23,14 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.tooltip.TooltipComponent;
|
||||
import net.minecraft.client.item.TooltipData;
|
||||
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.TooltipComponentCallback;
|
||||
|
||||
@Mixin(DrawableHelper.class)
|
||||
public class DrawableHelperMixin {
|
||||
@Mixin(DrawContext.class)
|
||||
public class DrawContextMixin {
|
||||
// Synthetic lambda body in renderTooltip
|
||||
@Inject(at = @At("HEAD"), method = "method_51442(Ljava/util/List;Lnet/minecraft/client/item/TooltipData;)V", cancellable = true)
|
||||
private static void injectRenderTooltipLambda(List<TooltipComponent> components, TooltipData data, CallbackInfo ci) {
|
|
@ -22,15 +22,15 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||
|
||||
@Mixin(InGameHud.class)
|
||||
public class InGameHudMixin {
|
||||
@Inject(method = "render", at = @At(value = "TAIL"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;render(Lnet/minecraft/client/gui/DrawableHelper;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V")))
|
||||
public void render(DrawableHelper drawableHelper, float tickDelta, CallbackInfo callbackInfo) {
|
||||
HudRenderCallback.EVENT.invoker().onHudRender(drawableHelper, tickDelta);
|
||||
@Inject(method = "render", at = @At(value = "TAIL"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;render(Lnet/minecraft/client/gui/DrawContext;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V")))
|
||||
public void render(DrawContext drawContext, float tickDelta, CallbackInfo callbackInfo) {
|
||||
HudRenderCallback.EVENT.invoker().onHudRender(drawContext, tickDelta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
"package": "net.fabricmc.fabric.mixin.client.rendering",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"client": [
|
||||
"CapeFeatureRendererMixin",
|
||||
"ArmorFeatureRendererMixin",
|
||||
"BlockColorsMixin",
|
||||
"BlockEntityRendererFactoriesMixin",
|
||||
"BuiltinModelItemRendererMixin",
|
||||
"InGameHudMixin",
|
||||
"ItemColorsMixin",
|
||||
"WorldRendererMixin",
|
||||
"CapeFeatureRendererMixin",
|
||||
"DimensionEffectsAccessor",
|
||||
"DrawContextMixin",
|
||||
"EntityModelLayersAccessor",
|
||||
"EntityModelsMixin",
|
||||
"LivingEntityRendererAccessor",
|
||||
"BlockEntityRendererFactoriesMixin",
|
||||
"EntityRenderersMixin",
|
||||
"DrawableHelperMixin",
|
||||
"DimensionEffectsAccessor",
|
||||
"InGameHudMixin",
|
||||
"ItemColorsMixin",
|
||||
"LivingEntityRendererAccessor",
|
||||
"WorldRendererMixin",
|
||||
"shader.GameRendererMixin",
|
||||
"shader.ShaderProgramImportProcessorMixin",
|
||||
"shader.ShaderProgramMixin"
|
||||
|
|
|
@ -48,14 +48,14 @@ public class HudAndShaderTest implements ClientModInitializer {
|
|||
context.register(id, VertexFormats.POSITION, program -> testShader = program);
|
||||
});
|
||||
|
||||
HudRenderCallback.EVENT.register((drawableHelper, tickDelta) -> {
|
||||
HudRenderCallback.EVENT.register((drawContext, tickDelta) -> {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
Window window = client.getWindow();
|
||||
int x = window.getScaledWidth() - 15;
|
||||
int y = window.getScaledHeight() - 15;
|
||||
RenderSystem.setShader(() -> testShader);
|
||||
RenderSystem.setShaderColor(0f, 1f, 0f, 1f);
|
||||
Matrix4f positionMatrix = drawableHelper.method_51448().peek().getPositionMatrix();
|
||||
Matrix4f positionMatrix = drawContext.getMatrices().peek().getPositionMatrix();
|
||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
|
||||
buffer.vertex(positionMatrix, x, y, 50).next();
|
||||
|
|
|
@ -19,7 +19,7 @@ package net.fabricmc.fabric.api.client.screen.v1;
|
|||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
|
@ -91,7 +91,7 @@ public final class ScreenEvents {
|
|||
* }</pre>
|
||||
*
|
||||
* <p>Note that by adding an element to a screen, the element is not automatically {@link net.minecraft.client.gui.Drawable drawn}.
|
||||
* Unless the element is button, you need to call the specific {@link net.minecraft.client.gui.Drawable#render(DrawableHelper, int, int, float) render} methods in the corresponding screen events.
|
||||
* Unless the element is button, you need to call the specific {@link net.minecraft.client.gui.Drawable#render(DrawContext, int, int, float) render} methods in the corresponding screen events.
|
||||
*
|
||||
* <p>This event can also indicate that the previous screen has been closed.
|
||||
* @see ScreenEvents#BEFORE_INIT
|
||||
|
@ -176,12 +176,12 @@ public final class ScreenEvents {
|
|||
|
||||
@FunctionalInterface
|
||||
public interface BeforeRender {
|
||||
void beforeRender(Screen screen, DrawableHelper drawableHelper, int mouseX, int mouseY, float tickDelta);
|
||||
void beforeRender(Screen screen, DrawContext drawContext, int mouseX, int mouseY, float tickDelta);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface AfterRender {
|
||||
void afterRender(Screen screen, DrawableHelper drawableHelper, int mouseX, int mouseY, float tickDelta);
|
||||
void afterRender(Screen screen, DrawContext drawContext, int mouseX, int mouseY, float tickDelta);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
@ -42,18 +42,18 @@ abstract class GameRendererMixin {
|
|||
@Unique
|
||||
private Screen renderingScreen;
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawableHelper;IIF)V"), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
private void onBeforeRenderScreen(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, MatrixStack matrixStack, DrawableHelper drawableHelper) {
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V"), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
private void onBeforeRenderScreen(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, MatrixStack matrixStack, DrawContext drawContext) {
|
||||
// Store the screen in a variable in case someone tries to change the screen during this before render event.
|
||||
// If someone changes the screen, the after render event will likely have class cast exceptions or an NPE.
|
||||
this.renderingScreen = this.client.currentScreen;
|
||||
ScreenEvents.beforeRender(this.renderingScreen).invoker().beforeRender(this.renderingScreen, drawableHelper, mouseX, mouseY, tickDelta);
|
||||
ScreenEvents.beforeRender(this.renderingScreen).invoker().beforeRender(this.renderingScreen, drawContext, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
|
||||
// This injection should end up in the try block so exceptions are caught
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawableHelper;IIF)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
private void onAfterRenderScreen(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, MatrixStack matrixStack, DrawableHelper drawableHelper) {
|
||||
ScreenEvents.afterRender(this.renderingScreen).invoker().afterRender(this.renderingScreen, drawableHelper, mouseX, mouseY, tickDelta);
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
private void onAfterRenderScreen(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, MatrixStack matrixStack, DrawContext drawContext) {
|
||||
ScreenEvents.afterRender(this.renderingScreen).invoker().afterRender(this.renderingScreen, drawContext, mouseX, mouseY, tickDelta);
|
||||
// Finally set the currently rendering screen to null
|
||||
this.renderingScreen = null;
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ public final class ScreenTests implements ClientModInitializer {
|
|||
.orElseThrow(() -> new AssertionError("Failed to find the \"Stop Sound\" button in the screen's elements"));
|
||||
|
||||
// Register render event to draw an icon on the screen
|
||||
ScreenEvents.afterRender(screen).register((_screen, drawableHelper, mouseX, mouseY, tickDelta) -> {
|
||||
ScreenEvents.afterRender(screen).register((_screen, drawContext, mouseX, mouseY, tickDelta) -> {
|
||||
// Render an armor icon to test
|
||||
drawableHelper.drawTexture(ScreenTests.GUI_ICONS_TEXTURE, (screen.width / 2) - 124, (screen.height / 4) + 96, 20, 20, 34, 9, 9, 9, 256, 256);
|
||||
drawContext.drawTexture(ScreenTests.GUI_ICONS_TEXTURE, (screen.width / 2) - 124, (screen.height / 4) + 96, 20, 20, 34, 9, 9, 9, 256, 256);
|
||||
});
|
||||
|
||||
ScreenKeyboardEvents.allowKeyPress(screen).register((_screen, key, scancode, modifiers) -> {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.test.screen;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||
import net.minecraft.client.gui.widget.PressableWidget;
|
||||
|
@ -34,12 +34,12 @@ class StopSoundButton extends PressableWidget {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawableHelper drawableHelper, int mouseX, int mouseY, float tickDelta) {
|
||||
public void render(DrawContext drawContext, int mouseX, int mouseY, float tickDelta) {
|
||||
// Render the armor icon to test
|
||||
drawableHelper.drawTexture(ScreenTests.GUI_ICONS_TEXTURE, this.getX(), this.getY(), this.width, this.height, 43, 27, 9, 9, 256, 256);
|
||||
drawContext.drawTexture(ScreenTests.GUI_ICONS_TEXTURE, this.getX(), this.getY(), this.width, this.height, 43, 27, 9, 9, 256, 256);
|
||||
|
||||
if (this.isMouseOver(mouseX, mouseY)) {
|
||||
drawableHelper.method_51438(Screens.getTextRenderer(this.screen), Text.literal("Click to stop all sounds"), this.getX(), this.getY());
|
||||
drawContext.drawTooltip(Screens.getTextRenderer(this.screen), Text.literal("Click to stop all sounds"), this.getX(), this.getY());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Optional;
|
|||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
|
@ -47,10 +47,10 @@ public class PositionedScreen extends HandledScreen<ScreenHandler> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawableHelper drawableHelper, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(drawableHelper);
|
||||
super.render(drawableHelper, mouseX, mouseY, delta);
|
||||
drawMouseoverTooltip(drawableHelper, mouseX, mouseY);
|
||||
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(drawContext);
|
||||
super.render(drawContext, mouseX, mouseY, delta);
|
||||
drawMouseoverTooltip(drawContext, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,10 +61,10 @@ public class PositionedScreen extends HandledScreen<ScreenHandler> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(DrawableHelper drawableHelper, float delta, int mouseX, int mouseY) {
|
||||
protected void drawBackground(DrawContext drawContext, float delta, int mouseX, int mouseY) {
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int x = (width - backgroundWidth) / 2;
|
||||
int y = (height - backgroundHeight) / 2;
|
||||
drawableHelper.drawTexture(TEXTURE, x, y, 0, 0, backgroundWidth, backgroundHeight);
|
||||
drawContext.drawTexture(TEXTURE, x, y, 0, 0, backgroundWidth, backgroundHeight);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class PlayerInventoryStorageImpl extends InventoryStorageImpl implements PlayerI
|
|||
|
||||
// Drop in the world on the server side (will be synced by the game with the client).
|
||||
// Dropping items is server-side only because it involves randomness.
|
||||
if (amount > 0 && !playerInventory.player.world.isClient()) {
|
||||
if (amount > 0 && !playerInventory.player.getWorld().isClient()) {
|
||||
droppedStacks.addDrop(variant, amount, throwRandomly, retainOwnership, transaction);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.jetbrains.annotations.Nullable;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
|
@ -42,7 +41,7 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributes;
|
|||
|
||||
public class FluidChuteBlock extends Block implements BlockEntityProvider {
|
||||
public FluidChuteBlock() {
|
||||
super(Settings.of(Material.GENERIC));
|
||||
super(Settings.of());
|
||||
}
|
||||
|
||||
private static final VoxelShape SHAPE = VoxelShapes.cuboid(
|
||||
|
|
|
@ -19,13 +19,12 @@ package net.fabricmc.fabric.test.transfer.ingame;
|
|||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
|
||||
|
@ -35,8 +34,8 @@ import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage;
|
|||
public class TransferTestInitializer implements ModInitializer {
|
||||
public static final String MOD_ID = "fabric-transfer-api-v1-testmod";
|
||||
|
||||
private static final Block INFINITE_WATER_SOURCE = new Block(AbstractBlock.Settings.of(Material.GENERIC));
|
||||
private static final Block INFINITE_LAVA_SOURCE = new Block(AbstractBlock.Settings.of(Material.GENERIC));
|
||||
private static final Block INFINITE_WATER_SOURCE = new Block(AbstractBlock.Settings.of());
|
||||
private static final Block INFINITE_LAVA_SOURCE = new Block(AbstractBlock.Settings.of());
|
||||
private static final Block FLUID_CHUTE = new FluidChuteBlock();
|
||||
private static final Item EXTRACT_STICK = new ExtractStickItem();
|
||||
public static BlockEntityType<FluidChuteBlockEntity> FLUID_CHUTE_TYPE;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.joml.Matrix4f;
|
|||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.BufferRenderer;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
|
@ -50,7 +50,7 @@ public class FluidVariantRenderTest implements ClientModInitializer {
|
|||
public void onInitializeClient() {
|
||||
FluidVariantAttributes.enableColoredVanillaFluidNames();
|
||||
|
||||
HudRenderCallback.EVENT.register((drawableHelper, tickDelta) -> {
|
||||
HudRenderCallback.EVENT.register((drawContext, tickDelta) -> {
|
||||
PlayerEntity player = MinecraftClient.getInstance().player;
|
||||
if (player == null) return;
|
||||
|
||||
|
@ -61,12 +61,12 @@ public class FluidVariantRenderTest implements ClientModInitializer {
|
|||
|
||||
for (FluidVariant variant : variants) {
|
||||
Sprite[] sprites = FluidVariantRendering.getSprites(variant);
|
||||
int color = FluidVariantRendering.getColor(variant, player.world, player.getBlockPos());
|
||||
int color = FluidVariantRendering.getColor(variant, player.getWorld(), player.getBlockPos());
|
||||
|
||||
if (sprites != null) {
|
||||
drawFluidInGui(drawableHelper, sprites[0], color, 0, renderY);
|
||||
drawFluidInGui(drawContext, sprites[0], color, 0, renderY);
|
||||
renderY += 16;
|
||||
drawFluidInGui(drawableHelper, sprites[1], color, 0, renderY);
|
||||
drawFluidInGui(drawContext, sprites[1], color, 0, renderY);
|
||||
renderY += 16;
|
||||
}
|
||||
|
||||
|
@ -77,13 +77,13 @@ public class FluidVariantRenderTest implements ClientModInitializer {
|
|||
|
||||
for (Text line : tooltip) {
|
||||
renderY += 10;
|
||||
drawableHelper.method_51438(textRenderer, line, -8, renderY);
|
||||
drawContext.drawTooltip(textRenderer, line, -8, renderY);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void drawFluidInGui(DrawableHelper drawableHelper, Sprite sprite, int color, int i, int j) {
|
||||
private static void drawFluidInGui(DrawContext drawContext, Sprite sprite, int color, int i, int j) {
|
||||
if (sprite == null) return;
|
||||
|
||||
RenderSystem.setShaderTexture(0, SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
|
||||
|
@ -105,7 +105,7 @@ public class FluidVariantRenderTest implements ClientModInitializer {
|
|||
float v0 = sprite.getMinV();
|
||||
float u1 = sprite.getMaxU();
|
||||
float v1 = sprite.getMaxV();
|
||||
Matrix4f model = drawableHelper.method_51448().peek().getPositionMatrix();
|
||||
Matrix4f model = drawContext.getMatrices().peek().getPositionMatrix();
|
||||
bufferBuilder.vertex(model, x0, y1, z).color(r, g, b, 1).texture(u0, v1).next();
|
||||
bufferBuilder.vertex(model, x1, y1, z).color(r, g, b, 1).texture(u1, v1).next();
|
||||
bufferBuilder.vertex(model, x1, y0, z).color(r, g, b, 1).texture(u1, v0).next();
|
||||
|
|
|
@ -2,62 +2,62 @@ org.gradle.jvmargs=-Xmx2560M
|
|||
org.gradle.parallel=true
|
||||
fabric.loom.multiProjectOptimisation=true
|
||||
|
||||
version=0.79.0
|
||||
minecraft_version=23w16a
|
||||
yarn_version=+build.4
|
||||
version=0.79.1
|
||||
minecraft_version=23w17a
|
||||
yarn_version=+build.2
|
||||
loader_version=0.14.19
|
||||
installer_version=0.11.1
|
||||
|
||||
prerelease=true
|
||||
|
||||
# Do not manually update, use the bumpversions task:
|
||||
fabric-api-base-version=0.4.24
|
||||
fabric-api-lookup-api-v1-version=1.6.27
|
||||
fabric-biome-api-v1-version=13.0.7
|
||||
fabric-block-api-v1-version=1.0.6
|
||||
fabric-blockrenderlayer-v1-version=1.1.34
|
||||
fabric-command-api-v1-version=1.2.27
|
||||
fabric-command-api-v2-version=2.2.6
|
||||
fabric-commands-v0-version=0.2.44
|
||||
fabric-containers-v0-version=0.1.56
|
||||
fabric-content-registries-v0-version=4.0.1
|
||||
fabric-crash-report-info-v1-version=0.2.15
|
||||
fabric-data-generation-api-v1-version=12.1.0
|
||||
fabric-dimensions-v1-version=2.1.45
|
||||
fabric-entity-events-v1-version=1.5.15
|
||||
fabric-events-interaction-v0-version=0.4.43
|
||||
fabric-events-lifecycle-v0-version=0.2.54
|
||||
fabric-game-rule-api-v1-version=1.0.34
|
||||
fabric-gametest-api-v1-version=1.2.4
|
||||
fabric-item-api-v1-version=2.1.19
|
||||
fabric-item-group-api-v1-version=4.0.1
|
||||
fabric-key-binding-api-v1-version=1.0.33
|
||||
fabric-keybindings-v0-version=0.2.31
|
||||
fabric-lifecycle-events-v1-version=2.2.15
|
||||
fabric-loot-api-v2-version=1.1.30
|
||||
fabric-loot-tables-v1-version=1.1.34
|
||||
fabric-message-api-v1-version=5.1.1
|
||||
fabric-mining-level-api-v1-version=2.1.40
|
||||
fabric-models-v0-version=0.3.30
|
||||
fabric-networking-api-v1-version=1.3.3
|
||||
fabric-networking-v0-version=0.3.43
|
||||
fabric-object-builder-api-v1-version=10.0.1
|
||||
fabric-particles-v1-version=1.0.23
|
||||
fabric-recipe-api-v1-version=1.0.10
|
||||
fabric-registry-sync-v0-version=2.2.0
|
||||
fabric-renderer-api-v1-version=2.2.6
|
||||
fabric-renderer-indigo-version=1.1.2
|
||||
fabric-renderer-registries-v1-version=3.2.39
|
||||
fabric-rendering-data-attachment-v1-version=0.3.28
|
||||
fabric-rendering-fluids-v1-version=3.0.21
|
||||
fabric-rendering-v0-version=1.1.42
|
||||
fabric-rendering-v1-version=3.0.1
|
||||
fabric-resource-conditions-api-v1-version=2.3.1
|
||||
fabric-resource-loader-v0-version=0.11.2
|
||||
fabric-screen-api-v1-version=2.0.1
|
||||
fabric-screen-handler-api-v1-version=1.3.22
|
||||
fabric-sound-api-v1-version=1.0.9
|
||||
fabric-transfer-api-v1-version=3.1.2
|
||||
fabric-transitive-access-wideners-v1-version=4.0.2
|
||||
fabric-convention-tags-v1-version=1.4.1
|
||||
fabric-client-tags-api-v1-version=1.0.15
|
||||
fabric-api-base-version=0.4.25
|
||||
fabric-api-lookup-api-v1-version=1.6.28
|
||||
fabric-biome-api-v1-version=13.0.8
|
||||
fabric-block-api-v1-version=1.0.7
|
||||
fabric-blockrenderlayer-v1-version=1.1.35
|
||||
fabric-command-api-v1-version=1.2.28
|
||||
fabric-command-api-v2-version=2.2.7
|
||||
fabric-commands-v0-version=0.2.45
|
||||
fabric-containers-v0-version=0.1.57
|
||||
fabric-content-registries-v0-version=4.0.2
|
||||
fabric-crash-report-info-v1-version=0.2.16
|
||||
fabric-data-generation-api-v1-version=12.1.1
|
||||
fabric-dimensions-v1-version=2.1.46
|
||||
fabric-entity-events-v1-version=1.5.16
|
||||
fabric-events-interaction-v0-version=0.4.44
|
||||
fabric-events-lifecycle-v0-version=0.2.55
|
||||
fabric-game-rule-api-v1-version=1.0.35
|
||||
fabric-gametest-api-v1-version=1.2.5
|
||||
fabric-item-api-v1-version=2.1.20
|
||||
fabric-item-group-api-v1-version=4.0.2
|
||||
fabric-key-binding-api-v1-version=1.0.34
|
||||
fabric-keybindings-v0-version=0.2.32
|
||||
fabric-lifecycle-events-v1-version=2.2.16
|
||||
fabric-loot-api-v2-version=1.1.31
|
||||
fabric-loot-tables-v1-version=1.1.35
|
||||
fabric-message-api-v1-version=5.1.2
|
||||
fabric-mining-level-api-v1-version=2.1.41
|
||||
fabric-models-v0-version=0.3.31
|
||||
fabric-networking-api-v1-version=1.3.4
|
||||
fabric-networking-v0-version=0.3.44
|
||||
fabric-object-builder-api-v1-version=11.0.0
|
||||
fabric-particles-v1-version=1.0.24
|
||||
fabric-recipe-api-v1-version=1.0.11
|
||||
fabric-registry-sync-v0-version=2.2.1
|
||||
fabric-renderer-api-v1-version=2.2.7
|
||||
fabric-renderer-indigo-version=1.1.3
|
||||
fabric-renderer-registries-v1-version=3.2.40
|
||||
fabric-rendering-data-attachment-v1-version=0.3.29
|
||||
fabric-rendering-fluids-v1-version=3.0.22
|
||||
fabric-rendering-v0-version=1.1.43
|
||||
fabric-rendering-v1-version=3.0.2
|
||||
fabric-resource-conditions-api-v1-version=2.3.2
|
||||
fabric-resource-loader-v0-version=0.11.3
|
||||
fabric-screen-api-v1-version=2.0.2
|
||||
fabric-screen-handler-api-v1-version=1.3.23
|
||||
fabric-sound-api-v1-version=1.0.10
|
||||
fabric-transfer-api-v1-version=3.1.3
|
||||
fabric-transitive-access-wideners-v1-version=4.0.3
|
||||
fabric-convention-tags-v1-version=1.4.2
|
||||
fabric-client-tags-api-v1-version=1.0.16
|
||||
|
|
Loading…
Reference in a new issue