aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2024-07-11 07:16:42 -0700
committerSpottedleaf <[email protected]>2024-07-11 07:16:42 -0700
commitf7124df56b0c71b567b67dcffc66dae1cac181ad (patch)
tree4f7049fdebbaeba5de987b1b99e84028ae8a4b12
parent20889d04d8c7a11ff76061d99abcb58acd470fe7 (diff)
downloadPaper-f7124df56b0c71b567b67dcffc66dae1cac181ad.tar.gz
Paper-f7124df56b0c71b567b67dcffc66dae1cac181ad.zip
Fix recursive chunk loading in chunk unload event
Since the chunk may not even be at a loaded ticket level, the getChunk call may invoke a sync load. To prevent this, we can retrieve the full loaded chunk first which is guaranteed to be non-null when unloading.
-rw-r--r--patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch19
1 files changed, 16 insertions, 3 deletions
diff --git a/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch b/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch
index 6dd4a1a9b2..0ee26109b5 100644
--- a/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch
+++ b/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch
@@ -26377,7 +26377,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..cf33e22ae85cd30b4f5d526dbfececca
return crashreportsystemdetails;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index 09e60ea5c25f23bcc7e24f16c7a31f616d249ff9..478d6e2eaa1a8fded571ff2c2c623028c3def94d 100644
+index 191dfbd0f15c3a21278f3c4f9ce29f1698e0836c..ba64e42a58b4b760815f54228ebf7a46fd14734e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -199,7 +199,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
@@ -29478,10 +29478,23 @@ index 47c2b2da9799690291396effb9e1b06d71efc6fd..c42c0d1e4da30aa15f32d4ca524aeabd
for (SavedTick<T> savedTick : this.pendingTicks) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
-index 69c7fe5bf5b914276a9f7a0e57ce668e569d91f9..cce2fed2d4e9d6147ea1854321012c6950eb05cc 100644
+index 69c7fe5bf5b914276a9f7a0e57ce668e569d91f9..33322b57b4c6922f4daad0f584733f0f24083911 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
-@@ -116,60 +116,12 @@ public class CraftChunk implements Chunk {
+@@ -82,6 +82,12 @@ public class CraftChunk implements Chunk {
+ }
+
+ public ChunkAccess getHandle(ChunkStatus chunkStatus) {
++ // Paper start - rewrite chunk system
++ net.minecraft.world.level.chunk.LevelChunk full = this.worldServer.getChunkIfLoaded(this.x, this.z);
++ if (full != null) {
++ return full;
++ }
++ // Paper end - rewrite chunk system
+ ChunkAccess chunkAccess = this.worldServer.getChunk(this.x, this.z, chunkStatus);
+
+ // SPIGOT-7332: Get unwrapped extension
+@@ -116,60 +122,12 @@ public class CraftChunk implements Chunk {
@Override
public boolean isEntitiesLoaded() {