diff --git a/build.gradle b/build.gradle index 0be21ae8c..c6287584c 100644 --- a/build.gradle +++ b/build.gradle @@ -55,8 +55,8 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' - modRuntime "me.shedaniel:RoughlyEnoughItems-api:5.2.10" - modRuntime "me.shedaniel:RoughlyEnoughItems:5.2.10" + modRuntime "me.shedaniel:RoughlyEnoughItems-api:5.8.9" + modRuntime "me.shedaniel:RoughlyEnoughItems:5.8.9" } sourceSets { diff --git a/gradle.properties b/gradle.properties index 8be827870..430289d0e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,13 +5,13 @@ org.gradle.jvmargs=-Xmx1G mod_version=1.95.1-beta # Minecraft properties -mc_version=1.16.2 -mappings_version=31 +mc_version=1.16.4 +mappings_version=9 # Dependencies cloth_config_version=4.8.1 -fabric_api_version=0.19.0+build.398-1.16 -fabric_loader_version=0.9.2+build.206 +fabric_api_version=0.34.2+1.16 +fabric_loader_version=0.11.3 jankson_version=1.2.0 modmenu_version=1.14.6+ cloth_api_version=1.4.5 diff --git a/patchwork.md b/patchwork.md index ccda58db5..c413af097 100644 --- a/patchwork.md +++ b/patchwork.md @@ -590,4 +590,11 @@ c864576619751077a0d8ac1a18123e14b095ec03 Fix impostor recipes for disks ``` -[TODO] [JUMT-03] REI still shows white disks, probably because it doesn' show nbt items. \ No newline at end of file +[TODO] [JUMT-03] REI still shows white disks, probably because it doesn' show nbt items. + +``` +c5694ea9661c7a40021ebd280c378bd7bdc56988 + +Merge branch 'mc-1.15.x' into mc-1.16.x +``` +Update to 1.16.4. \ No newline at end of file diff --git a/src/main/java/dan200/computercraft/api/turtle/FakePlayer.java b/src/main/java/dan200/computercraft/api/turtle/FakePlayer.java index 76656fa78..4eac506e4 100644 --- a/src/main/java/dan200/computercraft/api/turtle/FakePlayer.java +++ b/src/main/java/dan200/computercraft/api/turtle/FakePlayer.java @@ -48,7 +48,7 @@ import net.minecraft.util.Hand; import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.village.TraderOfferList; +import net.minecraft.village.TradeOfferList; import net.minecraft.world.GameMode; /** @@ -105,7 +105,7 @@ public class FakePlayer extends ServerPlayerEntity { } @Override - public void sendTradeOffers(int id, TraderOfferList list, int level, int experience, boolean levelled, boolean refreshable) { } + public void sendTradeOffers(int id, TradeOfferList list, int level, int experience, boolean levelled, boolean refreshable) { } @Override public void openHorseInventory(HorseBaseEntity horse, Inventory inventory) { } @@ -251,10 +251,6 @@ public class FakePlayer extends ServerPlayerEntity { public void disconnect(Text message) { } - @Override - public void setupEncryption(SecretKey key) { - } - @Override public void disableAutoRead() { } diff --git a/src/main/java/dan200/computercraft/mixin/MixinWorld.java b/src/main/java/dan200/computercraft/mixin/MixinWorld.java index 04b45e796..be271fca2 100644 --- a/src/main/java/dan200/computercraft/mixin/MixinWorld.java +++ b/src/main/java/dan200/computercraft/mixin/MixinWorld.java @@ -32,7 +32,7 @@ public class MixinWorld { @Inject (method = "setBlockEntity", at = @At ("HEAD")) public void setBlockEntity(BlockPos pos, @Nullable BlockEntity entity, CallbackInfo info) { - if (!World.isHeightInvalid(pos) && entity != null && !entity.isRemoved() && this.iteratingTickingBlockEntities) { + if (!World.isOutOfBuildLimitVertically(pos) && entity != null && !entity.isRemoved() && this.iteratingTickingBlockEntities) { setWorld(entity, this); } } diff --git a/src/main/java/dan200/computercraft/shared/BundledRedstone.java b/src/main/java/dan200/computercraft/shared/BundledRedstone.java index dec3f0bf7..2e53b20b0 100644 --- a/src/main/java/dan200/computercraft/shared/BundledRedstone.java +++ b/src/main/java/dan200/computercraft/shared/BundledRedstone.java @@ -31,7 +31,7 @@ public final class BundledRedstone { } public static int getDefaultOutput(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull Direction side) { - return World.method_24794(pos) ? DefaultBundledRedstoneProvider.getDefaultBundledRedstoneOutput(world, pos, side) : -1; + return World.isValid(pos) ? DefaultBundledRedstoneProvider.getDefaultBundledRedstoneOutput(world, pos, side) : -1; } public static int getOutput(World world, BlockPos pos, Direction side) { @@ -40,7 +40,7 @@ public final class BundledRedstone { } private static int getUnmaskedOutput(World world, BlockPos pos, Direction side) { - if (!World.method_24794(pos)) { + if (!World.isValid(pos)) { return -1; } diff --git a/src/main/java/dan200/computercraft/shared/Peripherals.java b/src/main/java/dan200/computercraft/shared/Peripherals.java index 3357d264b..9f7b9e179 100644 --- a/src/main/java/dan200/computercraft/shared/Peripherals.java +++ b/src/main/java/dan200/computercraft/shared/Peripherals.java @@ -35,13 +35,11 @@ public final class Peripherals { @Nullable public static IPeripheral getPeripheral(World world, BlockPos pos, Direction side) { - return World.method_24794(pos) && !world.isClient ? getPeripheralAt(world, pos, side) : null; + return World.isValid(pos) && !world.isClient ? getPeripheralAt(world, pos, side) : null; } @Nullable private static IPeripheral getPeripheralAt(World world, BlockPos pos, Direction side) { - BlockEntity block = world.getBlockEntity(pos); - // Try the handlers in order: for (IPeripheralProvider peripheralProvider : providers) { try { diff --git a/src/main/java/dan200/computercraft/shared/command/CommandUtils.java b/src/main/java/dan200/computercraft/shared/command/CommandUtils.java index 26754058b..375dd4402 100644 --- a/src/main/java/dan200/computercraft/shared/command/CommandUtils.java +++ b/src/main/java/dan200/computercraft/shared/command/CommandUtils.java @@ -17,7 +17,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import dan200.computercraft.api.turtle.FakePlayer; import net.minecraft.entity.Entity; -import net.minecraft.server.command.CommandSource; +import net.minecraft.command.CommandSource; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; diff --git a/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java b/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java index fe87d15dd..fa7cf62cd 100644 --- a/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java +++ b/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java @@ -207,7 +207,7 @@ public class CommandAPI implements ILuaAPI { World world = this.computer.getWorld(); BlockPos min = new BlockPos(Math.min(minX, maxX), Math.min(minY, maxY), Math.min(minZ, maxZ)); BlockPos max = new BlockPos(Math.max(minX, maxX), Math.max(minY, maxY), Math.max(minZ, maxZ)); - if (!World.method_24794(min) || !World.method_24794(max)) { + if (!World.isValid(min) || !World.isValid(max)) { throw new LuaException("Co-ordinates out of range"); } @@ -284,7 +284,7 @@ public class CommandAPI implements ILuaAPI { // Get the details of the block World world = this.computer.getWorld(); BlockPos position = new BlockPos(x, y, z); - if (World.method_24794(position)) { + if (World.isValid(position)) { return getBlockInfo(world, position); } else { throw new LuaException("Co-ordinates out of range"); diff --git a/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java b/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java index 770e78af8..cc4b1a7fa 100644 --- a/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java +++ b/src/main/java/dan200/computercraft/shared/computer/core/ServerComputer.java @@ -316,7 +316,7 @@ public class ServerComputer extends ServerTerminal implements IComputer, IComput @Nonnull @Override public String getHostString() { - return String.format("ComputerCraft %s (Minecraft %s)", ComputerCraftAPI.getInstalledVersion(), "1.16.2"); + return String.format("ComputerCraft %s (Minecraft %s)", ComputerCraftAPI.getInstalledVersion(), "1.16.4"); } @Nonnull diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java index 780e117b1..1e0bfde8c 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtleMoveCommand.java @@ -119,10 +119,10 @@ public class TurtleMoveCommand implements ITurtleCommand { } private static TurtleCommandResult canEnter(TurtlePlayer turtlePlayer, World world, BlockPos position) { - if (World.isHeightInvalid(position)) { + if (World.isOutOfBuildLimitVertically(position)) { return TurtleCommandResult.failure(position.getY() < 0 ? "Too low to move" : "Too high to move"); } - if (!World.method_24794(position)) { + if (!World.isValid(position)) { return TurtleCommandResult.failure("Cannot leave the world"); } diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java index e02ec415e..a21479d1c 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java @@ -364,7 +364,7 @@ public class TurtlePlaceCommand implements ITurtleCommand { private static boolean canDeployOnBlock(@Nonnull ItemPlacementContext context, ITurtleAccess turtle, TurtlePlayer player, BlockPos position, Direction side, boolean allowReplaceable, String[] outErrorMessage) { World world = turtle.getWorld(); - if (!World.method_24794(position) || world.isAir(position) || (context.getStack() + if (!World.isValid(position) || world.isAir(position) || (context.getStack() .getItem() instanceof BlockItem && WorldUtil.isLiquidBlock(world, position))) { return false; diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java index 35150d795..724898819 100644 --- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java +++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java @@ -77,7 +77,7 @@ public final class TurtlePlayer extends FakePlayer { private void setState(ITurtleAccess turtle) { if (this.currentScreenHandler != playerScreenHandler) { ComputerCraft.log.warn("Turtle has open container ({})", this.currentScreenHandler); - closeCurrentScreen(); + closeHandledScreen(); } BlockPos position = turtle.getPosition(); @@ -91,13 +91,8 @@ public final class TurtlePlayer extends FakePlayer { } public static TurtlePlayer get(ITurtleAccess access) { - ServerWorld world = (ServerWorld) access.getWorld(); if( !(access instanceof TurtleBrain) ) return create( access ); - /*if (!(access instanceof TurtleBrain)) { - return new TurtlePlayer(world, access.getOwningPlayer()); - }*/ - TurtleBrain brain = (TurtleBrain) access; TurtlePlayer player = brain.m_cachedPlayer; if (player == null || player.getGameProfile() != getProfile(access.getOwningPlayer()) || player.getEntityWorld() != access.getWorld()) { diff --git a/src/main/java/dan200/computercraft/shared/util/FakeNetHandler.java b/src/main/java/dan200/computercraft/shared/util/FakeNetHandler.java index cd5d9d8b6..3b0b93d99 100644 --- a/src/main/java/dan200/computercraft/shared/util/FakeNetHandler.java +++ b/src/main/java/dan200/computercraft/shared/util/FakeNetHandler.java @@ -14,7 +14,6 @@ import dan200.computercraft.api.turtle.FakePlayer; import io.netty.channel.ChannelHandlerContext; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; - import net.minecraft.network.ClientConnection; import net.minecraft.network.NetworkSide; import net.minecraft.network.NetworkState; @@ -25,15 +24,12 @@ import net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket; import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket; import net.minecraft.network.packet.c2s.play.ButtonClickC2SPacket; import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket; -import net.minecraft.network.packet.c2s.play.ClickWindowC2SPacket; import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; import net.minecraft.network.packet.c2s.play.ClientSettingsC2SPacket; import net.minecraft.network.packet.c2s.play.ClientStatusC2SPacket; -import net.minecraft.network.packet.c2s.play.ConfirmGuiActionC2SPacket; import net.minecraft.network.packet.c2s.play.CraftRequestC2SPacket; import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket; import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket; -import net.minecraft.network.packet.c2s.play.GuiCloseC2SPacket; import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; import net.minecraft.network.packet.c2s.play.KeepAliveC2SPacket; import net.minecraft.network.packet.c2s.play.PickFromInventoryC2SPacket; @@ -48,7 +44,6 @@ import net.minecraft.network.packet.c2s.play.QueryEntityNbtC2SPacket; import net.minecraft.network.packet.c2s.play.RenameItemC2SPacket; import net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket; import net.minecraft.network.packet.c2s.play.ResourcePackStatusC2SPacket; -import net.minecraft.network.packet.c2s.play.SelectVillagerTradeC2SPacket; import net.minecraft.network.packet.c2s.play.SpectatorTeleportC2SPacket; import net.minecraft.network.packet.c2s.play.TeleportConfirmC2SPacket; import net.minecraft.network.packet.c2s.play.UpdateBeaconC2SPacket; @@ -127,10 +122,6 @@ public class FakeNetHandler extends ServerPlayNetworkHandler { public void onJigsawUpdate(@Nonnull UpdateJigsawC2SPacket packet) { } - @Override - public void onVillagerTradeSelect(@Nonnull SelectVillagerTradeC2SPacket packet) { - } - @Override public void onBookUpdate(@Nonnull BookUpdateC2SPacket packet) { } @@ -207,14 +198,6 @@ public class FakeNetHandler extends ServerPlayNetworkHandler { public void onClientStatus(@Nonnull ClientStatusC2SPacket packet) { } - @Override - public void onGuiClose(@Nonnull GuiCloseC2SPacket packet) { - } - - @Override - public void onClickWindow(@Nonnull ClickWindowC2SPacket packet) { - } - @Override public void onCraftRequest(@Nonnull CraftRequestC2SPacket packet) { } @@ -227,10 +210,6 @@ public class FakeNetHandler extends ServerPlayNetworkHandler { public void onCreativeInventoryAction(@Nonnull CreativeInventoryActionC2SPacket packet) { } - @Override - public void onConfirmTransaction(@Nonnull ConfirmGuiActionC2SPacket packet) { - } - @Override public void onSignUpdate(@Nonnull UpdateSignC2SPacket packet) { } @@ -309,10 +288,6 @@ public class FakeNetHandler extends ServerPlayNetworkHandler { this.closeReason = message; } - @Override - public void setupEncryption(@Nonnull SecretKey key) { - } - @Nonnull @Override public PacketListener getPacketListener() { diff --git a/src/main/java/dan200/computercraft/shared/util/WorldUtil.java b/src/main/java/dan200/computercraft/shared/util/WorldUtil.java index 284af67d3..df99b66d1 100644 --- a/src/main/java/dan200/computercraft/shared/util/WorldUtil.java +++ b/src/main/java/dan200/computercraft/shared/util/WorldUtil.java @@ -40,7 +40,7 @@ public final class WorldUtil { .makeMap(); public static boolean isLiquidBlock(World world, BlockPos pos) { - if (!World.method_24794(pos)) { + if (!World.isValid(pos)) { return false; } return world.getBlockState(pos)