added slime chunk data
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package kaptainwutax.seedcracker.cracker;
|
||||
|
||||
import kaptainwutax.seedcracker.util.Rand;
|
||||
import kaptainwutax.seedcracker.util.Seeds;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
|
||||
public class SlimeChunkData {
|
||||
|
||||
protected ChunkPos chunkPos;
|
||||
protected boolean isSlimeChunk;
|
||||
|
||||
public SlimeChunkData(ChunkPos chunkPos, boolean isSlimeChunk) {
|
||||
this.chunkPos = chunkPos;
|
||||
this.isSlimeChunk = isSlimeChunk;
|
||||
}
|
||||
|
||||
public boolean test(long seed, Rand rand) {
|
||||
Seeds.setSlimeChunkSeed(rand, seed, this.chunkPos.x, this.chunkPos.z, 987234911L);
|
||||
return (rand.nextInt(10) == 0) == this.isSlimeChunk;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,4 +26,10 @@ public class Seeds {
|
||||
return seed;
|
||||
}
|
||||
|
||||
public static long setSlimeChunkSeed(Rand rand, long worldSeed, int chunkX, int chunkZ, long salt) {
|
||||
long seed = worldSeed + (long)(chunkX * chunkX * 4987142) + (long)(chunkX * 5947611) + (long)(chunkZ * chunkZ) * 4392871L + (long)(chunkZ * 389711) ^ salt;
|
||||
rand.setSeed(seed, true);
|
||||
return seed;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user