mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 18:55:18 +00:00
commit
7ef5031717
@ -87,7 +87,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
private void placeObject(MantleWriter writer, RNG rng, int x, int z, IrisObjectPlacement objectPlacement) {
|
private void placeObject(MantleWriter writer, RNG rng, int x, int z, IrisObjectPlacement objectPlacement) {
|
||||||
for (int i = 0; i < objectPlacement.getDensity(); i++) {
|
for (int i = 0; i < objectPlacement.getDensity(rng, x, z, getData()); i++) {
|
||||||
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
|
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
return;
|
return;
|
||||||
@ -104,7 +104,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
private Set<String> guessPlacedKeys(RNG rng, int x, int z, IrisObjectPlacement objectPlacement) {
|
private Set<String> guessPlacedKeys(RNG rng, int x, int z, IrisObjectPlacement objectPlacement) {
|
||||||
Set<String> f = new KSet<>();
|
Set<String> f = new KSet<>();
|
||||||
for (int i = 0; i < objectPlacement.getDensity(); i++) {
|
for (int i = 0; i < objectPlacement.getDensity(rng, x, z, getData()); i++) {
|
||||||
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
|
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -62,7 +62,6 @@ public class IrisObjectPlacement {
|
|||||||
private IrisObjectRotation rotation = new IrisObjectRotation();
|
private IrisObjectRotation rotation = new IrisObjectRotation();
|
||||||
@Desc("Limit the max height or min height of placement.")
|
@Desc("Limit the max height or min height of placement.")
|
||||||
private IrisObjectLimit clamp = new IrisObjectLimit();
|
private IrisObjectLimit clamp = new IrisObjectLimit();
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(1)
|
@MaxNumber(1)
|
||||||
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
|
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
|
||||||
@ -74,6 +73,8 @@ public class IrisObjectPlacement {
|
|||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("If the chance check passes, place this many in a single chunk")
|
@Desc("If the chance check passes, place this many in a single chunk")
|
||||||
private int density = 1;
|
private int density = 1;
|
||||||
|
@Desc("If the chance check passes, and you specify this, it picks a number in the range based on noise, and 'density' is ignored.")
|
||||||
|
private IrisStyledRange densityStyle = null;
|
||||||
@MaxNumber(64)
|
@MaxNumber(64)
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
|
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
|
||||||
@ -164,18 +165,6 @@ public class IrisObjectPlacement {
|
|||||||
return getSurfaceWarp(rng, data).fitDouble(-(getWarp().getMultiplier() / 2D), (getWarp().getMultiplier() / 2D), x, y, z);
|
return getSurfaceWarp(rng, data).fitDouble(-(getWarp().getMultiplier() / 2D), (getWarp().getMultiplier() / 2D), x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTriesForChunk(RNG random) {
|
|
||||||
if (chance <= 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chance >= 1 || random.nextDouble() < chance) {
|
|
||||||
return density;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IrisObject getObject(DataProvider g, RNG random) {
|
public IrisObject getObject(DataProvider g, RNG random) {
|
||||||
if (place.isEmpty()) {
|
if (place.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
@ -194,6 +183,21 @@ public class IrisObjectPlacement {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDensity() {
|
||||||
|
if (densityStyle == null) {
|
||||||
|
return density;
|
||||||
|
}
|
||||||
|
return densityStyle.getMid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDensity(RNG rng, double x, double z, IrisData data) {
|
||||||
|
if (densityStyle == null) {
|
||||||
|
return density;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) Math.round(densityStyle.get(rng, x, z, data));
|
||||||
|
}
|
||||||
|
|
||||||
private TableCache getCache(IrisData manager) {
|
private TableCache getCache(IrisData manager) {
|
||||||
return cache.aquire(() -> {
|
return cache.aquire(() -> {
|
||||||
TableCache tc = new TableCache();
|
TableCache tc = new TableCache();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user