Paper/Spigot-Server-Patches/0385-Use-ChunkStatus-cache-when-saving-protochunks.patch
MiniDigger 44d032f1e9 Houston, we got a patch (#2731)
* Houston, we got a patch

* is this the end of the beginning or the beginning of the end
2019-12-12 16:20:43 +00:00

29 lines
1.4 KiB
Diff

From dc460bf237dd914ca9485c60ffde346f290fa9fc 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 4379434f6..93729eea2 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -775,8 +775,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.1