SPIGOT-7332: Persistent Data Container of Chunk not saving on stop or restart.

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2023-04-09 05:24:52 +02:00
parent c01ce41ff3
commit 4147116921

View File

@ -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