From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Fri, 10 Jul 2026 15:48:51 +0800 Subject: [PATCH] Force clamp grid-exponent to 1~6 diff --git a/io/papermc/paper/threadedregions/TickRegions.java b/io/papermc/paper/threadedregions/TickRegions.java index a6ab9cb01f4f49f5f44b6ed324fa6d51139aabb6..ab94ea7f18799d9dd3cf164a1332db69f40a9278 100644 --- a/io/papermc/paper/threadedregions/TickRegions.java +++ b/io/papermc/paper/threadedregions/TickRegions.java @@ -27,7 +27,7 @@ import java.util.function.BooleanSupplier; public final class TickRegions implements ThreadedRegionizer.RegionCallbacks { private static final Logger LOGGER = LogUtils.getLogger(); - private static int regionShift = 31; + private static int regionShift = ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ThreadedTicketLevelPropagator.SECTION_SHIFT; // Shiroha - Force clamp grid-exponent to 1~6 public static int getRegionChunkShift() { return regionShift; @@ -68,7 +68,8 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ThreadedTicketLevelPropagator.SECTION_SHIFT) LOGGER.warn("You are using a grid-exponent ({}) which is larger than the ticket lock shift! This would lead to randomly fatal crash !!!, Clamping back to max allowed {}", gridExponent, ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ThreadedTicketLevelPropagator.SECTION_SHIFT); // Shiroha - Force clamp grid-exponent to 1~6 + gridExponent = Math.min(ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ThreadedTicketLevelPropagator.SECTION_SHIFT, gridExponent); // Shiroha - Force clamp grid-exponent to 1~6 regionShift = gridExponent; scheduler = new TickRegionScheduler(config.scheduler, tickThreads); LOGGER.info("Initialised " + config.scheduler + " Folia scheduler with initial " + tickThreads + " target thread(s)");