Skip to content

Commit

Permalink
fix slime chunks algorithm (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
asquared31415 authored Nov 13, 2024
1 parent 4f97074 commit ec315c6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ public class ChunkHelper {
private static final Random RANDOM = new Random();

public static boolean isSlimeChunk(long seed, int x, int z) {
RANDOM.setSeed(seed + (x * x * 4987142) + (x * 5947611) + (z * z * 4392871) + (z * 389711) ^ 987234911);
// noinspection IntegerMultiplicationImplicitCastToLong - we want to do the casts as integers and *then* cast
RANDOM.setSeed(
seed + (long) (x * x * 0x4c1906) + (long) (x * 0x5ac0db) + (long) (z * z) * 0x4307a7L + (long) (z * 0x5f24f)
^ 0x3ad8025fL);
return RANDOM.nextInt(10) == 0;
}
}

0 comments on commit ec315c6

Please sign in to comment.