diff --git a/patches/server/0019-Add-experimental-config-for-folia-scheduled-issue-fi.patch b/patches/server/0019-Add-experimental-config-for-folia-scheduled-issue-fi.patch new file mode 100644 index 0000000..64f4687 --- /dev/null +++ b/patches/server/0019-Add-experimental-config-for-folia-scheduled-issue-fi.patch @@ -0,0 +1,142 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrHua269 +Date: Wed, 18 Sep 2024 23:10:47 +0800 +Subject: [PATCH] Add experimental config for folia scheduled issue fixing + + +diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionizedTaskQueue.java b/src/main/java/io/papermc/paper/threadedregions/RegionizedTaskQueue.java +index a1e1782d87403ca8934d37361be7ba66ddba133f..ae5e7d119a63b0877f54517a3624ae7a1c9e007c 100644 +--- a/src/main/java/io/papermc/paper/threadedregions/RegionizedTaskQueue.java ++++ b/src/main/java/io/papermc/paper/threadedregions/RegionizedTaskQueue.java +@@ -48,8 +48,27 @@ public final class RegionizedTaskQueue { + + public PrioritisedExecutor.PrioritisedTask queueChunkTask(final ServerLevel world, final int chunkX, final int chunkZ, + final Runnable run, final PrioritisedExecutor.Priority priority) { +- final PrioritisedExecutor.PrioritisedTask ret = this.createChunkTask(world, chunkX, chunkZ, run, priority); +- ret.queue(); ++ final PrioritisedExecutor.PrioritisedTask ret = new PrioritisedQueue.ChunkBasedPriorityTask(world.taskQueueRegionData, chunkX, chunkZ, true, run, priority, me.earthme.luminol.config.modules.experiment.FoliaTaskQueueFixConfig.enabled); // Luminol ++ // Luminol start ++ if (!me.earthme.luminol.config.modules.experiment.FoliaTaskQueueFixConfig.enabled){ ++ ret.queue(); ++ return ret; ++ } ++ ++ for (;;) { ++ boolean result; ++ ++ try { ++ result = ret.queue(); ++ }catch (me.earthme.luminol.utils.TaskCancelledException ignored) { ++ result = true; ++ } ++ ++ if (result) { ++ break; ++ } ++ } ++ // Luminol end + return ret; + } + +@@ -60,8 +79,27 @@ public final class RegionizedTaskQueue { + + public PrioritisedExecutor.PrioritisedTask queueTickTaskQueue(final ServerLevel world, final int chunkX, final int chunkZ, + final Runnable run, final PrioritisedExecutor.Priority priority) { +- final PrioritisedExecutor.PrioritisedTask ret = this.createTickTaskQueue(world, chunkX, chunkZ, run, priority); +- ret.queue(); ++ final PrioritisedExecutor.PrioritisedTask ret = new PrioritisedQueue.ChunkBasedPriorityTask(world.taskQueueRegionData, chunkX, chunkZ, false, run, priority, me.earthme.luminol.config.modules.experiment.FoliaTaskQueueFixConfig.enabled); // Luminol ++ // Luminol start ++ if (!me.earthme.luminol.config.modules.experiment.FoliaTaskQueueFixConfig.enabled){ ++ ret.queue(); ++ return ret; ++ } ++ ++ for (;;) { ++ boolean result; ++ ++ try { ++ result = ret.queue(); ++ }catch (me.earthme.luminol.utils.TaskCancelledException ignored) { ++ result = true; ++ } ++ ++ if (result) { ++ break; ++ } ++ } ++ // Luminol end + return ret; + } + +@@ -449,6 +487,13 @@ public final class RegionizedTaskQueue { + private Runnable run; + private volatile PrioritisedExecutor.Priority priority; + private static final VarHandle PRIORITY_HANDLE = ConcurrentUtil.getVarHandle(ChunkBasedPriorityTask.class, "priority", PrioritisedExecutor.Priority.class); ++ private boolean softThrowWhenCancelled = false; // Luminol ++ ++ ChunkBasedPriorityTask(final WorldRegionTaskData world, final int chunkX, final int chunkZ, final boolean isChunkTask, ++ final Runnable run, final PrioritisedExecutor.Priority priority, boolean sft) { // Luminol ++ this(world, chunkX, chunkZ, isChunkTask, run, priority); ++ this.softThrowWhenCancelled = sft; ++ } + + ChunkBasedPriorityTask(final WorldRegionTaskData world, final int chunkX, final int chunkZ, final boolean isChunkTask, + final Runnable run, final PrioritisedExecutor.Priority priority) { +@@ -574,6 +619,11 @@ public final class RegionizedTaskQueue { + // the task never could be polled from the queue, so we return false + // don't decrement reference count, as we were certainly cancelled by another thread, which + // will decrement the reference count ++ // Luminol start ++ if (this.softThrowWhenCancelled) { ++ throw new me.earthme.luminol.utils.TaskCancelledException(); ++ } ++ // Luminol end + return false; + } + +@@ -584,6 +634,9 @@ public final class RegionizedTaskQueue { + // we were cancelled + // don't decrement reference count, as we were certainly cancelled by another thread, which + // will decrement the reference count ++ if (this.softThrowWhenCancelled) { ++ throw new me.earthme.luminol.utils.TaskCancelledException(); ++ } + return false; + } + +diff --git a/src/main/java/me/earthme/luminol/config/modules/experiment/FoliaTaskQueueFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/experiment/FoliaTaskQueueFixConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..47e0339ecb0d96010c41e739c66f3d024aad95eb +--- /dev/null ++++ b/src/main/java/me/earthme/luminol/config/modules/experiment/FoliaTaskQueueFixConfig.java +@@ -0,0 +1,20 @@ ++package me.earthme.luminol.config.modules.experiment; ++ ++import me.earthme.luminol.config.ConfigInfo; ++import me.earthme.luminol.config.EnumConfigCategory; ++import me.earthme.luminol.config.IConfigModule; ++ ++public class FoliaTaskQueueFixConfig implements IConfigModule { ++ @ConfigInfo(baseName = "enabled") ++ public static boolean enabled = false; ++ ++ @Override ++ public EnumConfigCategory getCategory() { ++ return EnumConfigCategory.EXPERIMENT; ++ } ++ ++ @Override ++ public String getBaseName() { ++ return "queue_until_task_queued"; ++ } ++} +diff --git a/src/main/java/me/earthme/luminol/utils/TaskCancelledException.java b/src/main/java/me/earthme/luminol/utils/TaskCancelledException.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c7b55489f4d3a57320b0963e45cd1c87e6c0ec88 +--- /dev/null ++++ b/src/main/java/me/earthme/luminol/utils/TaskCancelledException.java +@@ -0,0 +1,4 @@ ++package me.earthme.luminol.utils; ++ ++public class TaskCancelledException extends RuntimeException{ ++} diff --git a/patches/server/0019-Try-fixing-folia-spector-teleportation.patch b/patches/server/0020-Try-fixing-folia-spector-teleportation.patch similarity index 100% rename from patches/server/0019-Try-fixing-folia-spector-teleportation.patch rename to patches/server/0020-Try-fixing-folia-spector-teleportation.patch diff --git a/patches/server/0020-Teleport-async-if-entity-was-moving-to-another-regio.patch b/patches/server/0021-Teleport-async-if-entity-was-moving-to-another-regio.patch similarity index 100% rename from patches/server/0020-Teleport-async-if-entity-was-moving-to-another-regio.patch rename to patches/server/0021-Teleport-async-if-entity-was-moving-to-another-regio.patch diff --git a/patches/server/0021-Try-fixing-folia-off-region-POI-accessing-issue.patch b/patches/server/0022-Try-fixing-folia-off-region-POI-accessing-issue.patch similarity index 100% rename from patches/server/0021-Try-fixing-folia-off-region-POI-accessing-issue.patch rename to patches/server/0022-Try-fixing-folia-off-region-POI-accessing-issue.patch diff --git a/patches/server/0022-Prevent-teleportAsync-calling-during-moving-event-be.patch b/patches/server/0023-Prevent-teleportAsync-calling-during-moving-event-be.patch similarity index 100% rename from patches/server/0022-Prevent-teleportAsync-calling-during-moving-event-be.patch rename to patches/server/0023-Prevent-teleportAsync-calling-during-moving-event-be.patch diff --git a/patches/server/0023-Try-optimizing-the-task-dispatching.patch b/patches/server/0024-Try-optimizing-the-task-dispatching.patch similarity index 100% rename from patches/server/0023-Try-optimizing-the-task-dispatching.patch rename to patches/server/0024-Try-optimizing-the-task-dispatching.patch diff --git a/patches/server/0024-Force-disable-builtin-spark-plugin.patch b/patches/server/0025-Force-disable-builtin-spark-plugin.patch similarity index 100% rename from patches/server/0024-Force-disable-builtin-spark-plugin.patch rename to patches/server/0025-Force-disable-builtin-spark-plugin.patch diff --git a/patches/server/0025-Check-allow-before-getting-block-state-while-tripwir.patch b/patches/server/0026-Check-allow-before-getting-block-state-while-tripwir.patch similarity index 100% rename from patches/server/0025-Check-allow-before-getting-block-state-while-tripwir.patch rename to patches/server/0026-Check-allow-before-getting-block-state-while-tripwir.patch diff --git a/patches/server/0026-Kaiiju-Don-t-pathfind-outside-region.patch b/patches/server/0027-Kaiiju-Don-t-pathfind-outside-region.patch similarity index 100% rename from patches/server/0026-Kaiiju-Don-t-pathfind-outside-region.patch rename to patches/server/0027-Kaiiju-Don-t-pathfind-outside-region.patch diff --git a/patches/server/0027-Kaiiju-Vanilla-end-portal-teleportation.patch b/patches/server/0028-Kaiiju-Vanilla-end-portal-teleportation.patch similarity index 100% rename from patches/server/0027-Kaiiju-Vanilla-end-portal-teleportation.patch rename to patches/server/0028-Kaiiju-Vanilla-end-portal-teleportation.patch diff --git a/patches/server/0028-Petal-Reduce-sensor-work.patch b/patches/server/0029-Petal-Reduce-sensor-work.patch similarity index 100% rename from patches/server/0028-Petal-Reduce-sensor-work.patch rename to patches/server/0029-Petal-Reduce-sensor-work.patch diff --git a/patches/server/0029-Pufferfish-Improve-fluid-direction-caching.patch b/patches/server/0030-Pufferfish-Improve-fluid-direction-caching.patch similarity index 100% rename from patches/server/0029-Pufferfish-Improve-fluid-direction-caching.patch rename to patches/server/0030-Pufferfish-Improve-fluid-direction-caching.patch diff --git a/patches/server/0030-Pufferfish-Cache-climbing-check-for-activation.patch b/patches/server/0031-Pufferfish-Cache-climbing-check-for-activation.patch similarity index 100% rename from patches/server/0030-Pufferfish-Cache-climbing-check-for-activation.patch rename to patches/server/0031-Pufferfish-Cache-climbing-check-for-activation.patch diff --git a/patches/server/0031-Pufferfish-Reduce-chunk-loading-lookups.patch b/patches/server/0032-Pufferfish-Reduce-chunk-loading-lookups.patch similarity index 100% rename from patches/server/0031-Pufferfish-Reduce-chunk-loading-lookups.patch rename to patches/server/0032-Pufferfish-Reduce-chunk-loading-lookups.patch diff --git a/patches/server/0032-Pufferfish-Early-return-optimization-for-target-find.patch b/patches/server/0033-Pufferfish-Early-return-optimization-for-target-find.patch similarity index 100% rename from patches/server/0032-Pufferfish-Early-return-optimization-for-target-find.patch rename to patches/server/0033-Pufferfish-Early-return-optimization-for-target-find.patch diff --git a/patches/server/0033-Pufferfish-Fix-Paper-6045-block-goal-shouldn-t-load-.patch b/patches/server/0034-Pufferfish-Fix-Paper-6045-block-goal-shouldn-t-load-.patch similarity index 100% rename from patches/server/0033-Pufferfish-Fix-Paper-6045-block-goal-shouldn-t-load-.patch rename to patches/server/0034-Pufferfish-Fix-Paper-6045-block-goal-shouldn-t-load-.patch diff --git a/patches/server/0034-Pufferfish-Skip-cloning-loot-parameters.patch b/patches/server/0035-Pufferfish-Skip-cloning-loot-parameters.patch similarity index 100% rename from patches/server/0034-Pufferfish-Skip-cloning-loot-parameters.patch rename to patches/server/0035-Pufferfish-Skip-cloning-loot-parameters.patch diff --git a/patches/server/0035-Pufferfish-Reduce-projectile-chunk-loading.patch b/patches/server/0036-Pufferfish-Reduce-projectile-chunk-loading.patch similarity index 97% rename from patches/server/0035-Pufferfish-Reduce-projectile-chunk-loading.patch rename to patches/server/0036-Pufferfish-Reduce-projectile-chunk-loading.patch index 11787cb..6f82ee3 100644 --- a/patches/server/0035-Pufferfish-Reduce-projectile-chunk-loading.patch +++ b/patches/server/0036-Pufferfish-Reduce-projectile-chunk-loading.patch @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..12683ec5a5102e45b6171fea0b833ba5 + } +} diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index fa3ec592bdb6325eebd5a7d59810add67c4a9968..b6d72a24a61b30b7c4ad967c196c3fbaa9d68ee9 100644 +index 420531643a486da9d99f011a93461e54d0d9032b..5110ca77adcf6daa7ce2247d4fc8af0835b7bd7e 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -52,6 +52,40 @@ public abstract class Projectile extends Entity implements TraceableEntity { diff --git a/patches/server/0036-Pufferfish-Entity-TTL.patch b/patches/server/0037-Pufferfish-Entity-TTL.patch similarity index 100% rename from patches/server/0036-Pufferfish-Entity-TTL.patch rename to patches/server/0037-Pufferfish-Entity-TTL.patch diff --git a/patches/server/0037-Pufferfish-Dynamic-Activation-of-Brain.patch b/patches/server/0038-Pufferfish-Dynamic-Activation-of-Brain.patch similarity index 100% rename from patches/server/0037-Pufferfish-Dynamic-Activation-of-Brain.patch rename to patches/server/0038-Pufferfish-Dynamic-Activation-of-Brain.patch diff --git a/patches/server/0038-Pufferfish-Only-check-for-spooky-season-once-an-hour.patch b/patches/server/0039-Pufferfish-Only-check-for-spooky-season-once-an-hour.patch similarity index 100% rename from patches/server/0038-Pufferfish-Only-check-for-spooky-season-once-an-hour.patch rename to patches/server/0039-Pufferfish-Only-check-for-spooky-season-once-an-hour.patch diff --git a/patches/server/0039-Pufferfish-Optimize-suffocation.patch b/patches/server/0040-Pufferfish-Optimize-suffocation.patch similarity index 100% rename from patches/server/0039-Pufferfish-Optimize-suffocation.patch rename to patches/server/0040-Pufferfish-Optimize-suffocation.patch diff --git a/patches/server/0040-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch b/patches/server/0041-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch similarity index 100% rename from patches/server/0040-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch rename to patches/server/0041-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch diff --git a/patches/server/0041-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch b/patches/server/0042-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch similarity index 100% rename from patches/server/0041-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch rename to patches/server/0042-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch diff --git a/patches/server/0042-Pufferfish-SIMD-Utilities.patch b/patches/server/0043-Pufferfish-SIMD-Utilities.patch similarity index 100% rename from patches/server/0042-Pufferfish-SIMD-Utilities.patch rename to patches/server/0043-Pufferfish-SIMD-Utilities.patch diff --git a/patches/server/0043-Gale-Variable-entity-wake-up-duration.patch b/patches/server/0044-Gale-Variable-entity-wake-up-duration.patch similarity index 100% rename from patches/server/0043-Gale-Variable-entity-wake-up-duration.patch rename to patches/server/0044-Gale-Variable-entity-wake-up-duration.patch diff --git a/patches/server/0044-Gale-Optimize-sun-burn-tick.patch b/patches/server/0045-Gale-Optimize-sun-burn-tick.patch similarity index 100% rename from patches/server/0044-Gale-Optimize-sun-burn-tick.patch rename to patches/server/0045-Gale-Optimize-sun-burn-tick.patch diff --git a/patches/server/0045-Gale-Use-platform-math-functions.patch b/patches/server/0046-Gale-Use-platform-math-functions.patch similarity index 100% rename from patches/server/0045-Gale-Use-platform-math-functions.patch rename to patches/server/0046-Gale-Use-platform-math-functions.patch diff --git a/patches/server/0046-Gale-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0047-Gale-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0046-Gale-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0047-Gale-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0047-Gale-Optimize-noise-generation.patch b/patches/server/0048-Gale-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0047-Gale-Optimize-noise-generation.patch rename to patches/server/0048-Gale-Optimize-noise-generation.patch diff --git a/patches/server/0048-Gale-Faster-chunk-serialization.patch b/patches/server/0049-Gale-Faster-chunk-serialization.patch similarity index 100% rename from patches/server/0048-Gale-Faster-chunk-serialization.patch rename to patches/server/0049-Gale-Faster-chunk-serialization.patch diff --git a/patches/server/0049-Gale-Reduce-lambda-and-Optional-allocation-in-Entity.patch b/patches/server/0050-Gale-Reduce-lambda-and-Optional-allocation-in-Entity.patch similarity index 100% rename from patches/server/0049-Gale-Reduce-lambda-and-Optional-allocation-in-Entity.patch rename to patches/server/0050-Gale-Reduce-lambda-and-Optional-allocation-in-Entity.patch diff --git a/patches/server/0050-Gale-Replace-throttle-tracker-map-with-optimized-col.patch b/patches/server/0051-Gale-Replace-throttle-tracker-map-with-optimized-col.patch similarity index 100% rename from patches/server/0050-Gale-Replace-throttle-tracker-map-with-optimized-col.patch rename to patches/server/0051-Gale-Replace-throttle-tracker-map-with-optimized-col.patch diff --git a/patches/server/0051-Sparkly-Paper-Optimize-canSee-checks.patch b/patches/server/0052-Sparkly-Paper-Optimize-canSee-checks.patch similarity index 100% rename from patches/server/0051-Sparkly-Paper-Optimize-canSee-checks.patch rename to patches/server/0052-Sparkly-Paper-Optimize-canSee-checks.patch diff --git a/patches/server/0052-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch b/patches/server/0053-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch similarity index 100% rename from patches/server/0052-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch rename to patches/server/0053-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch diff --git a/patches/server/0053-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch b/patches/server/0054-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch similarity index 100% rename from patches/server/0053-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch rename to patches/server/0054-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch diff --git a/patches/server/0054-KioCG-Chunk-API-and-display-of-chunkhot-in-tpsbar.patch b/patches/server/0055-KioCG-Chunk-API-and-display-of-chunkhot-in-tpsbar.patch similarity index 100% rename from patches/server/0054-KioCG-Chunk-API-and-display-of-chunkhot-in-tpsbar.patch rename to patches/server/0055-KioCG-Chunk-API-and-display-of-chunkhot-in-tpsbar.patch diff --git a/patches/server/0055-Purpur-use-alternative-keep-alive.patch b/patches/server/0056-Purpur-use-alternative-keep-alive.patch similarity index 100% rename from patches/server/0055-Purpur-use-alternative-keep-alive.patch rename to patches/server/0056-Purpur-use-alternative-keep-alive.patch diff --git a/patches/server/0056-Leaf-Skip-event-if-no-listeners.patch b/patches/server/0057-Leaf-Skip-event-if-no-listeners.patch similarity index 100% rename from patches/server/0056-Leaf-Skip-event-if-no-listeners.patch rename to patches/server/0057-Leaf-Skip-event-if-no-listeners.patch diff --git a/patches/server/0057-Threaded-region-start-tick-and-finished-tick-event.patch b/patches/server/0058-Threaded-region-start-tick-and-finished-tick-event.patch similarity index 100% rename from patches/server/0057-Threaded-region-start-tick-and-finished-tick-event.patch rename to patches/server/0058-Threaded-region-start-tick-and-finished-tick-event.patch diff --git a/patches/server/0058-Fix-MC-2025.patch b/patches/server/0059-Fix-MC-2025.patch similarity index 100% rename from patches/server/0058-Fix-MC-2025.patch rename to patches/server/0059-Fix-MC-2025.patch diff --git a/patches/server/0059-FoliaPR-Add-TPS-From-Region.patch b/patches/server/0060-FoliaPR-Add-TPS-From-Region.patch similarity index 100% rename from patches/server/0059-FoliaPR-Add-TPS-From-Region.patch rename to patches/server/0060-FoliaPR-Add-TPS-From-Region.patch