From 25181bebe67810cf71a4b56c7506190ecb962ec7 Mon Sep 17 00:00:00 2001 From: Hannes Greule <SirYwell@users.noreply.github.com> Date: Sat, 16 Oct 2021 03:54:46 +0200 Subject: [PATCH] Unlimited chunk load rate (#6768) --- .../server/Add-tick-times-API-and-mspt-command.patch | 4 ++-- patches/server/Paper-config-files.patch | 4 ++-- .../server/Replace-player-chunk-loader-system.patch | 11 +++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/patches/server/Add-tick-times-API-and-mspt-command.patch b/patches/server/Add-tick-times-API-and-mspt-command.patch index b5fbe6c043..a3a70941ab 100644 --- a/patches/server/Add-tick-times-API-and-mspt-command.patch +++ b/patches/server/Add-tick-times-API-and-mspt-command.patch @@ -84,8 +84,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 commands.put("paper", new PaperCommand("paper")); + commands.put("mspt", new MSPTCommand("mspt")); - version = getInt("config-version", 22); - set("config-version", 22); + version = getInt("config-version", 23); + set("config-version", 23); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index f5cc5f115e..252723d1fa 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -364,8 +364,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + commands = new HashMap<String, Command>(); + commands.put("paper", new PaperCommand("paper")); + -+ version = getInt("config-version", 22); -+ set("config-version", 22); ++ version = getInt("config-version", 23); ++ set("config-version", 23); + readConfig(PaperConfig.class, null); + } + diff --git a/patches/server/Replace-player-chunk-loader-system.patch b/patches/server/Replace-player-chunk-loader-system.patch index 05bfeffcb5..a09df978ed 100644 --- a/patches/server/Replace-player-chunk-loader-system.patch +++ b/patches/server/Replace-player-chunk-loader-system.patch @@ -22,7 +22,7 @@ chunk-loading: target-player-chunk-send-rate: 100.0 global-max-chunk-send-rate: -1 enable-frustum-priority: false - global-max-chunk-load-rate: 300.0 + global-max-chunk-load-rate: -1.0 player-max-concurrent-loads: 4.0 global-max-concurrent-loads: 500.0 ``` @@ -58,7 +58,7 @@ because the client can bug out due to the out of order chunk sending. global-max-chunk-load-rate - The maximum chunk load rate -for the whole server. +for the whole server. -1 means no limit player-max-concurrent-loads and global-max-concurrent-loads The maximum number of concurrent loads for the server is @@ -105,7 +105,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + playerTargetChunkSendRate = getDouble("settings.chunk-loading.target-player-chunk-send-rate", 100.0); + globalMaxChunkSendRate = getDouble("settings.chunk-loading.global-max-chunk-send-rate", -1.0); + playerFrustumPrioritisation = getBoolean("settings.chunk-loading.enable-frustum-priority", false); -+ globalMaxChunkLoadRate = getDouble("settings.chunk-loading.global-max-chunk-load-rate", 300.0); ++ globalMaxChunkLoadRate = getDouble("settings.chunk-loading.global-max-chunk-load-rate", -1.0); ++ if (version < 23 && globalMaxChunkLoadRate == 300.0) { ++ set("settings.chunk-loading.global-max-chunk-load-rate", -1.0); ++ } + playerMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.player-max-concurrent-loads", 4.0); + globalMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.global-max-concurrent-loads", 500.0); + } @@ -701,7 +704,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // priority > 0.0 implies rate limited chunks + + final int currentChunkLoads = this.concurrentChunkLoads; -+ if (currentChunkLoads >= maxLoads || (TICKET_ADDITION_COUNTER_SHORT.getRate() >= PaperConfig.globalMaxChunkLoadRate || TICKET_ADDITION_COUNTER_LONG.getRate() >= PaperConfig.globalMaxChunkLoadRate)) { ++ if (currentChunkLoads >= maxLoads || (PaperConfig.globalMaxChunkLoadRate > 0 && (TICKET_ADDITION_COUNTER_SHORT.getRate() >= PaperConfig.globalMaxChunkLoadRate || TICKET_ADDITION_COUNTER_LONG.getRate() >= PaperConfig.globalMaxChunkLoadRate))) { + // don't poll, we didn't load it + this.chunkLoadQueue.add(data); + break;