diff --git a/leaf-api/paper-patches/features/0020-Fish-Parallel-World-Ticking-API.patch b/leaf-api/paper-patches/features/0020-Fish-Parallel-World-Ticking-API.patch new file mode 100644 index 00000000..a7d5a043 --- /dev/null +++ b/leaf-api/paper-patches/features/0020-Fish-Parallel-World-Ticking-API.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Biquaternions +Date: Tue, 2 Sep 2025 13:54:37 -0500 +Subject: [PATCH] Fish: Parallel World Ticking API + +Original license: MIT +Original project: https://github.com/Biquaternions/Fish + +This patch provides an API for performance monitoring plugins like PurpurBars. +A better approach would be to include an event when the world is done ticking, + which will allow to re-use the RollingAverage logic from Spark and Minecraft internals. +However, since every fork developer will want to have said event into their own namespace, + it will be virtually impossible to provide a universal API. +With this approach only new methods are added into already existing Bukkit API, and the same + naming conventions as Bukkit were used, which means there's a bigger chance of this API to + get standarized. + +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 82e56218b5c854a16851b75e3145e301d5fedab0..e12d161ac49f4725faf3ad2d13972524f625b862 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -2929,4 +2929,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + // Leaves start - Photographer API + @NotNull org.leavesmc.leaves.entity.photographer.PhotographerManager getPhotographerManager(); + // Leaves end - Photographer API ++ ++ // Fish start - Parallel World Ticking API ++ /** ++ * Returns whether the software has the Parallel World Ticking feature enabled ++ * ++ * @return If the Parallel World Ticking feature is enabled ++ */ ++ public default boolean isParallelWorldTickingEnabled() { ++ return false; ++ } ++ // Fish end - Parallel World Ticking API + } +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index bb9fe9a6c3116e83d2ebd98f81298454f6677ccc..5b02d1938ddaf02c7f227271c0dc27702a41fc83 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -4494,6 +4494,25 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @NotNull + public Collection getStructures(int x, int z, @NotNull Structure structure); + ++ // Fish start - Parallel World Ticking API ++ /** ++ * Get a sample of the world last tick times (in nanos) ++ * ++ * @return A sample of the world last tick times (in nanos) ++ */ ++ public default long @NotNull [] getTickTimes() { ++ return new long[0]; ++ } ++ /** ++ * Get the world's average tick time (in millis) ++ * ++ * @return World's local average tick time (in millis) ++ */ ++ public default double getAverageTickTime () { ++ return 0.0; ++ } ++ // Fish end - Parallel World Ticking API ++ + /** + * Represents various map environment types that a world may be + */ diff --git a/leaf-server/paper-patches/features/0048-Fish-Parallel-World-Ticking-API.patch b/leaf-server/paper-patches/features/0048-Fish-Parallel-World-Ticking-API.patch new file mode 100644 index 00000000..5073aa6d --- /dev/null +++ b/leaf-server/paper-patches/features/0048-Fish-Parallel-World-Ticking-API.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Biquaternions +Date: Tue, 2 Sep 2025 13:54:37 -0500 +Subject: [PATCH] Fish: Parallel World Ticking API + +Original license: MIT +Original project: https://github.com/Biquaternions/Fish + +This patch provides an API for performance monitoring plugins like PurpurBars. +A better approach would be to include an event when the world is done ticking, + which will allow to re-use the RollingAverage logic from Spark and Minecraft internals. +However, since every fork developer will want to have said event into their own namespace, + it will be virtually impossible to provide a universal API. +With this approach only new methods are added into already existing Bukkit API, and the same + naming conventions as Bukkit were used, which means there's a bigger chance of this API to + get standarized. + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index dfafd3125438b6a74f15a749599acfd00918c50a..bcda5dd6fe3741518fea263b4790ea33bb9729cb 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -3366,4 +3366,11 @@ public final class CraftServer implements Server { + return photographerManager; + } + // Leaves end - replay mod api ++ ++ // Fish start - Parallel World Ticking API ++ @Override ++ public boolean isParallelWorldTickingEnabled() { ++ return org.dreeam.leaf.config.modules.async.SparklyPaperParallelWorldTicking.enabled; ++ } ++ // Fish end - Parallel World Ticking API + } +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index ee5f342995a335593932a497c2bafd36d34cecb2..a16390fc13e1baf3cffbcfec5cc410a72ed47367 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -2556,4 +2556,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { + return POINTERS_SUPPLIER.view(this); + } + // Paper end ++ ++ // Fish start - Parallel World Ticking API ++ @Override ++ public long @NotNull [] getTickTimes() { ++ return this.world.tickTimes5s.getTimes(); ++ } ++ @Override ++ public double getAverageTickTime() { ++ return this.world.tickTimes5s.getAverage(); ++ } ++ // Fish end - Parallel World Ticking API + } diff --git a/leaf-server/paper-patches/features/0048-Paper-PR-Throttle-failed-spawn-attempts.patch b/leaf-server/paper-patches/features/0049-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 100% rename from leaf-server/paper-patches/features/0048-Paper-PR-Throttle-failed-spawn-attempts.patch rename to leaf-server/paper-patches/features/0049-Paper-PR-Throttle-failed-spawn-attempts.patch diff --git a/leaf-server/paper-patches/features/0049-Async-playerdata-saving.patch b/leaf-server/paper-patches/features/0050-Async-playerdata-saving.patch similarity index 100% rename from leaf-server/paper-patches/features/0049-Async-playerdata-saving.patch rename to leaf-server/paper-patches/features/0050-Async-playerdata-saving.patch diff --git a/leaf-server/paper-patches/features/0050-Async-chunk-sending.patch b/leaf-server/paper-patches/features/0051-Async-chunk-sending.patch similarity index 100% rename from leaf-server/paper-patches/features/0050-Async-chunk-sending.patch rename to leaf-server/paper-patches/features/0051-Async-chunk-sending.patch diff --git a/leaf-server/paper-patches/features/0051-Optimise-player-movement-checks.patch b/leaf-server/paper-patches/features/0052-Optimise-player-movement-checks.patch similarity index 100% rename from leaf-server/paper-patches/features/0051-Optimise-player-movement-checks.patch rename to leaf-server/paper-patches/features/0052-Optimise-player-movement-checks.patch diff --git a/leaf-server/paper-patches/features/0052-optimise-ReferenceList.patch b/leaf-server/paper-patches/features/0053-optimise-ReferenceList.patch similarity index 100% rename from leaf-server/paper-patches/features/0052-optimise-ReferenceList.patch rename to leaf-server/paper-patches/features/0053-optimise-ReferenceList.patch diff --git a/leaf-server/paper-patches/features/0053-cache-getBiome.patch b/leaf-server/paper-patches/features/0054-cache-getBiome.patch similarity index 100% rename from leaf-server/paper-patches/features/0053-cache-getBiome.patch rename to leaf-server/paper-patches/features/0054-cache-getBiome.patch diff --git a/leaf-server/paper-patches/features/0054-dump-pwt-thread.patch b/leaf-server/paper-patches/features/0055-dump-pwt-thread.patch similarity index 100% rename from leaf-server/paper-patches/features/0054-dump-pwt-thread.patch rename to leaf-server/paper-patches/features/0055-dump-pwt-thread.patch diff --git a/leaf-server/paper-patches/features/0055-Paw-optimization.patch b/leaf-server/paper-patches/features/0056-Paw-optimization.patch similarity index 100% rename from leaf-server/paper-patches/features/0055-Paw-optimization.patch rename to leaf-server/paper-patches/features/0056-Paw-optimization.patch diff --git a/leaf-server/paper-patches/features/0056-optimize-despawn.patch b/leaf-server/paper-patches/features/0057-optimize-despawn.patch similarity index 100% rename from leaf-server/paper-patches/features/0056-optimize-despawn.patch rename to leaf-server/paper-patches/features/0057-optimize-despawn.patch diff --git a/leaf-server/paper-patches/features/0057-optimize-mob-spawning.patch b/leaf-server/paper-patches/features/0058-optimize-mob-spawning.patch similarity index 100% rename from leaf-server/paper-patches/features/0057-optimize-mob-spawning.patch rename to leaf-server/paper-patches/features/0058-optimize-mob-spawning.patch diff --git a/leaf-server/paper-patches/features/0058-Toggleable-async-catcher.patch b/leaf-server/paper-patches/features/0059-Toggleable-async-catcher.patch similarity index 100% rename from leaf-server/paper-patches/features/0058-Toggleable-async-catcher.patch rename to leaf-server/paper-patches/features/0059-Toggleable-async-catcher.patch diff --git a/leaf-server/paper-patches/features/0059-cache-profile-data.patch b/leaf-server/paper-patches/features/0060-cache-profile-data.patch similarity index 100% rename from leaf-server/paper-patches/features/0059-cache-profile-data.patch rename to leaf-server/paper-patches/features/0060-cache-profile-data.patch diff --git a/leaf-server/paper-patches/features/0060-Bump-netty-to-4.2.x.patch b/leaf-server/paper-patches/features/0061-Bump-netty-to-4.2.x.patch similarity index 100% rename from leaf-server/paper-patches/features/0060-Bump-netty-to-4.2.x.patch rename to leaf-server/paper-patches/features/0061-Bump-netty-to-4.2.x.patch