mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-27 11:09:06 +00:00
Connect configuration with the mantle for fluid bodies
This commit is contained in:
@@ -293,7 +293,7 @@ public class IrisEngineMantle implements EngineMantle {
|
||||
x = Math.max(z, x);
|
||||
int u = x;
|
||||
int v = computeFeatureRange();
|
||||
int c = computeCarvingRange();
|
||||
int c = Math.max(computeCarvingRange(), computeBodyRange());
|
||||
x = Math.max(jig, x);
|
||||
x = Math.max(x, v);
|
||||
x = Math.max(x, c);
|
||||
@@ -308,6 +308,22 @@ public class IrisEngineMantle implements EngineMantle {
|
||||
return x;
|
||||
}
|
||||
|
||||
private int computeBodyRange() {
|
||||
int m = 0;
|
||||
|
||||
m = Math.max(m, getDimension().getFluidBodies().getMaxRange(getData()));
|
||||
|
||||
for (IrisRegion i : getDimension().getAllRegions(getEngine())) {
|
||||
m = Math.max(m, i.getFluidBodies().getMaxRange(getData()));
|
||||
}
|
||||
|
||||
for (IrisBiome i : getDimension().getAllBiomes(getEngine())) {
|
||||
m = Math.max(m, i.getFluidBodies().getMaxRange(getData()));
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
private int computeCarvingRange() {
|
||||
int m = 0;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisCarving;
|
||||
import com.volmit.iris.engine.object.IrisFluidBodies;
|
||||
import com.volmit.iris.engine.object.IrisRegion;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.mantle.MantleFlag;
|
||||
@@ -33,28 +33,28 @@ import java.util.function.Consumer;
|
||||
|
||||
public class MantleFluidBodyComponent extends IrisMantleComponent {
|
||||
public MantleFluidBodyComponent(EngineMantle engineMantle) {
|
||||
super(engineMantle, MantleFlag.CARVED);
|
||||
super(engineMantle, MantleFlag.FLUID_BODIES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateLayer(MantleWriter writer, int x, int z, Consumer<Runnable> post) {
|
||||
RNG rng = new RNG(Cache.key(x, z) + seed());
|
||||
RNG rng = new RNG(Cache.key(x, z) + seed() + 405666);
|
||||
int xxx = 8 + (x << 4);
|
||||
int zzz = 8 + (z << 4);
|
||||
IrisRegion region = getComplex().getRegionStream().get(xxx, zzz);
|
||||
IrisBiome biome = getComplex().getTrueBiomeStreamNoFeatures().get(xxx, zzz);
|
||||
carve(writer, rng, x, z, region, biome);
|
||||
generate(writer, rng, x, z, region, biome);
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
private void carve(MantleWriter writer, RNG rng, int cx, int cz, IrisRegion region, IrisBiome biome) {
|
||||
carve(getDimension().getCarving(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
|
||||
carve(biome.getCarving(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
|
||||
carve(region.getCarving(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
|
||||
private void generate(MantleWriter writer, RNG rng, int cx, int cz, IrisRegion region, IrisBiome biome) {
|
||||
generate(getDimension().getFluidBodies(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
|
||||
generate(biome.getFluidBodies(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
|
||||
generate(region.getFluidBodies(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
private void carve(IrisCarving carving, MantleWriter writer, RNG rng, int cx, int cz) {
|
||||
carving.doCarving(writer, rng, getEngineMantle().getEngine(), cx << 4, -1, cz << 4);
|
||||
private void generate(IrisFluidBodies bodies, MantleWriter writer, RNG rng, int cx, int cz) {
|
||||
bodies.generate(writer, rng, getEngineMantle().getEngine(), cx << 4, -1, cz << 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class IrisFluidBodies {
|
||||
private KList<IrisLake> lakes = new KList<>();
|
||||
|
||||
@BlockCoordinates
|
||||
public void doCarving(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
|
||||
if (rivers.isNotEmpty()) {
|
||||
for (IrisRiver i : rivers) {
|
||||
i.generate(writer, rng, engine, x, y, z);
|
||||
|
||||
@@ -55,5 +55,6 @@ public class IrisLake implements IRare {
|
||||
}
|
||||
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ public enum MantleFlag {
|
||||
FEATURE,
|
||||
INITIAL_SPAWNED,
|
||||
REAL,
|
||||
CARVED;
|
||||
CARVED,
|
||||
FLUID_BODIES;
|
||||
|
||||
static StateList getStateList() {
|
||||
return new StateList(MantleFlag.values());
|
||||
|
||||
Reference in New Issue
Block a user