From 41471169215feaa74c8929418e98a0cc8ea8e130 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 9 Apr 2023 05:24:52 +0200 Subject: [PATCH] SPIGOT-7332: Persistent Data Container of Chunk not saving on stop or restart. By: DerFrZocker --- .../main/java/org/bukkit/craftbukkit/CraftChunk.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 01d9473d25..88833a1b75 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -30,6 +30,7 @@ import net.minecraft.world.level.chunk.DataPaletteBlock; import net.minecraft.world.level.chunk.IChunkAccess; import net.minecraft.world.level.chunk.NibbleArray; import net.minecraft.world.level.chunk.PalettedContainerRO; +import net.minecraft.world.level.chunk.ProtoChunkExtension; import net.minecraft.world.level.chunk.storage.ChunkRegionLoader; import net.minecraft.world.level.chunk.storage.EntityStorage; import net.minecraft.world.level.entity.PersistentEntitySectionManager; @@ -78,7 +79,14 @@ public class CraftChunk implements Chunk { } public IChunkAccess getHandle(ChunkStatus chunkStatus) { - return worldServer.getChunk(x, z, chunkStatus); + IChunkAccess chunkAccess = worldServer.getChunk(x, z, chunkStatus); + + // SPIGOT-7332: Get unwrapped extension + if (chunkAccess instanceof ProtoChunkExtension extension) { + return extension.getWrapped(); + } + + return chunkAccess; } @Override