Fall and estuary check fixes

- missingSurface: a sea-floor head under sea layers or sea decoration holds its cover or its own planned fluid, so a wrong fluid at a frozen estuary or inlet head fails again (R76).
- Column parity test mirrors the open-water-under-a-fall rule with a random 4-neighbour of its own head and role, guarding the actuator against drift from the mantle fall rule.
- An inlet mouth under a fall keeps open sea water, and one without a fall keeps its sea layers.
- bermOverCap still counts an over-cap wall beside a lake's outlet, which is never held.
This commit is contained in:
Brian Neumann-Fopiano committed 2026-11-02 07:36:04 -05:00
1 parent 6f3b96cfb3
commit a21e59f53b
5 files changed
+86 -13

No files matched your search

@@ -27,6 +27,7 @@ final class HydrologyVoxels {
static final byte CANE = 2;
static final byte WATER = 16;
static final byte LAVA = 32;
static final byte SEA_COVER = 64;
static final int NO_WATER = Integer.MIN_VALUE;
static final int COLUMNS = 256;
private static final int FLUID_LEVELS = 16;
@@ -131,7 +132,14 @@ final class HydrologyVoxels {
}
static byte plannedSurface(WaterRole role, boolean solidObject, boolean seaLayers, boolean seaDecoration, byte fluid) {
return solidObject || seaFloor(role) && (seaLayers || seaDecoration) ? SOLID : fluid;
if (solidObject) {
return SOLID;
}
return seaFloor(role) && (seaLayers || seaDecoration) ? seaCover(fluid) : fluid;
}
static byte seaCover(byte fluid) {
return (byte) (SEA_COVER | fluid);
}
static boolean decoratedBy(IrisBiome biome, NativeBlockState state, IrisData data) {
@@ -247,7 +255,13 @@ final class HydrologyVoxels {
}
private static boolean holdsSurface(byte planned, byte voxel) {
return planned == SOLID ? voxel == SOLID || fluid(voxel) : sameFluid(planned, voxel);
if (planned == SOLID) {
return voxel == SOLID || fluid(voxel);
}
if ((planned & SEA_COVER) != 0) {
return voxel == SOLID || sameFluid((byte) (planned & ~SEA_COVER), voxel);
}
return sameFluid(planned, voxel);
}
private boolean opensSideways(Volume volume, int x, int y, int z) {
@@ -182,6 +182,9 @@ public class HydrologyMetricsTest {
assertEquals(0L, berms(List.of(outlet), List.of(held), rasters, low));
assertEquals(1L, berms(List.of(outlet), List.of(pond(10L, 51, square(0, 0, 2), 0L, 4, 4)), rasters(columns), low));
assertEquals(1L, berms(List.of(outlet), List.of(pond(10L, 55, square(0, 0, 2), 3L, 4, 4)), rasters(columns), low));
Pond lake = new Pond(10L, PondKind.LAKE, 51, 47, 4, 4, 52f, square(0, 0, 2), 3L, 0, "minecraft:water", 4, 4);
assertEquals("a lake's outlet is never held, so its over-cap wall still counts", 1L,
berms(List.of(outlet), List.of(lake), rasters(columns), low));
columns.put(HydrologyVoxels.columnKey(10, 5), new Column(WaterRole.BANK, HydrologyVoxels.NO_WATER, head + 1, 3L));
assertEquals(1L, berms(List.of(outlet), List.of(held), rasters(columns), low));
}
@@ -176,9 +176,11 @@ public class HydrologyVoxelsTest {
@Test
public void seaFloorHeadsMayHoldTheSeaLayersOrTheDecorationOfTheSeaTheyJoin() {
for (WaterRole role : new WaterRole[]{WaterRole.INLET, WaterRole.MOUTH}) {
assertEquals(role.name(), HydrologyVoxels.SOLID, HydrologyVoxels.plannedSurface(role, false, true, false, HydrologyVoxels.WATER));
assertEquals(role.name(), HydrologyVoxels.SOLID, HydrologyVoxels.plannedSurface(role, false, false, true, HydrologyVoxels.WATER));
byte cover = HydrologyVoxels.seaCover(HydrologyVoxels.WATER);
assertEquals(role.name(), cover, HydrologyVoxels.plannedSurface(role, false, true, false, HydrologyVoxels.WATER));
assertEquals(role.name(), cover, HydrologyVoxels.plannedSurface(role, false, false, true, HydrologyVoxels.WATER));
assertEquals(role.name(), HydrologyVoxels.WATER, HydrologyVoxels.plannedSurface(role, false, false, false, HydrologyVoxels.WATER));
assertEquals(role.name(), HydrologyVoxels.SOLID, HydrologyVoxels.plannedSurface(role, true, true, false, HydrologyVoxels.WATER));
}
for (WaterRole role : new WaterRole[]{WaterRole.CHANNEL, WaterRole.POND, WaterRole.CASCADE, WaterRole.WATERFALL}) {
assertEquals(role.name(), HydrologyVoxels.WATER, HydrologyVoxels.plannedSurface(role, false, true, true, HydrologyVoxels.WATER));
@@ -187,6 +189,30 @@ public class HydrologyVoxelsTest {
}
}
@Test
public void seaFloorHeadsHoldTheirCoverOrTheirOwnFluid() {
HydrologyVoxels.ChunkBlocks chunk = pond(10);
for (int z = 3; z <= 5; z++) {
for (int x = 3; x <= 5; x++) {
chunk.heads()[(z << 4) | x] = 10;
}
}
for (WaterRole role : new WaterRole[]{WaterRole.INLET, WaterRole.MOUTH}) {
for (boolean layers : new boolean[]{true, false}) {
String cover = role + (layers ? " under sea layers" : " under the sea's decoration");
chunk.surfaces()[(4 << 4) | 4] = HydrologyVoxels.plannedSurface(role, false, layers, !layers, HydrologyVoxels.WATER);
chunk.set(4, 10, 4, HydrologyVoxels.WATER);
assertEquals("open water at the head of a " + cover, 0L, scan(volume(chunk)).missingSurfaces);
chunk.set(4, 10, 4, HydrologyVoxels.SOLID);
assertEquals("the cover at the head of a " + cover, 0L, scan(volume(chunk)).missingSurfaces);
chunk.set(4, 10, 4, HydrologyVoxels.LAVA);
HydrologyVoxels.WaterScan scan = scan(volume(chunk));
assertEquals("the wrong fluid at the head of a " + cover, 1L, scan.missingSurfaces);
assertEquals("missing planned surface at 4,10,4", scan.examples.get(0));
}
}
}
@Test
public void onlyBlocksTheBiomeDecoratesWithAreItsDecoration() {
IrisData data = mock(IrisData.class);