Skip to content

Commit

Permalink
Remove debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Axionize committed Nov 25, 2024
1 parent 97afbd8 commit 06210f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<BlockModification> blockModifications = player.blockHistory.getRecentModifications((blockModification) -> currentTick - blockModification.getTick() == 0
&& blockPos.equals(blockModification.getLocation())
&& blockModification.getCause() == BlockModification.Cause.START_DIGGING);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
52 changes: 0 additions & 52 deletions src/main/java/ac/grim/grimac/utils/latency/CompensatedWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Vector3i> toApplyBlocks) source: PacketType.Play.Client.PONG"; // handle realtime task in applyBlockChanges(List<Vector3i> 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.
Expand Down

0 comments on commit 06210f0

Please sign in to comment.