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.
This commit is contained in:
parent
20889d04d8
commit
f7124df56b
1 changed files with 16 additions and 3 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue