From 4026ef266455d83fe49b3757904890bd29f696f6 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+chomens@users.noreply.github.com> Date: Sun, 29 Dec 2024 08:26:19 +0700 Subject: [PATCH] fix: Dye Mention. --- .../chipmunkmod/modules/CommandCore.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java index 54d63a7..75ab9a6 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java @@ -8,6 +8,7 @@ import net.minecraft.block.CommandBlock; import net.minecraft.block.entity.CommandBlockBlockEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.ClientConnection; @@ -33,6 +34,8 @@ public class CommandCore { private boolean shouldRefill = false; + private DimensionType oldDimension; + public boolean runFillCommand = true; public boolean clientPlayerEntityFilled = false; @@ -101,16 +104,21 @@ public class CommandCore { if (networkHandler == null || withPos == null || !ready) return; + final ClientPlayerEntity player = client.player; + final ClientWorld world = client.world; + + if (player == null || world == null) return; + + if (oldDimension != null && !oldDimension.equals(world.getDimension())) move(client.player.getPos()); + + oldDimension = world.getDimension(); + try { for (int x = withPos.getMinX(); x <= withPos.getMaxX(); x++) { for (int y = withPos.getMinY(); y <= withPos.getMaxY(); y++) { for (int z = withPos.getMaxZ(); z <= withPos.getMaxZ(); z++) { final BlockPos pos = new BlockPos(x, y, z); - final ClientWorld world = client.world; - - if (world == null) return; - final Block block = world.getBlockState(pos).getBlock(); if (block instanceof CommandBlock) continue;