diff --git a/leaf-archived-patches/work/server/0120-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch b/leaf-archived-patches/work/server/0120-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch deleted file mode 100644 index f2134f69..00000000 --- a/leaf-archived-patches/work/server/0120-Use-ensureCapacity-to-pre-populate-the-size-of-ticki.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Taiyou06 -Date: Sun, 16 Feb 2025 01:13:04 +0100 -Subject: [PATCH] Use ensureCapacity to pre-populate the size of ticking chunks - list output - - -diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 0fd51020ca9480be2855eb58a7d4d43511829512..b1400a1cc41717437ccb0f2b7854e54c5b985985 100644 ---- a/net/minecraft/server/level/ServerChunkCache.java -+++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -585,7 +585,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - final ServerChunkCache.ChunkAndHolder[] raw = tickingChunks.getRawDataUnchecked(); - final int size = tickingChunks.size(); - -- final ChunkMap chunkMap = this.chunkMap; -+ // Leaf start - Use ensureCapacity to pre-populate the size of ticking chunks list output -+ if (output instanceof ArrayList arrayList) { -+ arrayList.ensureCapacity(size); -+ } -+ // Leaf end - Use ensureCapacity to pre-populate the size of ticking chunks list output - - for (int i = 0; i < size; ++i) { - final ServerChunkCache.ChunkAndHolder chunkAndHolder = raw[i]; diff --git a/leaf-archived-patches/work/server/0121-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch b/leaf-archived-patches/work/server/0121-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch deleted file mode 100644 index 0e88f4e9..00000000 --- a/leaf-archived-patches/work/server/0121-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Taiyou06 -Date: Sun, 16 Feb 2025 01:13:04 +0100 -Subject: [PATCH] Directly use the pre-filtered ticking chunks list as the - output - -This patch uses already pre filtered chunks, which completely skips the isChunkNearPlayer check - -diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index b1400a1cc41717437ccb0f2b7854e54c5b985985..f57f8e610dac80b8095bfc0c7e4b22ff5ad6b13c 100644 ---- a/net/minecraft/server/level/ServerChunkCache.java -+++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -592,14 +592,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - // Leaf end - Use ensureCapacity to pre-populate the size of ticking chunks list output - - for (int i = 0; i < size; ++i) { -- final ServerChunkCache.ChunkAndHolder chunkAndHolder = raw[i]; -- final LevelChunk levelChunk = chunkAndHolder.chunk(); -- -- if (!this.isChunkNearPlayer(chunkMap, levelChunk.getPos(), levelChunk)) { -- continue; -- } -- -- output.add(levelChunk); -+ output.add(raw[i].chunk()); // Leaf - Directly use the pre-filtered ticking chunks list as the output - } - // Paper end - chunk tick iteration optimisation - } diff --git a/leaf-server/minecraft-patches/features/0191-count-all-chunks-for-ticking.patch b/leaf-server/minecraft-patches/features/0191-count-all-chunks-for-ticking.patch new file mode 100644 index 00000000..6db466a9 --- /dev/null +++ b/leaf-server/minecraft-patches/features/0191-count-all-chunks-for-ticking.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Taiyou06 +Date: Sun, 16 Feb 2025 01:13:04 +0100 +Subject: [PATCH] count all chunks for ticking + +diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java +index e07fdd22e08cb4e30cf606c055e85b5946e8c046..432c98b582ab40f893835a7a24ef9bbdacc49bd7 100644 +--- a/net/minecraft/server/level/ServerChunkCache.java ++++ b/net/minecraft/server/level/ServerChunkCache.java +@@ -589,6 +589,14 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + final int size = tickingChunks.size(); + + final ChunkMap chunkMap = this.chunkMap; ++ // Leaf start - count all chunks for ticking ++ if (org.dreeam.leaf.config.modules.opt.CountAllChunksForTicking.enabled) { ++ for (int i = 0; i < size; ++i) { ++ output.add(raw[i].chunk()); ++ } ++ return; ++ } ++ // Leaf end - count all chunks for ticking + + for (int i = 0; i < size; ++i) { + final ServerChunkCache.ChunkAndHolder chunkAndHolder = raw[i]; diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/CountAllChunksForTicking.java b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/CountAllChunksForTicking.java new file mode 100644 index 00000000..89132b5c --- /dev/null +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/CountAllChunksForTicking.java @@ -0,0 +1,18 @@ +package org.dreeam.leaf.config.modules.opt; + +import org.dreeam.leaf.config.ConfigModules; +import org.dreeam.leaf.config.EnumConfigCategory; + +public class CountAllChunksForTicking extends ConfigModules { + + public String getBasePath() { + return EnumConfigCategory.PERF.getBaseKeyName() + ".count-all-chunks-for-ticking"; + } + + public static boolean enabled = false; + + @Override + public void onLoaded() { + enabled = config.getBoolean(getBasePath(), enabled); + } +}