Paper/Spigot-Server-Patches/0304-Don-t-save-Proto-Chunks.patch
Aikar 6666adc92c don't try to load protochunks, we don't save them
no reason to try to load them when we don't save them!
2018-08-11 00:12:25 -04:00

46 lines
2.1 KiB
Diff

From e898f5e48550519d801479423c19d692e2c64fea Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 22 Jul 2018 21:21:41 -0400
Subject: [PATCH] Don't save Proto Chunks
These chunks are unfinished, and waste cpu time saving these unfinished chunks.
the loadChunk method refuses to acknoledge they exists, and will restart
a new chunk generation process to begin with, so saving them serves no benefit.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index ea868474..a97e024e 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -282,6 +282,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
public synchronized void saveChunk(World world, IChunkAccess ichunkaccess, boolean unloaded) throws IOException, ExceptionWorldConflict {
+ if (ichunkaccess.i().d() == ChunkStatus.Type.PROTOCHUNK) { return; } // Paper - don't save proto chunks
// Spigot end
world.checkSession();
diff --git a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
index 5d9118da..ca1516f2 100644
--- a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
+++ b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
@@ -23,7 +23,7 @@ public class ChunkTaskScheduler extends Scheduler<ChunkCoordIntPair, ChunkStatus
protected boolean a(Scheduler.a scheduler_a) {
ProtoChunk protochunk = (ProtoChunk) scheduler_a.a();
- return !protochunk.ab_() && !protochunk.h();
+ return !protochunk.ab_() /*&& !protochunk.h()*/; // Paper
}
});
@@ -64,6 +64,7 @@ public class ChunkTaskScheduler extends Scheduler<ChunkCoordIntPair, ChunkStatus
@Nullable
private ProtoChunk a(int i, int j) {
+ if (true) return null; // Paper - we don't save proto chunks
try {
return this.e.b(this.c, i, j, (ichunkaccess) -> {
});
--
2.18.0