Paper/Spigot-Server-Patches/0396-Use-ChunkStatus-cache-when-saving-protochunks.patch
Shane Freeder 3032599d38
Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
43183eab SPIGOT-5399: spawn-npcs ignored during world generation
e9bb2f15 SPIGOT-5403: isSimilar returns true for different skulls
5c9e7236 SPIGOT-5409: Remove unnecessary defaulting in CraftMetaBookSigned
821238b6 SPIGOT-5412: Use SpawnReason.NATURAL for wandering traders and trader llamas
2019-12-05 10:23:10 +00:00

29 lines
1.4 KiB
Diff

From ed1c70806a105bbdab1a54def039ed2e4f4307b4 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 22 Jun 2019 04:20:47 -0700
Subject: [PATCH] Use ChunkStatus cache when saving protochunks
The cache should contain the chunk status when saving. If not it
will load it.
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index eb49e9021..b04657356 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -774,8 +774,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
NBTTagCompound nbttagcompound;
if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) {
- nbttagcompound = this.readChunkData(chunkcoordintpair);
- if (nbttagcompound != null && ChunkRegionLoader.a(nbttagcompound) == ChunkStatus.Type.LEVELCHUNK) {
+ // Paper start - Optimize save by using status cache
+ ChunkStatus statusOnDisk = this.getChunkStatusOnDisk(chunkcoordintpair);
+ if (statusOnDisk != null && statusOnDisk.getType() == ChunkStatus.Type.LEVELCHUNK) {
+ // Paper end
return false;
}
--
2.24.0