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