From 5f00a1925b88ab7477bceb16e77c945270b1cebd Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Wed, 4 Oct 2023 09:02:08 +0700 Subject: [PATCH] yeah i fixed core auto refill sp[am !! --- .../chipmunkmod/mixin/ClientPlayerEntityMixin.java | 5 ++++- .../chipmunk/chipmunkmod/modules/CommandCore.java | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayerEntityMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayerEntityMixin.java index 5e21818..9f406e0 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayerEntityMixin.java @@ -30,6 +30,9 @@ public class ClientPlayerEntityMixin { final BlockPos origin = CommandCore.INSTANCE.origin; if (origin == null) { CommandCore.INSTANCE.move(position); return; } final int distance = (int) Math.sqrt(new Vec2f(origin.getX() / 16, origin.getZ() / 16).distanceSquared(new Vec2f((int) position.getX() / 16, (int) position.getZ() / 16))); - if (distance > world.getSimulationDistance()) CommandCore.INSTANCE.move(position); + if (distance > world.getSimulationDistance()) { + CommandCore.INSTANCE.clientPlayerEntityFilled = true; + CommandCore.INSTANCE.move(position); + } } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java index 4f65c1f..1742cf9 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java @@ -36,6 +36,8 @@ public class CommandCore { public boolean runFillCommand = true; + public boolean clientPlayerEntityFilled = false; + public static CommandCore INSTANCE = new CommandCore(MinecraftClient.getInstance()); public CommandCore (MinecraftClient client) { @@ -58,6 +60,13 @@ public class CommandCore { final TimerTask refillTask = new TimerTask() { @Override public void run() { + if (clientPlayerEntityFilled) { + clientPlayerEntityFilled = false; + return; + } + + check(); + if (!shouldRefill) return; refill(); @@ -85,8 +94,6 @@ public class CommandCore { } reloadRelativeArea(); - - check(); } public void reloadRelativeArea () {