From 6073966852cea0d5ffcf5048831766753dace91a Mon Sep 17 00:00:00 2001 From: ishland Date: Thu, 2 Jan 2025 21:39:27 +0800 Subject: [PATCH] fix: no-tick pending chunk loads counter --- .../notickvd/common/PlayerNoTickLoader.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/common/PlayerNoTickLoader.java b/c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/common/PlayerNoTickLoader.java index aabdfd8e..b2a9c4ce 100644 --- a/c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/common/PlayerNoTickLoader.java +++ b/c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/common/PlayerNoTickLoader.java @@ -114,16 +114,6 @@ public void tick() { } this.tickFutures(); - - { - long pendingLoadsCount = 0L; - ObjectBidirectionalIterator> iterator = this.iterators.long2ReferenceEntrySet().fastIterator(); - while (iterator.hasNext()) { - Long2ReferenceMap.Entry entry = iterator.next(); - pendingLoadsCount += entry.getValue().remaining(); - } - this.pendingLoadsCountSnapshot = pendingLoadsCount; - } } private void clearTickets() { @@ -142,6 +132,16 @@ void tickFutures() { if (this.closing.get()) return; while (this.chunkLoadFutures.size() < Config.maxConcurrentChunkLoads && this.addOneTicket()); + + { + long pendingLoadsCount = 0L; + ObjectBidirectionalIterator> iterator = this.iterators.long2ReferenceEntrySet().fastIterator(); + while (iterator.hasNext()) { + Long2ReferenceMap.Entry entry = iterator.next(); + pendingLoadsCount += entry.getValue().remaining(); + } + this.pendingLoadsCountSnapshot = pendingLoadsCount; + } } private boolean addOneTicket() {