diff --git a/leaf-server/minecraft-patches/features/0025-Variable-entity-wake-up-duration.patch b/leaf-server/minecraft-patches/features/0025-Variable-entity-wake-up-duration.patch index ed3964094..6232da772 100644 --- a/leaf-server/minecraft-patches/features/0025-Variable-entity-wake-up-duration.patch +++ b/leaf-server/minecraft-patches/features/0025-Variable-entity-wake-up-duration.patch @@ -6,11 +6,13 @@ Subject: [PATCH] Variable entity wake-up duration License: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html) Gale - https://galemc.org +Co-authored-by: MrlingXD <90316914+wling-art@users.noreply.github.com> + diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index d9e275305968a89f814536ff42c9d3821949736f..11f344eb2ab9943b17e05203c431923c716710ca 100644 +index db127a30400045d3fe5672464f2ff706efa49031..987bbafa8033f0b7bd80856d9187d1ea8a0d3103 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java -@@ -60,27 +60,40 @@ public final class ActivationRange { +@@ -60,27 +60,39 @@ public final class ActivationRange { if (entity.activationType == ActivationType.VILLAGER) { if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) { world.wakeupInactiveRemainingVillagers--; @@ -42,13 +44,12 @@ index d9e275305968a89f814536ff42c9d3821949736f..11f344eb2ab9943b17e05203c431923c + // Gale start - variable entity wake-up duration + private static int getWakeUpDurationWithVariance(Entity entity, int wakeUpDuration) { + final double deviation = entity.level().galeConfig().gameplayMechanics.entityWakeUpDurationRatioStandardDeviation; -+ final org.dreeam.leaf.util.math.random.FasterRandomSource wakeUpDurationRandom = org.dreeam.leaf.util.math.random.FasterRandomSource.SHARED_INSTANCE; + + if (deviation <= 0) { + return wakeUpDuration; + } + -+ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(wakeUpDuration * wakeUpDurationRandom.nextGaussian(1, deviation)))); ++ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(wakeUpDuration * java.util.concurrent.ThreadLocalRandom.current().nextGaussian(1, deviation)))); + } + // Gale end - variable entity wake-up duration + diff --git a/leaf-server/minecraft-patches/features/0082-Pufferfish-Dynamic-Activation-of-Brain.patch b/leaf-server/minecraft-patches/features/0082-Pufferfish-Dynamic-Activation-of-Brain.patch index cd52df069..25b4ff8bb 100644 --- a/leaf-server/minecraft-patches/features/0082-Pufferfish-Dynamic-Activation-of-Brain.patch +++ b/leaf-server/minecraft-patches/features/0082-Pufferfish-Dynamic-Activation-of-Brain.patch @@ -30,10 +30,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index 914762bbc1b538d9eaaa86f6975cb088a791b286..12aa35a4a07ec328cf6702e01a8e2f7b8273a902 100644 +index 987bbafa8033f0b7bd80856d9187d1ea8a0d3103..922c95a3bbdc27ff86ce74ecedb0bc63d4018f93 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java -@@ -181,6 +181,22 @@ public final class ActivationRange { +@@ -180,6 +180,22 @@ public final class ActivationRange { } ActivationRange.activateEntity(entity); @@ -56,7 +56,7 @@ index 914762bbc1b538d9eaaa86f6975cb088a791b286..12aa35a4a07ec328cf6702e01a8e2f7b } } } -@@ -192,11 +208,11 @@ public final class ActivationRange { +@@ -191,11 +207,11 @@ public final class ActivationRange { */ private static void activateEntity(final Entity entity) { if (MinecraftServer.currentTick > entity.activatedTick) { @@ -83,7 +83,7 @@ index 64569f68e363535ab751dee2b6bc8d72c28b31b9..00fbf02191936eed8ba55a8b4f50343a if (!tickRateManager.isEntityFrozen(entity)) { profiler.push("checkDespawn"); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 24d98de4e0f65d5b42d9452c7789daf6563d20da..c2b845232253f3930ef90e8970b745c3dfea9bbf 100644 +index 18f332ba6380643362650cdb9327130a813cb3f6..c371c7cfb1125721d5c1302b12b2f91f789b2ceb 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -385,6 +385,8 @@ public abstract class Entity diff --git a/leaf-server/minecraft-patches/features/0189-SparklyPaper-Parallel-world-ticking.patch b/leaf-server/minecraft-patches/features/0189-SparklyPaper-Parallel-world-ticking.patch index 302870454..bd5dc1b79 100644 --- a/leaf-server/minecraft-patches/features/0189-SparklyPaper-Parallel-world-ticking.patch +++ b/leaf-server/minecraft-patches/features/0189-SparklyPaper-Parallel-world-ticking.patch @@ -58,10 +58,10 @@ index 211a0fe1debb6de37acbb7c97d89779787ea6450..a4dcd20aa70639c1291f1a01c702008a if (!PlatformHooks.get().allowAsyncTicketUpdates() && isTickThread) { TickThread.ensureTickThread("Cannot asynchronously process ticket updates"); diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index 12aa35a4a07ec328cf6702e01a8e2f7b8273a902..c4194b1921f4741b5452259c0ab87fd94977c7f3 100644 +index 922c95a3bbdc27ff86ce74ecedb0bc63d4018f93..8103de4d0fd4372652153c3e2dbeee667cbc6287 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java -@@ -134,7 +134,7 @@ public final class ActivationRange { +@@ -133,7 +133,7 @@ public final class ActivationRange { * * @param world */ diff --git a/leaf-server/minecraft-patches/features/0317-optimize-entity-activation.patch b/leaf-server/minecraft-patches/features/0317-optimize-entity-activation.patch index 623de444f..32d01f7bd 100644 --- a/leaf-server/minecraft-patches/features/0317-optimize-entity-activation.patch +++ b/leaf-server/minecraft-patches/features/0317-optimize-entity-activation.patch @@ -79,10 +79,10 @@ index 53d85b59964fad1ebbd32e939909bb408d969705..775bea1ff010d3bdd6ea20ad47d9b8c4 final int minChunkX = (Mth.floor(box.minX) - 2) >> 4; final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4; diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index c4194b1921f4741b5452259c0ab87fd94977c7f3..4d5c38c0fb6d18026f84be5eccf87d78608decaa 100644 +index 8103de4d0fd4372652153c3e2dbeee667cbc6287..51259bdac24822e56755647f83c1c00112a3a8ab 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java -@@ -94,6 +94,7 @@ public final class ActivationRange { +@@ -93,6 +93,7 @@ public final class ActivationRange { } // Gale end - variable entity wake-up duration @@ -90,7 +90,7 @@ index c4194b1921f4741b5452259c0ab87fd94977c7f3..4d5c38c0fb6d18026f84be5eccf87d78 static AABB maxBB = new AABB(0, 0, 0, 0, 0, 0); /** -@@ -155,13 +156,25 @@ public final class ActivationRange { +@@ -154,13 +155,25 @@ public final class ActivationRange { maxRange = Math.max(maxRange, villagerActivationRange); maxRange = Math.min((world.spigotConfig.simulationDistance << 4) - 8, maxRange); @@ -119,7 +119,7 @@ index c4194b1921f4741b5452259c0ab87fd94977c7f3..4d5c38c0fb6d18026f84be5eccf87d78 final int worldHeight = world.getHeight(); ActivationRange.maxBB = player.getBoundingBox().inflate(maxRange, worldHeight, maxRange); -@@ -174,7 +187,7 @@ public final class ActivationRange { +@@ -173,7 +186,7 @@ public final class ActivationRange { ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate(villagerActivationRange, worldHeight, villagerActivationRange); final List entities = world.getEntities((Entity) null, ActivationRange.maxBB, e -> true); @@ -128,7 +128,7 @@ index c4194b1921f4741b5452259c0ab87fd94977c7f3..4d5c38c0fb6d18026f84be5eccf87d78 for (final Entity entity : entities) { if (!tickMarkers && entity instanceof Marker) { continue; -@@ -182,21 +195,24 @@ public final class ActivationRange { +@@ -181,21 +194,24 @@ public final class ActivationRange { ActivationRange.activateEntity(entity); @@ -192,7 +192,7 @@ index a321ae5ea06439b9c1a0627afd0f34e1e1e00fcd..11cb0f12ba1ef598e6ab075fec340cd4 final net.minecraft.world.level.levelgen.BitRandomSource simpleRandom = this.simpleRandom; // Paper - optimise random ticking // Leaf - Faster random generator - upcasting ChunkPos chunkPos = chunk.getPos(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 7e8ffc1b0a65cf2adad426d64fcb5c3d7d608ccc..0ac10f8283ebf0f897a9df1c6ec0e4bd7a2f732b 100644 +index ed4e7217c4079880eb078ba2cb89ffaffad2a814..596dec179edd5067b316cb38aa5fe913309eb0bf 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -387,7 +387,7 @@ public abstract class Entity