Fix anchoring point on lava carving

This commit is contained in:
DanLT 2021-09-01 13:50:14 -08:00
parent 93936a7498
commit 3d0eca9432
8 changed files with 24 additions and 12 deletions

View File

@ -47,6 +47,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
private final RNG rng; private final RNG rng;
private final BlockData AIR = Material.CAVE_AIR.createBlockData(); private final BlockData AIR = Material.CAVE_AIR.createBlockData();
private final BlockData WATER = Material.WATER.createBlockData(); private final BlockData WATER = Material.WATER.createBlockData();
private final BlockData LAVA = Material.LAVA.createBlockData();
public IrisCarveModifier(Engine engine) { public IrisCarveModifier(Engine engine) {
super(engine, "Carve"); super(engine, "Carve");
@ -102,7 +103,10 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
if (c.isWater()) { if (c.isWater()) {
output.set(rx, yy, rz, WATER); output.set(rx, yy, rz, WATER);
} else { } else if(c.isLava()) {
output.set(rx, yy, rz, LAVA);
}
else {
output.set(rx, yy, rz, AIR); output.set(rx, yy, rz, AIR);
} }
}; };

View File

@ -106,12 +106,12 @@ public class IrisCave extends IrisRegistrant {
} }
MatterCavern c = new MatterCavern(true, customBiome, (byte) 0); MatterCavern c = new MatterCavern(true, customBiome, (byte) 0);
MatterCavern w = h >= 0 ? new MatterCavern(true, customBiome, (byte) 1) : null; MatterCavern w = new MatterCavern(true, customBiome, (byte) 1);
MatterCavern l = lavaLevel >= 0 ? new MatterCavern(true, customBiome, (byte) 2) : null; MatterCavern l = new MatterCavern(true, customBiome, (byte) 2);
int flp = lowestPoint; int flp = lowestPoint - worm.getGirth().getMid();
writer.setLineConsumer(points, writer.setLineConsumer(points,
girth, true, girth, true,
(xf, yf, zf) -> (lavaLevel + flp >= yf) ? l : (yf <= h ? w : c)); (xf, yf, zf) -> (lavaLevel + flp >= yf && lavaLevel >= 0) ? l : (yf <= h ? w : c));
} }
@Override @Override

View File

@ -55,7 +55,7 @@ public class IrisElipsoid implements IRare {
writer.setElipsoid(x, y, z, writer.setElipsoid(x, y, z,
xRadius.get(rng, z, y, engine.getData()), xRadius.get(rng, z, y, engine.getData()),
yRadius.get(rng, x, z, engine.getData()), yRadius.get(rng, x, z, engine.getData()),
zRadius.get(rng, y, x, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false))); zRadius.get(rng, y, x, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)));
} }
public double maxSize() { public double maxSize() {

View File

@ -46,7 +46,7 @@ public class IrisPyramid implements IRare {
private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>(); private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>();
public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) { public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) {
writer.setPyramid(x, y, z, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false)), writer.setPyramid(x, y, z, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)),
(int) baseWidth.get(rng, z, y, engine.getData()), true); (int) baseWidth.get(rng, z, y, engine.getData()), true);
} }

View File

@ -132,7 +132,7 @@ public class IrisRavine extends IrisRegistrant {
} }
MatterCavern c = new MatterCavern(true, customBiome, (byte) (water ? 1 : 0)); MatterCavern c = new MatterCavern(true, customBiome, (byte) (water ? 1 : 0));
MatterCavern l = lavaLevel >= 0 ? new MatterCavern(true, customBiome, (byte) 2) : null; MatterCavern l = new MatterCavern(true, customBiome, (byte) 2);
if (pos.size() < nodeThreshold) { if (pos.size() < nodeThreshold) {
return; return;
@ -158,7 +158,7 @@ public class IrisRavine extends IrisRegistrant {
break; break;
} }
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, (lavaLevel + lowestPoint) >= i ? l : c); writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, ((lavaLevel + (lowestPoint - depthStyle.getMid())) >= i) && lavaLevel >= 0 ? l : c);
} }
} }
@ -174,7 +174,7 @@ public class IrisRavine extends IrisRegistrant {
break; break;
} }
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, (lavaLevel + lowestPoint) >= i ? l : c); writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, ((lavaLevel + (lowestPoint - depthStyle.getMid())) >= i) && lavaLevel >= 0 ? l : c);
} }
} }
} }

View File

@ -66,4 +66,8 @@ public class IrisShapedGeneratorStyle {
public boolean isFlat() { public boolean isFlat() {
return min == max || getGenerator().isFlat(); return min == max || getGenerator().isFlat();
} }
public int getMid() {
return (getMax() + getMin()) / 2;
}
} }

View File

@ -46,7 +46,7 @@ public class IrisSphere implements IRare {
private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>(); private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>();
public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) { public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) {
writer.setSphere(x, y, z, radius.get(rng, z, y, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false))); writer.setSphere(x, y, z, radius.get(rng, z, y, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)));
} }
public double maxSize() { public double maxSize() {

View File

@ -65,4 +65,8 @@ public class IrisStyledRange {
public boolean isFlat() { public boolean isFlat() {
return getMax() == getMin() || style.isFlat(); return getMax() == getMin() || style.isFlat();
} }
public int getMid() {
return (int) ((getMax() + getMin()) / 2);
}
} }