diff --git a/leaf-server/minecraft-patches/features/0192-optimize-random-tick.patch b/leaf-server/minecraft-patches/features/0192-optimize-random-tick.patch index 54a9bf0d..0eafd9e4 100644 --- a/leaf-server/minecraft-patches/features/0192-optimize-random-tick.patch +++ b/leaf-server/minecraft-patches/features/0192-optimize-random-tick.patch @@ -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; + }