fix: Dye Mention.

This commit is contained in:
Chayapak Supasakul 2024-12-29 08:26:19 +07:00
parent be0982431b
commit 4026ef2664
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA

View file

@ -8,6 +8,7 @@ import net.minecraft.block.CommandBlock;
import net.minecraft.block.entity.CommandBlockBlockEntity; import net.minecraft.block.entity.CommandBlockBlockEntity;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.ClientConnection; import net.minecraft.network.ClientConnection;
@ -33,6 +34,8 @@ public class CommandCore {
private boolean shouldRefill = false; private boolean shouldRefill = false;
private DimensionType oldDimension;
public boolean runFillCommand = true; public boolean runFillCommand = true;
public boolean clientPlayerEntityFilled = false; public boolean clientPlayerEntityFilled = false;
@ -101,16 +104,21 @@ public class CommandCore {
if (networkHandler == null || withPos == null || !ready) return; 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 { try {
for (int x = withPos.getMinX(); x <= withPos.getMaxX(); x++) { for (int x = withPos.getMinX(); x <= withPos.getMaxX(); x++) {
for (int y = withPos.getMinY(); y <= withPos.getMaxY(); y++) { for (int y = withPos.getMinY(); y <= withPos.getMaxY(); y++) {
for (int z = withPos.getMaxZ(); z <= withPos.getMaxZ(); z++) { for (int z = withPos.getMaxZ(); z <= withPos.getMaxZ(); z++) {
final BlockPos pos = new BlockPos(x, y, 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(); final Block block = world.getBlockState(pos).getBlock();
if (block instanceof CommandBlock) continue; if (block instanceof CommandBlock) continue;