Deep cave pool fluid

- cavePools.deepFluid fills pools at or below cavePools.deepFluidMaxY, default world Y -128, unset by default
- A cave policy fluid still wins over the deep fluid
- The mixed-fluid check stops a pool rising past the line, so no pool straddles it
- CavePoolFiller takes the world minimum Y to place the line, and throws when the line is outside the world
- Settings reject an unknown or seam deepFluid, and both knobs join the fingerprint
- Default fingerprint and schema digest recaptured
This commit is contained in:
Brian Fopiano committed 2026-11-03 10:11:48 -05:00
1 parent c4a076b587
commit c76339df4e
9 files changed
+172 -20

No files matched your search

@@ -50,4 +50,12 @@ public class IrisCavePools {
@Required
@Description("Name of the fluid profile that fills cave pools. The hydrology policy fluid of the cave biome at the pool replaces it, then that of its region, then that of the dimension. A surface biome's policy never fills cave pools.")
private String fluid = "water";
@Description("Name of the fluid profile that fills pools at or below deepFluidMaxY. Unset keeps the same fluid at every depth. A hydrology policy that names a fluid still replaces it.")
private String deepFluid;
@MinNumber(-2032)
@MaxNumber(2031)
@Description("Highest world Y that deepFluid fills. No pool crosses this height: a pool rising from below stops at it.")
private int deepFluidMaxY = -128;
}
@@ -61,6 +61,8 @@ public final class HydrologySettings {
public static final int MAX_CAVE_POOL_RADIUS = 15;
private static final int CAVE_POOL_SPAN = 2 * MAX_CAVE_POOL_RADIUS + 1;
private static final int MAX_CAVE_POOL_AREA = CAVE_POOL_SPAN * CAVE_POOL_SPAN;
private static final int MIN_DEEP_FLUID_Y = -2032;
private static final int MAX_DEEP_FLUID_Y = 2031;
private static final int MAX_LAKE_AREA = LakeCandidate.MAX_EXTENT * LakeCandidate.MAX_EXTENT;
private static final int MAX_PREFETCH_RINGS = 4;
private static final int MAX_SEEDED_DENSITY = 64;
@@ -398,7 +400,11 @@ public final class HydrologySettings {
return new CavePools(config.isEnabled(), (float) config.getDensity(), config.getMinArea(), config.getMaxArea(),
config.getMaxDepth(), config.getRadius(),
intRange(config.getFreeboard(), "underground.cavePools.freeboard", RangeFloor.NON_NEGATIVE),
config.getFluid());
config.getFluid(), blankToNull(config.getDeepFluid()), config.getDeepFluidMaxY());
}
private static String blankToNull(String value) {
return value == null || value.isBlank() ? null : value;
}
private static Map<String, IrisMaterialPalette> fluids(List<IrisFluidProfile> profiles) {
@@ -596,6 +602,9 @@ public final class HydrologySettings {
if (!pools.enabled()) {
return;
}
if (pools.deepFluid() != null) {
requireWithin(pools.deepFluidMaxY(), MIN_DEEP_FLUID_Y, MAX_DEEP_FLUID_Y, "underground.cavePools.deepFluidMaxY");
}
if (pools.freeboard().max() >= pools.maxDepth()) {
throw new IllegalArgumentException("Hydrology underground.cavePools.freeboard max " + pools.freeboard().max()
+ " must stay below maxDepth " + pools.maxDepth());
@@ -643,6 +652,9 @@ public final class HydrologySettings {
}
requireFillingFluid(ponds.fluid(), "ponds.fluid");
requireFillingFluid(underground.cavePools().fluid(), "underground.cavePools.fluid");
if (underground.cavePools().deepFluid() != null) {
requireFillingFluid(underground.cavePools().deepFluid(), "underground.cavePools.deepFluid");
}
}
public void requireFillingFluid(String name, String field) {
@@ -721,7 +733,8 @@ public final class HydrologySettings {
.add(inlets.halfWidth()).add(inlets.depth()).add(inlets.headroom()).add(inlets.roofClearance())
.add(inlets.chamberRadius())
.add(pools.enabled()).add(pools.density()).add(pools.minArea()).add(pools.maxArea())
.add(pools.maxDepth()).add(pools.radius()).add(pools.freeboard()).add(pools.fluid());
.add(pools.maxDepth()).add(pools.radius()).add(pools.freeboard()).add(pools.fluid())
.add(pools.deepFluid()).add(pools.deepFluidMaxY());
}
private void addFluids(Fingerprint hash) {
@@ -787,7 +800,7 @@ public final class HydrologySettings {
}
public record CavePools(boolean enabled, float density, int minArea, int maxArea, int maxDepth, int radius,
IntRange freeboard, String fluid) {
IntRange freeboard, String fluid, String deepFluid, int deepFluidMaxY) {
}
public record Underground(SeaInlets seaInlets, CavePools cavePools) {
@@ -33,11 +33,18 @@ public final class CavePoolFiller {
private final HydrologySettings.CavePools pools;
private final Set<String> fluids;
private final float density;
private final int deepLine;
public CavePoolFiller(HydrologySettings settings) {
public CavePoolFiller(HydrologySettings settings, int worldMinimumY) {
this.pools = settings.underground().cavePools();
this.fluids = settings.fluids().keySet();
this.density = settings.density();
this.deepLine = pools.deepFluidMaxY() - worldMinimumY;
int height = settings.maxY() - settings.minY();
if (pools.enabled() && pools.deepFluid() != null && (deepLine < 0 || deepLine >= height)) {
throw new IllegalStateException("Hydrology underground.cavePools.deepFluidMaxY " + pools.deepFluidMaxY()
+ " is outside this world, which spans Y " + worldMinimumY + " to " + (worldMinimumY + height - 1));
}
}
public void fill(int chunkX, int chunkZ, Supplier<? extends CarvedTerrain> terrain, MantleWriter writer, long seed) {
@@ -180,7 +187,10 @@ public final class CavePoolFiller {
private String fluid(CarvedTerrain carved, int x, int y, int z) {
String policy = carved.caveFluid(x, y, z);
return policy != null ? policy : pools.fluid();
if (policy != null) {
return policy;
}
return pools.deepFluid() != null && y <= deepLine ? pools.deepFluid() : pools.fluid();
}
private String siteFluid(CarvedTerrain carved, int x, int y, int z) {
@@ -88,7 +88,7 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
if (poolsActive()) {
HydrologySettings settings = runtime.settings();
Engine engine = getEngineMantle().getEngine();
new CavePoolFiller(settings).fill(chunkX, chunkZ, () -> new MantleCarvedTerrain(writer, complex, engine, chunkX, chunkZ), writer,
new CavePoolFiller(settings, engine.getWorld().minHeight()).fill(chunkX, chunkZ, () -> new MantleCarvedTerrain(writer, complex, engine, chunkX, chunkZ), writer,
settings.seed());
}
}