mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-29 12:09:07 +00:00
Merge pull request #1105 from VolmitDev/jigsaw_dist
Fix jigsaw spawn distances
This commit is contained in:
@@ -156,7 +156,7 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
@ChunkCoordinates
|
||||
private IrisJigsawStructurePlacement pick(List<IrisJigsawStructurePlacement> structures, long seed, int x, int z) {
|
||||
return IRare.pick(structures.stream()
|
||||
.filter(p -> p.shouldPlace(jigsaw(), x, z))
|
||||
.filter(p -> p.shouldPlace(getDimension().getJigsawStructureDivisor(), jigsaw(), x, z))
|
||||
.toList(), new RNG(seed).nextDouble());
|
||||
}
|
||||
|
||||
|
||||
@@ -220,6 +220,8 @@ public class IrisDimension extends IrisRegistrant {
|
||||
@ArrayType(min = 1, type = IrisJigsawStructurePlacement.class)
|
||||
@Desc("Jigsaw structures")
|
||||
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
|
||||
@Desc("The jigsaw structure divisor to use when generating missing jigsaw placement values")
|
||||
private double jigsawStructureDivisor = 18;
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1024)
|
||||
|
||||
@@ -88,21 +88,21 @@ public class IrisJigsawStructurePlacement implements IRare {
|
||||
return (int) Math.ceil(blocks / 16d);
|
||||
}
|
||||
|
||||
private void calculateMissing(long seed) {
|
||||
private void calculateMissing(double divisor, long seed) {
|
||||
seed = seed + hashCode();
|
||||
if (salt == 0) {
|
||||
salt = new RNG(seed).nextLong(Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
if (separation == -1 || spacing == -1) {
|
||||
separation = (int) Math.round(rarity / 15d);
|
||||
separation = (int) Math.round(rarity / divisor);
|
||||
spacing = new RNG(seed).nextInt(separation, separation * 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
public boolean shouldPlace(long seed, int x, int z) {
|
||||
calculateMissing(seed);
|
||||
public boolean shouldPlace(double divisor, long seed, int x, int z) {
|
||||
calculateMissing(divisor, seed);
|
||||
if (separation > spacing) {
|
||||
separation = spacing;
|
||||
Iris.warn("JigsawStructurePlacement: separation must be less than or equal to spacing");
|
||||
|
||||
Reference in New Issue
Block a user