mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 14:50:57 +00:00
Merge pull request #24 from VolmitDev/fix_jigsaw
minor changes to jigsaw
This commit is contained in:
@@ -21,6 +21,7 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
import com.volmit.iris.engine.object.annotations.Required;
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
@@ -54,17 +55,19 @@ public class IrisJigsawStructurePlacement implements IRare {
|
|||||||
|
|
||||||
@Required
|
@Required
|
||||||
@Desc("The salt to use when generating the structure (to differentiate structures)")
|
@Desc("The salt to use when generating the structure (to differentiate structures)")
|
||||||
private int salt = 76134;
|
@MinNumber(Long.MIN_VALUE)
|
||||||
|
@MaxNumber(Long.MAX_VALUE)
|
||||||
|
private long salt = 0;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("Average distance in chunks between two neighboring generation attempts")
|
@Desc("Average distance in chunks between two neighboring generation attempts")
|
||||||
private int spacing = 32;
|
private int spacing = -1;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("Minimum distance in chunks between two neighboring generation attempts\nThe maximum distance of two neighboring generation attempts is 2*spacing - separation")
|
@Desc("Minimum distance in chunks between two neighboring generation attempts\nThe maximum distance of two neighboring generation attempts is 2*spacing - separation")
|
||||||
private int separation = 16;
|
private int separation = -1;
|
||||||
|
|
||||||
@Desc("The method used to spread the structure")
|
@Desc("The method used to spread the structure")
|
||||||
private SpreadType spreadType = SpreadType.TRIANGULAR;
|
private SpreadType spreadType = SpreadType.TRIANGULAR;
|
||||||
@@ -85,8 +88,21 @@ public class IrisJigsawStructurePlacement implements IRare {
|
|||||||
return (int) Math.ceil(blocks / 16d);
|
return (int) Math.ceil(blocks / 16d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void calculateMissing(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 / 20d);
|
||||||
|
spacing = new RNG(seed).nextInt(separation, separation * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
public boolean shouldPlace(long seed, int x, int z) {
|
public boolean shouldPlace(long seed, int x, int z) {
|
||||||
|
calculateMissing(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