30 lines
2.2 KiB
Diff
30 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <mrhua269@gmail.com>
|
|
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..7bf49d2c235cb3f6c4cd8de4d127f476c7deb069 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<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> {
|
|
|
|
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<Tic
|
|
initialised = true;
|
|
int gridExponent = config.gridExponent;
|
|
gridExponent = Math.max(0, gridExponent);
|
|
- gridExponent = Math.min(31, gridExponent);
|
|
+ if (gridExponent > 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)");
|