mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-11 19:14:11 +00:00
chore:
- Extracted children generator seed derivation to deriveChildrenGeneratorSeed Ref.: https://github.com/VolmitSoftware/Iris/issues/1251
This commit is contained in:
+5
-3
@@ -81,15 +81,17 @@ public class IrisDimensionCarvingEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CNG getChildrenGenerator(long seed, IrisData data) {
|
public CNG getChildrenGenerator(long seed, IrisData data) {
|
||||||
long idHash = hashOfId();
|
return childGenerators.computeIfAbsent(deriveChildrenGeneratorSeed(seed), key -> {
|
||||||
long generatorSeed = seed ^ (idHash << 32) ^ 2137L;
|
|
||||||
return childGenerators.computeIfAbsent(generatorSeed, key -> {
|
|
||||||
double scale = Math.max(0.0001D, getChildShrinkFactor());
|
double scale = Math.max(0.0001D, getChildShrinkFactor());
|
||||||
RNG random = new RNG(key);
|
RNG random = new RNG(key);
|
||||||
return getChildStyle().create(random.nextParallelRNG(2137), data).bake().scale(scale).bake();
|
return getChildStyle().create(random.nextParallelRNG(2137), data).bake().scale(scale).bake();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long deriveChildrenGeneratorSeed(long worldSeed) {
|
||||||
|
return worldSeed ^ (hashOfId() << 32) ^ 2137L;
|
||||||
|
}
|
||||||
|
|
||||||
private long hashOfId() {
|
private long hashOfId() {
|
||||||
String entryId = getId();
|
String entryId = getId();
|
||||||
return entryId == null ? 0L : entryId.trim().hashCode();
|
return entryId == null ? 0L : entryId.trim().hashCode();
|
||||||
|
|||||||
Reference in New Issue
Block a user