diff --git a/src/main/java/ac/grim/grimac/checks/impl/scaffolding/AirLiquidPlace.java b/src/main/java/ac/grim/grimac/checks/impl/scaffolding/AirLiquidPlace.java index 455bc833d8..7f31823f23 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/scaffolding/AirLiquidPlace.java +++ b/src/main/java/ac/grim/grimac/checks/impl/scaffolding/AirLiquidPlace.java @@ -46,6 +46,8 @@ public void onBlockPlace(final BlockPlace place) { StateType placeAgainst = player.compensatedWorld.getStateTypeAt(blockPos.getX(), blockPos.getY(), blockPos.getZ()); int currentTick = GrimAPI.INSTANCE.getTickManager().currentTick; + + Iterable blockModifications = player.blockHistory.getRecentModifications((blockModification) -> currentTick - blockModification.getTick() == 0 && blockPos.equals(blockModification.getLocation()) && blockModification.getCause() == BlockModification.Cause.START_DIGGING); diff --git a/src/main/java/ac/grim/grimac/manager/tick/impl/ClearRecentlyUpdatedBlocks.java b/src/main/java/ac/grim/grimac/manager/tick/impl/ClearRecentlyUpdatedBlocks.java index 4d8d3eb833..388fd0e6d0 100644 --- a/src/main/java/ac/grim/grimac/manager/tick/impl/ClearRecentlyUpdatedBlocks.java +++ b/src/main/java/ac/grim/grimac/manager/tick/impl/ClearRecentlyUpdatedBlocks.java @@ -1,19 +1,17 @@ package ac.grim.grimac.manager.tick.impl; import ac.grim.grimac.GrimAPI; -import ac.grim.grimac.manager.TickManager; import ac.grim.grimac.manager.tick.Tickable; import ac.grim.grimac.player.GrimPlayer; public class ClearRecentlyUpdatedBlocks implements Tickable { - private static final TickManager tickManager = GrimAPI.INSTANCE.getTickManager(); private static final int maxTickAge = 2; @Override public void tick() { for (GrimPlayer player : GrimAPI.INSTANCE.getPlayerDataManager().getEntries()) { - player.blockHistory.cleanup(tickManager.currentTick - maxTickAge); + player.blockHistory.cleanup(GrimAPI.INSTANCE.getTickManager().currentTick - maxTickAge); } } } diff --git a/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java b/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java index e3a08683aa..672a63a2be 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java @@ -2,7 +2,6 @@ import ac.grim.grimac.GrimAPI; import ac.grim.grimac.player.GrimPlayer; -import ac.grim.grimac.utils.anticheat.LogUtil; import ac.grim.grimac.utils.chunks.Column; import ac.grim.grimac.utils.collisions.CollisionData; import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox; @@ -287,57 +286,6 @@ public void updateBlock(int x, int y, int z, int combinedID) { // The method also gets called for the previous state before replacement player.pointThreeEstimator.handleChangeBlock(x, y, z, chunk.get(blockVersion, x & 0xF, offsetY & 0xF, z & 0xF)); - - // Debugging information - WrappedBlockState oldState = chunk.get(blockVersion, x & 0xF, offsetY & 0xF, z & 0xF); - String oldStateString = (oldState != null) ? oldState.toString() : "null"; - - WrappedBlockState newState = WrappedBlockState.getByGlobalId(combinedID); - String newStateString = newState.toString(); - - Vector3i blockPos = new Vector3i(x, y, z); - - int currentTick = GrimAPI.INSTANCE.getTickManager() != null - ? GrimAPI.INSTANCE.getTickManager().currentTick - : -1; // Fallback tick value - - String sourceString; - - // Get the entire stack trace - StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); - - if (stackTrace[3].toString().contains("handleNettySyncTransaction(LatencyUtils.java:56")) { - sourceString = "cause: handleNettySyncTransaction(LatencyUtils.java:56) source: PacketType.Play.Client.PONG"; - } else if (stackTrace[2].toString().contains("CheckManagerListener.java:486")) { - sourceString = "cause/source: DiggingAction.START_DIGGING"; - } else if (stackTrace[2].toString().contains("CheckManagerListener.java:470")) { - sourceString = "cause/source: DiggingAction.FINISHED_DIGGING"; - } else if (stackTrace[8].toString().contains("handleQueuedPlaces(CheckManagerListener.java:201")) { - sourceString = "cause: handleQueuedPlaces(): source: handleQueuedPlaces(CheckManagerListener.java:201) source: PacketType.Play.Client.PONG"; - } else if (stackTrace[6].toString().contains("LatencyUtils.handleNettySyncTransaction(LatencyUtils.java:56")) { - sourceString = "cause: realtime task in applyBlockChanges(List toApplyBlocks) source: PacketType.Play.Client.PONG"; // handle realtime task in applyBlockChanges(List toApplyBlocks) - } else { - // Build a string for the stack trace - StringBuilder stackTraceBuilder = new StringBuilder("cause/source: stack trace:\n"); - for (StackTraceElement element : stackTrace) { - stackTraceBuilder.append("\tat ").append(element.toString()).append("\n"); - } - sourceString = stackTraceBuilder.toString(); - } - - // Format the main log message - String logMessage = String.format( - "Async world updated: %s -> %s at %s, tick %d, %s", - oldStateString, - newStateString, - blockPos, - currentTick, - sourceString - ); - -// Log everything - LogUtil.info(logMessage); - chunk.set(null, x & 0xF, offsetY & 0xF, z & 0xF, combinedID); // Handle stupidity such as fluids changing in idle ticks.