From 354b818fa4ee36c8db3aa557bb41e5f81b17d237 Mon Sep 17 00:00:00 2001 From: ishland Date: Tue, 29 Oct 2024 11:42:25 +0800 Subject: [PATCH] refactor: merge sync load detection --- .../mixin/priority/MixinServerChunkManager.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/c2me-base/src/main/java/com/ishland/c2me/base/mixin/priority/MixinServerChunkManager.java b/c2me-base/src/main/java/com/ishland/c2me/base/mixin/priority/MixinServerChunkManager.java index 271c6a309..59b9fa39a 100644 --- a/c2me-base/src/main/java/com/ishland/c2me/base/mixin/priority/MixinServerChunkManager.java +++ b/c2me-base/src/main/java/com/ishland/c2me/base/mixin/priority/MixinServerChunkManager.java @@ -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 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