diff --git a/divinemc-server/minecraft-patches/features/0012-Chunk-System-optimization.patch b/divinemc-server/minecraft-patches/features/0012-Chunk-System-optimization.patch index 4edb091..4d5643d 100644 --- a/divinemc-server/minecraft-patches/features/0012-Chunk-System-optimization.patch +++ b/divinemc-server/minecraft-patches/features/0012-Chunk-System-optimization.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Chunk System optimization diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index f81cc357618c70f2fcf0bc24b0b25be566ffffcc..8fa7b73b02434487fef495b92a33d24dcfa24c0b 100644 +index f81cc357618c70f2fcf0bc24b0b25be566ffffcc..a2062d976ca45b1360476051f23ff126ff812d4e 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java @@ -301,7 +301,7 @@ public final class RegionizedPlayerChunkLoader { @@ -95,8 +95,13 @@ index f81cc357618c70f2fcf0bc24b0b25be566ffffcc..8fa7b73b02434487fef495b92a33d24d // try to pull ticking chunks while (!this.tickingQueue.isEmpty()) { -@@ -827,6 +814,7 @@ public final class RegionizedPlayerChunkLoader { - final int maxSendsThisTick = Math.min((int)this.chunkSendLimiter.takeAllocation(time, sendRate, maxSends), this.sendQueue.size()); +@@ -823,10 +810,10 @@ public final class RegionizedPlayerChunkLoader { + } + + // try to pull sending chunks +- final long maxSends = Math.max(0L, Math.min(MAX_RATE, Integer.MAX_VALUE)); // note: no logic to track concurrent sends +- final int maxSendsThisTick = Math.min((int)this.chunkSendLimiter.takeAllocation(time, sendRate, maxSends), this.sendQueue.size()); ++ final int maxSendsThisTick = this.sendQueue.size(); // DivineMC - Chunk System optimization // we do not return sends that we took from the allocation back because we want to limit the max send rate, not target it for (int i = 0; i < maxSendsThisTick; ++i) { + if (this.sendQueue.isEmpty()) break; // DivineMC - Chunk System optimization diff --git a/divinemc-server/minecraft-patches/features/0038-Async-Chunk-Sending.patch b/divinemc-server/minecraft-patches/features/0038-Async-Chunk-Sending.patch index fcf20fa..e6fe382 100644 --- a/divinemc-server/minecraft-patches/features/0038-Async-Chunk-Sending.patch +++ b/divinemc-server/minecraft-patches/features/0038-Async-Chunk-Sending.patch @@ -4,24 +4,6 @@ Date: Mon, 3 Mar 2025 19:29:13 +0300 Subject: [PATCH] Async Chunk Sending -diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index 8fa7b73b02434487fef495b92a33d24dcfa24c0b..d11cd068a87eb263af9a5def8ea322374cc234dc 100644 ---- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -+++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -@@ -810,8 +810,11 @@ public final class RegionizedPlayerChunkLoader { - } - - // try to pull sending chunks -- final long maxSends = Math.max(0L, Math.min(MAX_RATE, Integer.MAX_VALUE)); // note: no logic to track concurrent sends -- final int maxSendsThisTick = Math.min((int)this.chunkSendLimiter.takeAllocation(time, sendRate, maxSends), this.sendQueue.size()); -+ // DivineMC start - Async Chunk Sending -+ final int maxSendsThisTick = org.bxteam.divinemc.DivineConfig.asyncChunkSendingRateLimitChunkSends == -1 -+ ? this.sendQueue.size() -+ : org.bxteam.divinemc.DivineConfig.asyncChunkSendingRateLimitChunkSends; -+ // DivineMC end - Async Chunk Sending - // we do not return sends that we took from the allocation back because we want to limit the max send rate, not target it - for (int i = 0; i < maxSendsThisTick; ++i) { - if (this.sendQueue.isEmpty()) break; // DivineMC - Chunk System optimization diff --git a/net/minecraft/server/network/PlayerChunkSender.java b/net/minecraft/server/network/PlayerChunkSender.java index 14878690a88fd4de3e2c127086607e6c819c636c..4723ce85ebcd3740245607348a525f292ac1e2f3 100644 --- a/net/minecraft/server/network/PlayerChunkSender.java diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java index 2c914d2..8075ae0 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java @@ -248,7 +248,6 @@ public class DivineConfig { public static boolean asyncChunkSendingEnabled = true; public static int asyncChunkSendingThreadCount = 1; public static boolean asyncChunkSendingUseVirtualThreads = false; - public static int asyncChunkSendingRateLimitChunkSends = 50; private static void asyncChunkSending() { asyncChunkSendingEnabled = getBoolean("settings.async-chunk-sending.enable", asyncChunkSendingEnabled, "Enables chunk sending runs off-main thread."); @@ -258,13 +257,6 @@ public class DivineConfig { asyncChunkSendingUseVirtualThreads = getBoolean("settings.async-chunk-sending.use-virtual-threads", asyncChunkSendingUseVirtualThreads, "Similar to the 'virtual-thread' options. This will use the virtual thread executor for chunk sending."); - - asyncChunkSendingRateLimitChunkSends = getInt("settings.async-chunk-sending.rate-limit-chunk-sends", asyncChunkSendingRateLimitChunkSends, - "DivineMC have optimization patches that speed ups world generation,", - "so chunk loading/generating may be faster and with this, server can spam a ton of chunk packets to the client on server join.", - "This setting will limit the amount of chunk packets sent to the client per tick, allowing a smoother ping when sending chunks on join", - "", - "Set to -1 to disable rate limiting (not recommended)"); } public static boolean enableRegionizedChunkTicking = false;