Skip to content

Commit

Permalink
refactor: merge sync load detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Oct 29, 2024
1 parent 4022b7e commit 354b818
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,8 @@ private void beforeAwaitChunk(ServerChunkManager.MainThreadExecutor instance, Bo
syncLoadNanos = System.nanoTime();
((IVanillaChunkManager) this.chunkLoadingManager).c2me$getSchedulingManager().setCurrentSyncLoad(this.currentSyncLoadChunk);
instance.runTasks(supplier);
}

@Inject(method = "getChunk(IILnet/minecraft/world/chunk/ChunkStatus;Z)Lnet/minecraft/world/chunk/Chunk;", at = @At("RETURN"))
private void afterGetChunk(int x, int z, ChunkStatus leastStatus, boolean create, CallbackInfoReturnable<Chunk> cir) {
if (Thread.currentThread() != this.serverThread) return;

if (this.currentSyncLoadChunk != null) {
this.currentSyncLoadChunk = null;
// System.out.println("Sync load took %.2fms".formatted((System.nanoTime() - syncLoadNanos) / 1e6));
((IVanillaChunkManager) this.chunkLoadingManager).c2me$getSchedulingManager().setCurrentSyncLoad(null);
}
((IVanillaChunkManager) this.chunkLoadingManager).c2me$getSchedulingManager().setCurrentSyncLoad(null);
this.currentSyncLoadChunk = null;
}

@Override
Expand Down

0 comments on commit 354b818

Please sign in to comment.