9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

fix tickingPos out of bounds

This commit is contained in:
hayanesuru
2025-06-08 15:33:21 +09:00
parent 4bf675075a
commit 0eeb6e719c

View File

@@ -39,7 +39,7 @@ index eb849c57992658005e0f514c6f7923f8ca43bebf..2efcdb9bc91b9106b4aef9e24cc20596
}
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index 624a177695580510c0a49d4503dee72da7fd7114..8be4f0978451179fca8b9603743e875817040a08 100644
index 624a177695580510c0a49d4503dee72da7fd7114..affe9fff1ff2f7e221f8cfe345d40d707e0f3dbc 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -151,6 +151,52 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
@@ -80,12 +80,12 @@ index 624a177695580510c0a49d4503dee72da7fd7114..8be4f0978451179fca8b9603743e8758
+ LevelChunkSection section = sections[i];
+ var l = section.moonrise$getTickingBlockList();
+ int size = l.size();
+ if (size > idx) {
+ short loc = l.getRaw(size - idx);
+ return java.util.OptionalLong.of(BlockPos.asLong(
+ (loc & 15) | (chunkPos.x << 4),
+ (loc >>> 8) | (((getMinSectionY() + i) << 4)),
+ ((loc >>> 4) & 15) | (chunkPos.z << 4)));
+ if (idx < size) {
+ short loc = l.getRaw(idx);
+ int x = (loc & 15) | (chunkPos.x << 4);
+ int y = (loc >>> 8) | ((getMinSectionY() + i) << 4);
+ int z = ((loc >>> 4) & 15) | (chunkPos.z << 4);
+ return java.util.OptionalLong.of(BlockPos.asLong(x, y, z));
+ }
+ idx -= size;
+ }