yeah i fixed core auto refill sp[am !!

This commit is contained in:
Chayapak 2023-10-04 09:02:08 +07:00
parent f3a259384c
commit 5f00a1925b
2 changed files with 13 additions and 3 deletions

View file

@ -30,6 +30,9 @@ public class ClientPlayerEntityMixin {
final BlockPos origin = CommandCore.INSTANCE.origin; final BlockPos origin = CommandCore.INSTANCE.origin;
if (origin == null) { CommandCore.INSTANCE.move(position); return; } 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))); 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);
}
} }
} }

View file

@ -36,6 +36,8 @@ public class CommandCore {
public boolean runFillCommand = true; public boolean runFillCommand = true;
public boolean clientPlayerEntityFilled = false;
public static CommandCore INSTANCE = new CommandCore(MinecraftClient.getInstance()); public static CommandCore INSTANCE = new CommandCore(MinecraftClient.getInstance());
public CommandCore (MinecraftClient client) { public CommandCore (MinecraftClient client) {
@ -58,6 +60,13 @@ public class CommandCore {
final TimerTask refillTask = new TimerTask() { final TimerTask refillTask = new TimerTask() {
@Override @Override
public void run() { public void run() {
if (clientPlayerEntityFilled) {
clientPlayerEntityFilled = false;
return;
}
check();
if (!shouldRefill) return; if (!shouldRefill) return;
refill(); refill();
@ -85,8 +94,6 @@ public class CommandCore {
} }
reloadRelativeArea(); reloadRelativeArea();
check();
} }
public void reloadRelativeArea () { public void reloadRelativeArea () {