diff --git a/patches/server/0019-Try-fixing-folia-253.patch b/patches/server/0019-Try-fixing-folia-253.patch new file mode 100644 index 0000000..d110f26 --- /dev/null +++ b/patches/server/0019-Try-fixing-folia-253.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrHua269 +Date: Wed, 31 Jul 2024 21:24:06 +0800 +Subject: [PATCH] Try fixing folia #253 + +A solution for https://github.com/PaperMC/Folia/issues/253 ?() + +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 135fa024d81b962761f0edc6896a2a507b6981f9..9f7a89d07295223689d2d2beb14c4ec78eb6aa3c 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -452,9 +452,18 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + System.arraycopy(raw, 0, regionizedWorldData.iterationCopy, 0, size); // Folia - region threading + +- list = it.unimi.dsi.fastutil.objects.ObjectArrayList.wrap( ++ // Luminol start - Fix issue #253 ++ //Do not wrap as there are some null elements ++ /*list = it.unimi.dsi.fastutil.objects.ObjectArrayList.wrap( + regionizedWorldData.iterationCopy, size // Folia - region threading +- ); ++ );*/ ++ list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(size); ++ for (ChunkAndHolder holder : regionizedWorldData.iterationCopy){ ++ if (holder != null){ ++ list.add(holder); ++ } ++ } ++ // Luminol end + } + } finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_TICK_COLLECT_CHUNKS); } // Folia - profiler + // Paper end - chunk tick iteration optimisations +@@ -559,12 +568,12 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BROADCAST_BLOCK_CHANGES); try { // Folia - profiler + { + final it.unimi.dsi.fastutil.objects.ObjectArrayList chunks = (it.unimi.dsi.fastutil.objects.ObjectArrayList)list; +- final ServerChunkCache.ChunkAndHolder[] raw = chunks.elements(); ++ final Object[] raw = chunks.elements(); // Luminol - Try fixing folia #253 + final int size = chunks.size(); + + Objects.checkFromToIndex(0, size, raw.length); + for (int idx = 0; idx < size; ++idx) { +- final ServerChunkCache.ChunkAndHolder holder = raw[idx]; ++ final ServerChunkCache.ChunkAndHolder holder = (ServerChunkCache.ChunkAndHolder) raw[idx]; + raw[idx] = null; + + holder.holder().broadcastChanges(holder.chunk()); diff --git a/patches/server/0019-Kaiiju-Don-t-pathfind-outside-region.patch b/patches/server/0020-Kaiiju-Don-t-pathfind-outside-region.patch similarity index 100% rename from patches/server/0019-Kaiiju-Don-t-pathfind-outside-region.patch rename to patches/server/0020-Kaiiju-Don-t-pathfind-outside-region.patch diff --git a/patches/server/0020-Petal-Reduce-sensor-work.patch b/patches/server/0021-Petal-Reduce-sensor-work.patch similarity index 100% rename from patches/server/0020-Petal-Reduce-sensor-work.patch rename to patches/server/0021-Petal-Reduce-sensor-work.patch diff --git a/patches/server/0021-Pufferfish-Cache-climbing-check-for-activation.patch b/patches/server/0022-Pufferfish-Cache-climbing-check-for-activation.patch similarity index 100% rename from patches/server/0021-Pufferfish-Cache-climbing-check-for-activation.patch rename to patches/server/0022-Pufferfish-Cache-climbing-check-for-activation.patch diff --git a/patches/server/0022-Pufferfish-Make-EntityCollisionContext-a-live-repres.patch b/patches/server/0023-Pufferfish-Make-EntityCollisionContext-a-live-repres.patch similarity index 100% rename from patches/server/0022-Pufferfish-Make-EntityCollisionContext-a-live-repres.patch rename to patches/server/0023-Pufferfish-Make-EntityCollisionContext-a-live-repres.patch diff --git a/patches/server/0023-Pufferfish-Improve-fluid-direction-caching.patch b/patches/server/0024-Pufferfish-Improve-fluid-direction-caching.patch similarity index 100% rename from patches/server/0023-Pufferfish-Improve-fluid-direction-caching.patch rename to patches/server/0024-Pufferfish-Improve-fluid-direction-caching.patch diff --git a/patches/server/0024-Pufferfish-Optimize-suffocation.patch b/patches/server/0025-Pufferfish-Optimize-suffocation.patch similarity index 100% rename from patches/server/0024-Pufferfish-Optimize-suffocation.patch rename to patches/server/0025-Pufferfish-Optimize-suffocation.patch diff --git a/patches/server/0025-Pufferfish-Early-return-optimization-for-target-find.patch b/patches/server/0026-Pufferfish-Early-return-optimization-for-target-find.patch similarity index 100% rename from patches/server/0025-Pufferfish-Early-return-optimization-for-target-find.patch rename to patches/server/0026-Pufferfish-Early-return-optimization-for-target-find.patch diff --git a/patches/server/0026-Pufferfish-Reduce-chunk-loading-lookups.patch b/patches/server/0027-Pufferfish-Reduce-chunk-loading-lookups.patch similarity index 100% rename from patches/server/0026-Pufferfish-Reduce-chunk-loading-lookups.patch rename to patches/server/0027-Pufferfish-Reduce-chunk-loading-lookups.patch diff --git a/patches/server/0027-Pufferfish-Fix-Paper-6045-block-goal-shouldn-t-load-.patch b/patches/server/0028-Pufferfish-Fix-Paper-6045-block-goal-shouldn-t-load-.patch similarity index 100% rename from patches/server/0027-Pufferfish-Fix-Paper-6045-block-goal-shouldn-t-load-.patch rename to patches/server/0028-Pufferfish-Fix-Paper-6045-block-goal-shouldn-t-load-.patch diff --git a/patches/server/0028-Pufferfish-Reduce-entity-fluid-lookups-if-no-fluids.patch b/patches/server/0029-Pufferfish-Reduce-entity-fluid-lookups-if-no-fluids.patch similarity index 100% rename from patches/server/0028-Pufferfish-Reduce-entity-fluid-lookups-if-no-fluids.patch rename to patches/server/0029-Pufferfish-Reduce-entity-fluid-lookups-if-no-fluids.patch diff --git a/patches/server/0029-Pufferfish-Only-check-for-spooky-season-once-an-hour.patch b/patches/server/0030-Pufferfish-Only-check-for-spooky-season-once-an-hour.patch similarity index 100% rename from patches/server/0029-Pufferfish-Only-check-for-spooky-season-once-an-hour.patch rename to patches/server/0030-Pufferfish-Only-check-for-spooky-season-once-an-hour.patch diff --git a/patches/server/0030-Pufferfish-Skip-cloning-loot-parameters.patch b/patches/server/0031-Pufferfish-Skip-cloning-loot-parameters.patch similarity index 100% rename from patches/server/0030-Pufferfish-Skip-cloning-loot-parameters.patch rename to patches/server/0031-Pufferfish-Skip-cloning-loot-parameters.patch diff --git a/patches/server/0031-Pufferfish-Entity-TTL.patch b/patches/server/0032-Pufferfish-Entity-TTL.patch similarity index 100% rename from patches/server/0031-Pufferfish-Entity-TTL.patch rename to patches/server/0032-Pufferfish-Entity-TTL.patch diff --git a/patches/server/0032-Pufferfish-Dynamic-Activation-of-Brain.patch b/patches/server/0033-Pufferfish-Dynamic-Activation-of-Brain.patch similarity index 100% rename from patches/server/0032-Pufferfish-Dynamic-Activation-of-Brain.patch rename to patches/server/0033-Pufferfish-Dynamic-Activation-of-Brain.patch diff --git a/patches/server/0033-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch b/patches/server/0034-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch similarity index 100% rename from patches/server/0033-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch rename to patches/server/0034-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch diff --git a/patches/server/0034-Pufferfish-Reduce-entity-allocations.patch b/patches/server/0035-Pufferfish-Reduce-entity-allocations.patch similarity index 100% rename from patches/server/0034-Pufferfish-Reduce-entity-allocations.patch rename to patches/server/0035-Pufferfish-Reduce-entity-allocations.patch diff --git a/patches/server/0035-Pufferfish-Improve-container-checking-with-a-bitset.patch b/patches/server/0036-Pufferfish-Improve-container-checking-with-a-bitset.patch similarity index 100% rename from patches/server/0035-Pufferfish-Improve-container-checking-with-a-bitset.patch rename to patches/server/0036-Pufferfish-Improve-container-checking-with-a-bitset.patch diff --git a/patches/server/0036-Gale-Variable-entity-wake-up-duration.patch b/patches/server/0037-Gale-Variable-entity-wake-up-duration.patch similarity index 100% rename from patches/server/0036-Gale-Variable-entity-wake-up-duration.patch rename to patches/server/0037-Gale-Variable-entity-wake-up-duration.patch diff --git a/patches/server/0037-Gale-Don-t-load-chunks-to-activate-climbing-entities.patch b/patches/server/0038-Gale-Don-t-load-chunks-to-activate-climbing-entities.patch similarity index 100% rename from patches/server/0037-Gale-Don-t-load-chunks-to-activate-climbing-entities.patch rename to patches/server/0038-Gale-Don-t-load-chunks-to-activate-climbing-entities.patch diff --git a/patches/server/0038-Gale-Optimize-sun-burn-tick.patch b/patches/server/0039-Gale-Optimize-sun-burn-tick.patch similarity index 100% rename from patches/server/0038-Gale-Optimize-sun-burn-tick.patch rename to patches/server/0039-Gale-Optimize-sun-burn-tick.patch diff --git a/patches/server/0039-Gale-Simpler-ShapelessRecipe-comparison-for-vanilla.patch b/patches/server/0040-Gale-Simpler-ShapelessRecipe-comparison-for-vanilla.patch similarity index 100% rename from patches/server/0039-Gale-Simpler-ShapelessRecipe-comparison-for-vanilla.patch rename to patches/server/0040-Gale-Simpler-ShapelessRecipe-comparison-for-vanilla.patch diff --git a/patches/server/0040-Gale-Use-platform-math-functions.patch b/patches/server/0041-Gale-Use-platform-math-functions.patch similarity index 100% rename from patches/server/0040-Gale-Use-platform-math-functions.patch rename to patches/server/0041-Gale-Use-platform-math-functions.patch diff --git a/patches/server/0041-Gale-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0042-Gale-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0041-Gale-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0042-Gale-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0042-Gale-Optimize-noise-generation.patch b/patches/server/0043-Gale-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0042-Gale-Optimize-noise-generation.patch rename to patches/server/0043-Gale-Optimize-noise-generation.patch diff --git a/patches/server/0043-Gale-Faster-chunk-serialization.patch b/patches/server/0044-Gale-Faster-chunk-serialization.patch similarity index 100% rename from patches/server/0043-Gale-Faster-chunk-serialization.patch rename to patches/server/0044-Gale-Faster-chunk-serialization.patch diff --git a/patches/server/0044-Gale-Reduce-lambda-and-Optional-allocation-in-Entity.patch b/patches/server/0045-Gale-Reduce-lambda-and-Optional-allocation-in-Entity.patch similarity index 100% rename from patches/server/0044-Gale-Reduce-lambda-and-Optional-allocation-in-Entity.patch rename to patches/server/0045-Gale-Reduce-lambda-and-Optional-allocation-in-Entity.patch diff --git a/patches/server/0045-Gale-Replace-throttle-tracker-map-with-optimized-col.patch b/patches/server/0046-Gale-Replace-throttle-tracker-map-with-optimized-col.patch similarity index 100% rename from patches/server/0045-Gale-Replace-throttle-tracker-map-with-optimized-col.patch rename to patches/server/0046-Gale-Replace-throttle-tracker-map-with-optimized-col.patch diff --git a/patches/server/0046-Sparkly-Paper-Optimize-canSee-checks.patch b/patches/server/0047-Sparkly-Paper-Optimize-canSee-checks.patch similarity index 100% rename from patches/server/0046-Sparkly-Paper-Optimize-canSee-checks.patch rename to patches/server/0047-Sparkly-Paper-Optimize-canSee-checks.patch diff --git a/patches/server/0047-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch b/patches/server/0048-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch similarity index 100% rename from patches/server/0047-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch rename to patches/server/0048-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch diff --git a/patches/server/0048-Purpur-use-alternative-keep-alive.patch b/patches/server/0049-Purpur-use-alternative-keep-alive.patch similarity index 100% rename from patches/server/0048-Purpur-use-alternative-keep-alive.patch rename to patches/server/0049-Purpur-use-alternative-keep-alive.patch diff --git a/patches/server/0049-KioCG-Chunk-API-and-display-of-chunkhot-in-tpsbar.patch b/patches/server/0050-KioCG-Chunk-API-and-display-of-chunkhot-in-tpsbar.patch similarity index 100% rename from patches/server/0049-KioCG-Chunk-API-and-display-of-chunkhot-in-tpsbar.patch rename to patches/server/0050-KioCG-Chunk-API-and-display-of-chunkhot-in-tpsbar.patch diff --git a/patches/server/0050-Leaf-Skip-event-if-no-listeners.patch b/patches/server/0051-Leaf-Skip-event-if-no-listeners.patch similarity index 100% rename from patches/server/0050-Leaf-Skip-event-if-no-listeners.patch rename to patches/server/0051-Leaf-Skip-event-if-no-listeners.patch diff --git a/patches/server/0051-Threaded-region-start-tick-and-finished-tick-event.patch b/patches/server/0052-Threaded-region-start-tick-and-finished-tick-event.patch similarity index 100% rename from patches/server/0051-Threaded-region-start-tick-and-finished-tick-event.patch rename to patches/server/0052-Threaded-region-start-tick-and-finished-tick-event.patch diff --git a/patches/server/0052-Fix-MC-2025.patch b/patches/server/0053-Fix-MC-2025.patch similarity index 100% rename from patches/server/0052-Fix-MC-2025.patch rename to patches/server/0053-Fix-MC-2025.patch diff --git a/patches/server/0053-FoliaPR-Add-TPS-From-Region.patch b/patches/server/0054-FoliaPR-Add-TPS-From-Region.patch similarity index 100% rename from patches/server/0053-FoliaPR-Add-TPS-From-Region.patch rename to patches/server/0054-FoliaPR-Add-TPS-From-Region.patch