Fix incorrect ticket lock size computing
Yeah this would fully solve the issue of chunk unloading race condition The same fix was already initially added at "Force clamp grid-exponent to 1~6"
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||||
Date: Sun, 9 Aug 2026 14:35:48 +0800
|
||||
Subject: [PATCH] Fix incorrect ticket lock size computing
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
index 8b06d0c893e07c969d35c4d7528927552c27b48b..352325aeea9e4f797893911d81703262b198ecd5 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
@@ -941,14 +941,18 @@ public final class ChunkHolderManager {
|
||||
|
||||
final int lowerChunkX = CoordinateUtils.getChunkX(sectionKey) << sectionShift;
|
||||
final int lowerChunkZ = CoordinateUtils.getChunkZ(sectionKey) << sectionShift;
|
||||
+ // Shiroha start - Fix incorrect ticket lock size computing
|
||||
+ final int upperChunkX = lowerChunkX + (1 << sectionShift) - 1;
|
||||
+ final int upperChunkZ = lowerChunkZ + (1 << sectionShift) - 1;
|
||||
+ // Shiroha end - Fix incorrect ticket lock size computing
|
||||
|
||||
final int ticketShift = ThreadedTicketLevelPropagator.SECTION_SHIFT;
|
||||
final int ticketMask = (1 << ticketShift) - 1;
|
||||
final ReentrantAreaLock.Node ticketLock = this.ticketLockArea.lock(
|
||||
((lowerChunkX >> ticketShift) - 1) << ticketShift,
|
||||
((lowerChunkZ >> ticketShift) - 1) << ticketShift,
|
||||
- (((lowerChunkX >> ticketShift) + 1) << ticketShift) | ticketMask,
|
||||
- (((lowerChunkZ >> ticketShift) + 1) << ticketShift) | ticketMask
|
||||
+ (((upperChunkX >> ticketShift) + 1) << ticketShift) | ticketMask, // Shiroha - Fix incorrect ticket lock size computing
|
||||
+ (((upperChunkZ >> ticketShift) + 1) << ticketShift) | ticketMask // Shiroha - Fix incorrect ticket lock size computing
|
||||
);
|
||||
|
||||
try {
|
||||
Reference in New Issue
Block a user