mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-27 19:19:07 +00:00
Fixed Loot tables acting like a cucumber in the sun
- Fixed loot chests containing the exact same loot - Fixed chests having nothing if a roll fails - Fixed rolls always being done in the same order - Added method to BlockPosition to get a unique long from 3 integers (x, y z)
This commit is contained in:
@@ -11,6 +11,15 @@ public class BlockPosition
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
//Magic numbers
|
||||
private static final int m1 = 1 + MathHelper.f(MathHelper.c(30000000));
|
||||
private static final int m2 = 64 - (m1 * 2);
|
||||
private static final long m3 = m1 + m2;
|
||||
private static final long m4 = (1L << m1) - 1L;
|
||||
private static final long m5 = (1L << m2) - 1L;
|
||||
private static final long m6 = (1L << m1) - 1L;
|
||||
|
||||
|
||||
public BlockPosition(int x, int y, int z)
|
||||
{
|
||||
this.x = x;
|
||||
@@ -59,4 +68,16 @@ public class BlockPosition
|
||||
{
|
||||
return this.x == x && this.y == y && this.z == z;
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return toLong(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
public static long toLong(int x, int y, int z) {
|
||||
long var3 = 0L;
|
||||
var3 |= (x & m4) << m3;
|
||||
var3 |= (y & m5) << 0L;
|
||||
var3 |= (z & m6) << m2;
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public class RNG extends Random
|
||||
|
||||
public int i(int lowerBound, int upperBound)
|
||||
{
|
||||
return (int) Math.round(d(lowerBound, upperBound));
|
||||
return (int) Math.floor(d(lowerBound, upperBound));
|
||||
}
|
||||
|
||||
public int i(int upperBound)
|
||||
@@ -192,4 +192,8 @@ public class RNG extends Random
|
||||
|
||||
return pieces.get(nextInt(pieces.size()));
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
return sx;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user