9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 19:39:17 +00:00

fix random tick chance check

This commit is contained in:
hayanesuru
2025-06-09 23:56:11 +09:00
parent 4b70908e81
commit ec62833de4

View File

@@ -69,10 +69,10 @@ public final class RandomTickSystem {
tickSpeed = tickSpeed * 4;
long chance = chunk.leaf$randomTickChance();
if (chance == 0L && (chance = recompute(chunk, tickSpeed)) == 0L) {
if (chance != 0L && chance <= (long) (a & MASK)) {
return;
}
if (chance >= (long) (a & MASK) || (chance = recompute(chunk, tickSpeed)) == 0L) {
if ((chance = recompute(chunk, tickSpeed)) == 0L) {
return;
}
int tickingCount = chunk.leaf$countTickingBlocks();
@@ -86,7 +86,7 @@ public final class RandomTickSystem {
}
chance -= SCALE;
long last = randomSource.nextInt() & MASK;
while (last <= chance) {
while (chance > last) {
pos = chunk.leaf$tickingPos(randomSource.nextInt(tickingCount));
if (pos.isPresent()) {
tickPos.add(pos.getAsLong());