Skip to content
This repository was archived by the owner on Dec 29, 2023. It is now read-only.

Commit 98cdfed

Browse files
committed
Add 'chunk.async-spawn-chunks' option to config
1 parent 13f63eb commit 98cdfed

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
From 19eeaee0ca9b85ed087dc0e61d3f9d2a8b84dd1e Mon Sep 17 00:00:00 2001
2+
From: Peridot <[email protected]>
3+
Date: Mon, 31 Oct 2022 23:11:16 +0100
4+
Subject: [PATCH] Add 'chunk.async-spawn-chunks' option to config
5+
6+
7+
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
8+
index 35b656081..4cad02664 100644
9+
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
10+
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
11+
@@ -498,7 +498,7 @@ public abstract class MinecraftServer extends ReentrantIAsyncHandler<TasksPerTic
12+
}
13+
14+
++i;
15+
- worldserver.chunkProviderServer.getChunkAt(blockposition.getX() + k >> 4, blockposition.getZ() + l >> 4, true, true, AsyncPriority.HIGH, null); // Titanium - use new methods
16+
+ worldserver.chunkProviderServer.getChunkAt(blockposition.getX() + k >> 4, blockposition.getZ() + l >> 4, true, true, AsyncPriority.HIGH, TitaniumConfig.get().chunk.asyncSpawnChunks ? c -> {} : null); // Titanium - use new methods
17+
}
18+
}
19+
}
20+
diff --git a/src/main/java/net/titanium/config/TitaniumConfig.java b/src/main/java/net/titanium/config/TitaniumConfig.java
21+
index d2922e080..21ac1d019 100644
22+
--- a/src/main/java/net/titanium/config/TitaniumConfig.java
23+
+++ b/src/main/java/net/titanium/config/TitaniumConfig.java
24+
@@ -291,6 +291,10 @@ public class TitaniumConfig extends TitaniumConfigSection {
25+
26+
}
27+
28+
+ @Comment("Whether to load (or generate if possible) spawn chunks asynchronously.")
29+
+ @Comment("It can speed up server start by a lot, but also can cause some issues - for eg. player can appear under the map (and die in void), if joined before chunks were fully loaded/generated.")
30+
+ public boolean asyncSpawnChunks = false;
31+
+
32+
}
33+
34+
public Tnt tnt = new Tnt();
35+
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
36+
index 7dfe36870..64da9baf6 100644
37+
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
38+
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
39+
@@ -1145,7 +1145,7 @@ public final class CraftServer implements Server {
40+
}
41+
42+
BlockPosition chunkcoordinates = internal.getSpawn();
43+
- internal.chunkProviderServer.getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4, true, true, AsyncPriority.HIGH, null); // Titanium - use new methods
44+
+ internal.chunkProviderServer.getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4, true, true, AsyncPriority.HIGH, TitaniumConfig.get().chunk.asyncSpawnChunks ? c -> {} : null); // Titanium - use new methods
45+
}
46+
}
47+
}
48+
--
49+
2.36.0.windows.1
50+

0 commit comments

Comments
 (0)