Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-17 03:50:08 +01:00
286bd1bfb5
- Port player chunk loader patch Makes the chunk system act as it did in 1.17, no additional tickets (and thus logic) to make a chunk ticking. Adds simulation distance API, deprecates old no-tick method. - More collision optimisations Ancient patch from tuinity that never could be pushed to master. - Fix Optimise ArraySetSorted#removeIf patch - Execute chunk tasks fairly for worlds while waiting for next tick - Port Replace ticket level propagator
38 Zeilen
1.9 KiB
Diff
38 Zeilen
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sun, 21 Mar 2021 17:32:47 -0700
|
|
Subject: [PATCH] Correctly handle recursion for chunkholder updates
|
|
|
|
If a chunk ticket level is brought up while unloading it would
|
|
cause a recursive call which would handle the increase but then
|
|
the caller would think the chunk would be unloaded.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
|
index c2a040f735db091b5fb6017aa28a95f91ebcd9d3..49247d12e743f987113524121e60a3e0ba4a825a 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
|
@@ -443,8 +443,10 @@ public class ChunkHolder {
|
|
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
|
|
}
|
|
|
|
+ protected long updateCount; // Paper - correctly handle recursion
|
|
protected void updateFutures(ChunkMap chunkStorage, Executor executor) {
|
|
io.papermc.paper.util.TickThread.ensureTickThread("Async ticket level update"); // Paper
|
|
+ long updateCount = ++this.updateCount; // Paper - correctly handle recursion
|
|
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
|
|
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
|
|
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
|
|
@@ -486,6 +488,12 @@ public class ChunkHolder {
|
|
|
|
// Run callback right away if the future was already done
|
|
chunkStorage.callbackExecutor.run();
|
|
+ // Paper start - correctly handle recursion
|
|
+ if (this.updateCount != updateCount) {
|
|
+ // something else updated ticket level for us.
|
|
+ return;
|
|
+ }
|
|
+ // Paper end - correctly handle recursion
|
|
}
|
|
// CraftBukkit end
|
|
|