aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0295-Don-t-save-Proto-Chunks.patch
blob: 190d00d477e249f9acaca7216df618e982b7d7cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 745f1a69fc7480310f06db300dd9b112b92ceb00 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 0fc4d9f520..2c4a4fc6b7 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -304,6 +304,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
     }
 
     public 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 70a95c2636..56958a5ce3 100644
--- a/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
+++ b/src/main/java/net/minecraft/server/ChunkTaskScheduler.java
@@ -21,7 +21,7 @@ public class ChunkTaskScheduler extends Scheduler<ChunkCoordIntPair, ChunkStatus
         protected boolean a(Scheduler<ChunkCoordIntPair, ChunkStatus, ProtoChunk>.a scheduler_a) {
             ProtoChunk protochunk = (ProtoChunk) scheduler_a.a();
 
-            return !protochunk.ab_() && !protochunk.h();
+            return !protochunk.ab_() /*&& !protochunk.h()*/; // Paper
         }
     };
 
@@ -85,6 +85,7 @@ public class ChunkTaskScheduler extends Scheduler<ChunkCoordIntPair, ChunkStatus
     }
 
     public void a(BooleanSupplier booleansupplier) {
+        if (true) return; // Paper - we don't save proto chunks, and don't want to block thread
         IChunkLoader ichunkloader = this.e;
 
         synchronized (this.e) {
-- 
2.21.0