mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 11:18:23 +01:00
Optimize protochunk saving (#2218)
Use a chunk status cache to check if we could potentially overwrite a levelchunk. The check could be entirely elided at the risk of overwriting chunk data, however most protochunks should have their corresponding regionfile loaded with their chunk status.
This commit is contained in:
parent
413757949e
commit
f34c1b5fe2
1 changed files with 26 additions and 0 deletions
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 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 e89738a08d..89649e73e5 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -0,0 +0,0 @@ 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.getRegionFile(ichunkaccess.getPos(), false).getStatus(ichunkaccess.getPos().x, ichunkaccess.getPos().z, this);
|
||||
+ if (statusOnDisk != null && statusOnDisk.getType() == ChunkStatus.Type.LEVELCHUNK) {
|
||||
+ // Paper end
|
||||
return false;
|
||||
}
|
||||
|
||||
--
|
Loading…
Add table
Reference in a new issue