mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-26 18:49:06 +00:00
Added MIN_STILT, CENTER_STILT and derivatives.
Made stilt override use a palette. Added yMax and yRand. Consolidated stilt settings into a object.
This commit is contained in:
@@ -101,7 +101,6 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
||||
KList<BlockData> blocks = null;
|
||||
KList<BlockData> fblocks = null;
|
||||
int depth, fdepth;
|
||||
|
||||
for(int i = hf; i >= 0; i--) {
|
||||
if(i >= h.getHeight()) {
|
||||
continue;
|
||||
|
||||
@@ -506,7 +506,9 @@ public class IrisObject extends IrisRegistrant {
|
||||
}
|
||||
|
||||
boolean warped = !config.getWarp().isFlat();
|
||||
boolean stilting = (config.getMode().equals(ObjectPlaceMode.STILT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT));
|
||||
boolean stilting = (config.getMode().equals(ObjectPlaceMode.STILT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT) ||
|
||||
config.getMode() == ObjectPlaceMode.MIN_STILT || config.getMode() == ObjectPlaceMode.FAST_MIN_STILT ||
|
||||
config.getMode() == ObjectPlaceMode.CENTER_STILT);
|
||||
KMap<Position2, Integer> heightmap = config.getSnow() > 0 ? new KMap<>() : null;
|
||||
int spinx = rng.imax() / 1000;
|
||||
int spiny = rng.imax() / 1000;
|
||||
@@ -520,7 +522,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
boolean bail = false;
|
||||
|
||||
if(yv < 0) {
|
||||
if(config.getMode().equals(ObjectPlaceMode.CENTER_HEIGHT)) {
|
||||
if(config.getMode().equals(ObjectPlaceMode.CENTER_HEIGHT) || config.getMode() == ObjectPlaceMode.CENTER_STILT) {
|
||||
y = (c != null ? c.getSurface() : placer.getHighest(x, z, getLoader(), config.isUnderwater())) + rty;
|
||||
if(placer.isCarved(x, y, z) || placer.isCarved(x, y - 1, z) || placer.isCarved(x, y - 2, z) || placer.isCarved(x, y - 3, z)) {
|
||||
bail = true;
|
||||
@@ -569,7 +571,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
y = h;
|
||||
}
|
||||
}
|
||||
} else if(config.getMode().equals(ObjectPlaceMode.MIN_HEIGHT)) {
|
||||
} else if(config.getMode().equals(ObjectPlaceMode.MIN_HEIGHT) || config.getMode() == ObjectPlaceMode.MIN_STILT) {
|
||||
y = rdata.getEngine().getHeight() + 1;
|
||||
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
||||
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
|
||||
@@ -592,7 +594,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(config.getMode().equals(ObjectPlaceMode.FAST_MIN_HEIGHT)) {
|
||||
} else if(config.getMode().equals(ObjectPlaceMode.FAST_MIN_HEIGHT) || config.getMode() == ObjectPlaceMode.FAST_MIN_STILT) {
|
||||
y = rdata.getEngine().getHeight() + 1;
|
||||
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
||||
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
|
||||
@@ -823,10 +825,11 @@ public class IrisObject extends IrisRegistrant {
|
||||
|
||||
if(stilting) {
|
||||
readLock.lock();
|
||||
IrisStiltSettings settings = config.getStiltSettings();
|
||||
for(BlockVector g : getBlocks().keySet()) {
|
||||
BlockData d;
|
||||
|
||||
if(config.getStiltOverride() == null) {
|
||||
if(settings == null || settings.getPalette() == null) {
|
||||
try {
|
||||
d = getBlocks().get(g);
|
||||
} catch(Throwable e) {
|
||||
@@ -840,7 +843,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
d = AIR;
|
||||
}
|
||||
} else
|
||||
d = config.getStiltOverride().getBlockData(rdata);
|
||||
d = config.getStiltSettings().getPalette().get(rng, x, y, z, rdata);
|
||||
|
||||
|
||||
BlockVector i = g.clone();
|
||||
@@ -877,15 +880,21 @@ public class IrisObject extends IrisRegistrant {
|
||||
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x, getLoader());
|
||||
}
|
||||
|
||||
int yg = placer.getHighest(xx, zz, getLoader(), true);
|
||||
int highest = placer.getHighest(xx, zz, getLoader(), true);
|
||||
|
||||
if(config.isWaterloggable() && yg <= placer.getFluidHeight() && d instanceof Waterlogged)
|
||||
if(config.isWaterloggable() && highest <= placer.getFluidHeight() && d instanceof Waterlogged)
|
||||
((Waterlogged) d).setWaterlogged(true);
|
||||
|
||||
if(yv >= 0 && config.isBottom())
|
||||
y += Math.floorDiv(h, 2);
|
||||
|
||||
for(int j = lowest + y; j > yg - config.getOverStilt() - 1; j--)
|
||||
int lowerBound = highest - 1;
|
||||
if(settings != null) {
|
||||
lowerBound -= config.getStiltSettings().getOverStilt() - rng.i(0, config.getStiltSettings().getYRand());
|
||||
if(settings.getYMax() != 0)
|
||||
lowerBound -= Math.min(config.getStiltSettings().getYMax() - (lowest + y - highest), 0);
|
||||
}
|
||||
for(int j = lowest + y; j > lowerBound; j--)
|
||||
placer.set(xx, j, zz, d);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,12 +75,8 @@ public class IrisObjectPlacement {
|
||||
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)
|
||||
@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.")
|
||||
private int overStilt = 0;
|
||||
@Desc("If defined, stilting will be done using this block rather than the last layer of the object.")
|
||||
private IrisBlockData stiltOverride;
|
||||
@Desc("When stilting is enabled, this object will define various properties related to it.")
|
||||
private IrisStiltSettings stiltSettings;
|
||||
@MaxNumber(64)
|
||||
@MinNumber(0)
|
||||
@Desc("When bore is enabled, expand max-y of the cuboid it removes")
|
||||
@@ -148,7 +144,7 @@ public class IrisObjectPlacement {
|
||||
p.setUnderwater(underwater);
|
||||
p.setBoreExtendMaxY(boreExtendMaxY);
|
||||
p.setBoreExtendMinY(boreExtendMinY);
|
||||
p.setOverStilt(overStilt);
|
||||
p.setStiltSettings(stiltSettings);
|
||||
p.setDensity(density);
|
||||
p.setChance(chance);
|
||||
p.setSnow(snow);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
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.Snippet;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("stilt-settings")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Defines stilting behaviour.")
|
||||
@Data
|
||||
public class IrisStiltSettings {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("Defines the maximum amount of blocks the object stilts verticially before overstilting and randomRange.")
|
||||
private int yMax;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("Defines the upper boundary for additional blocks after overstilting and/or maxStiltRange.")
|
||||
private int yRand;
|
||||
@MaxNumber(64)
|
||||
@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.")
|
||||
private int overStilt;
|
||||
@Desc("If defined, stilting will be done using this block palette rather than the last layer of the object.")
|
||||
private IrisMaterialPalette palette;
|
||||
|
||||
}
|
||||
@@ -50,6 +50,18 @@ public enum ObjectPlaceMode {
|
||||
|
||||
FAST_STILT,
|
||||
|
||||
@Desc("Stilting is MIN_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
|
||||
|
||||
MIN_STILT,
|
||||
|
||||
@Desc("Just like MIN_STILT but very inaccurate. Useful for stilting a lot of objects without too much care on accuracy (you can use the over-stilt value to force stilts under ground further)")
|
||||
|
||||
FAST_MIN_STILT,
|
||||
|
||||
@Desc("Stilting is CENTER_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
|
||||
|
||||
CENTER_STILT,
|
||||
|
||||
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
|
||||
|
||||
PAINT
|
||||
|
||||
Reference in New Issue
Block a user