mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-27 06:20:02 +00:00
Unsynchronized deposit clump random
- Draw deposit clump randomness from a single-owner generator with the java.util.Random sequence
This commit is contained in:
1 parent
1821fedb24
commit
e3135d8b01
2 files changed
+49
-1
No files matched your search
@@ -227,7 +227,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<NativeBlockState
|
||||
int engineHeight = getEngine().getHeight();
|
||||
List<PreparedClump> clumps = new ArrayList<>(limit - first);
|
||||
for (int l = first; l < limit; l++) {
|
||||
RNG clumpRng = new RNG(clumpSeed(plan.seed(), l));
|
||||
RNG clumpRng = new ClumpRandom(clumpSeed(plan.seed(), l));
|
||||
if (k.getPerClumpSpawnChance() < clumpRng.d()) {
|
||||
continue;
|
||||
}
|
||||
@@ -635,6 +635,30 @@ public class IrisDepositModifier extends EngineAssignedModifier<NativeBlockState
|
||||
private record PackScan(IrisData data, boolean variants, boolean oreScaling) {
|
||||
}
|
||||
|
||||
static final class ClumpRandom extends RNG {
|
||||
private static final long MULTIPLIER = 0x5DEECE66DL;
|
||||
private static final long ADDEND = 0xBL;
|
||||
private static final long MASK = (1L << 48) - 1;
|
||||
|
||||
private long state;
|
||||
|
||||
ClumpRandom(long seed) {
|
||||
super(seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setSeed(long seed) {
|
||||
super.setSeed(seed);
|
||||
state = (seed ^ MULTIPLIER) & MASK;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int next(int bits) {
|
||||
state = (state * MULTIPLIER + ADDEND) & MASK;
|
||||
return (int) (state >>> (48 - bits));
|
||||
}
|
||||
}
|
||||
|
||||
private record PreparedDeposit(IrisDepositGenerator generator, boolean ore, List<PreparedClump> clumps) {
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user