mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-21 07:49:18 +00:00
Regionized Chunk Ticking (#26)
* remove this * rct dev * experiment this * it finally works! * update description * fix mob issues * sync to new config * Fix realocation of configs for spark * RCT split chunks rewrite and other features * add debug * even more optimizations and comment out debug * oops * merge RCT patches * some final changes * add experimental warn * [ci-skip] update readme info --------- Co-authored-by: dan28000 <pirkldan28@gmail.com>
This commit is contained in:
@@ -198,6 +198,11 @@ public class DivineConfig {
|
||||
public static boolean disableHardThrow = false;
|
||||
public static boolean pwtCompatabilityMode = false;
|
||||
|
||||
// Regionized chunk ticking
|
||||
public static boolean enableRegionizedChunkTicking = false;
|
||||
public static int regionizedChunkTickingExecutorThreadCount = 4;
|
||||
public static int regionizedChunkTickingExecutorThreadPriority = Thread.NORM_PRIORITY + 2;
|
||||
|
||||
// Async pathfinding settings
|
||||
public static boolean asyncPathfinding = true;
|
||||
public static int asyncPathfindingMaxThreads = 2;
|
||||
@@ -220,6 +225,7 @@ public class DivineConfig {
|
||||
|
||||
public static void load() {
|
||||
parallelWorldTicking();
|
||||
regionizedChunkTicking();
|
||||
asyncPathfinding();
|
||||
multithreadedTracker();
|
||||
asyncChunkSending();
|
||||
@@ -239,6 +245,25 @@ public class DivineConfig {
|
||||
"Enables compatibility mode for plugins that are not compatible with Parallel World Ticking. This makes all async tasks run synchronously.");
|
||||
}
|
||||
|
||||
private static void regionizedChunkTicking() {
|
||||
enableRegionizedChunkTicking = getBoolean(ConfigCategory.ASYNC.key("regionized-chunk-ticking.enable"), enableRegionizedChunkTicking,
|
||||
"Enables regionized chunk ticking, similar to like Folia works.",
|
||||
"",
|
||||
"Read more info about this feature at https://bxteam.org/docs/divinemc/features/regionized-chunk-ticking");
|
||||
|
||||
regionizedChunkTickingExecutorThreadCount = getInt(ConfigCategory.ASYNC.key("regionized-chunk-ticking.executor-thread-count"), regionizedChunkTickingExecutorThreadCount,
|
||||
"The amount of threads to allocate to regionized chunk ticking.");
|
||||
regionizedChunkTickingExecutorThreadPriority = getInt(ConfigCategory.ASYNC.key("regionized-chunk-ticking.executor-thread-priority"), regionizedChunkTickingExecutorThreadPriority,
|
||||
"Configures the thread priority of the executor");
|
||||
|
||||
if (regionizedChunkTickingExecutorThreadCount < 1 || regionizedChunkTickingExecutorThreadCount > 10) {
|
||||
LOGGER.warn("Invalid regionized chunk ticking thread count: {}, resetting to default (5)", regionizedChunkTickingExecutorThreadCount);
|
||||
regionizedChunkTickingExecutorThreadCount = 5;
|
||||
}
|
||||
|
||||
LOGGER.warn("You have enabled Regionized Chunk Ticking. This feature is an experimental, and may not work as expected. Please report any issues you encounter to the BX Team Discord server");
|
||||
}
|
||||
|
||||
private static void asyncPathfinding() {
|
||||
asyncPathfinding = getBoolean(ConfigCategory.ASYNC.key("pathfinding.enable"), asyncPathfinding);
|
||||
asyncPathfindingMaxThreads = getInt(ConfigCategory.ASYNC.key("pathfinding.max-threads"), asyncPathfindingMaxThreads);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class DivineServerConfigProvider extends ServerConfigProvider {
|
||||
public JsonElement load(@NotNull String group, ExcludedConfigFilter filter) throws IOException {
|
||||
String prefix = group.replace("/", "");
|
||||
|
||||
Path configDir = Paths.get("config");
|
||||
Path configDir = Paths.get(getPath("paper-dir"));
|
||||
if (!Files.exists(configDir)) {
|
||||
return null;
|
||||
}
|
||||
@@ -99,16 +99,18 @@ public class DivineServerConfigProvider extends ServerConfigProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getPath(String optionsName) {
|
||||
return ((java.io.File) net.minecraft.server.MinecraftServer.getServer().options.valueOf(optionsName)).getPath();
|
||||
}
|
||||
|
||||
static {
|
||||
ImmutableMap.Builder<String, ConfigParser> files = ImmutableMap.<String, ConfigParser>builder()
|
||||
.put("server.properties", PropertiesConfigParser.INSTANCE)
|
||||
.put("bukkit.yml", YamlConfigParser.INSTANCE)
|
||||
.put("spigot.yml", YamlConfigParser.INSTANCE)
|
||||
.put("paper.yml", YamlConfigParser.INSTANCE)
|
||||
.put(getPath("config"), PropertiesConfigParser.INSTANCE)
|
||||
.put(getPath("bukkit-settings"), YamlConfigParser.INSTANCE)
|
||||
.put(getPath("spigot-settings"), YamlConfigParser.INSTANCE)
|
||||
.put("paper/", SplitYamlConfigParser.INSTANCE)
|
||||
.put("pufferfish.yml", YamlConfigParser.INSTANCE)
|
||||
.put("purpur.yml", YamlConfigParser.INSTANCE)
|
||||
.put("divinemc.yml", YamlConfigParser.INSTANCE);
|
||||
.put(getPath("purpur-settings"), YamlConfigParser.INSTANCE)
|
||||
.put(getPath("divinemc-settings"), YamlConfigParser.INSTANCE);
|
||||
|
||||
for (String config : getSystemPropertyList("spark.serverconfigs.extra")) {
|
||||
files.put(config, YamlConfigParser.INSTANCE);
|
||||
|
||||
Reference in New Issue
Block a user