mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-01 18:24:06 +00:00
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:
1 parent
6f3b96cfb3
commit
a21e59f53b
5 files changed
+86
-13
No files matched your search
+21
-4
@@ -116,6 +116,10 @@ public class IrisTerrainNormalActuatorColumnParityTest {
|
||||
private final Map<String, NativeBlockState> palettes = new HashMap<>();
|
||||
private final int he;
|
||||
private final int surfaceFluid;
|
||||
private final int fallX;
|
||||
private final int fallZ;
|
||||
private final int fallHead;
|
||||
private final WaterRole fallRole;
|
||||
private final KList<IrisOreGenerator> biomeSurface = new KList<>();
|
||||
private final KList<IrisOreGenerator> biomeUnderground = new KList<>();
|
||||
private final KList<IrisOreGenerator> regionSurface = new KList<>();
|
||||
@@ -158,6 +162,12 @@ public class IrisTerrainNormalActuatorColumnParityTest {
|
||||
dimensionOres.addAll(dimensionUnderground);
|
||||
dimension = new IrisDimension().setBedrock(bedrock).setHideOresForHiddenOre(false);
|
||||
dimension.setOres(dimensionOres);
|
||||
Random fall = new Random(31L * trial + 7L);
|
||||
int side = fall.nextInt(4);
|
||||
fallX = X + (side == 0 ? 1 : side == 1 ? -1 : 0);
|
||||
fallZ = Z + (side == 2 ? 1 : side == 3 ? -1 : 0);
|
||||
fallHead = surfaceFluid - 1 + fall.nextInt(5);
|
||||
fallRole = WaterRole.values()[fall.nextInt(WaterRole.values().length)];
|
||||
|
||||
when(engine.getDimension()).thenReturn(dimension);
|
||||
when(engine.getComplex()).thenReturn(complex);
|
||||
@@ -166,8 +176,9 @@ public class IrisTerrainNormalActuatorColumnParityTest {
|
||||
IrisImageMapRuntime imageMap = mock(IrisImageMapRuntime.class);
|
||||
when(imageMap.sampleSurfaceBlock(anyDouble(), anyDouble())).thenReturn(mapped);
|
||||
when(complex.getImageMapRuntime()).thenReturn(imageMap);
|
||||
when(complex.getWaterHeadStream()).thenReturn(ProceduralStream.ofDouble((x, z) -> (double) surfaceFluid));
|
||||
when(complex.getWaterRoleStream()).thenReturn(ProceduralStream.of((x, z) -> role, Interpolated.of(value -> 0D, value -> role)));
|
||||
when(complex.getWaterHeadStream()).thenReturn(ProceduralStream.ofDouble((x, z) -> fallColumn(x, z) ? fallHead : (double) surfaceFluid));
|
||||
when(complex.getWaterRoleStream()).thenReturn(ProceduralStream.of((x, z) -> fallColumn(x, z) ? fallRole : role,
|
||||
Interpolated.of(value -> 0D, value -> role)));
|
||||
when(complex.resolveWaterMaterials(X, Z)).thenReturn(materials);
|
||||
when(complex.resolveWaterFluid(X, Z)).thenReturn(waterFluid);
|
||||
when(complex.naturalTrueHeight(X, Z)).thenReturn(he + 5);
|
||||
@@ -191,7 +202,12 @@ public class IrisTerrainNormalActuatorColumnParityTest {
|
||||
when(biome.getSurfaceOreBands()).thenReturn(IrisOreBands.of(biomeSurface));
|
||||
when(biome.getUndergroundOreBands()).thenReturn(IrisOreBands.of(biomeUnderground));
|
||||
description = "he=" + he + " fluid=" + surfaceFluid + " bedrock=" + bedrock + " mapped=" + (mapped != null)
|
||||
+ " layers=" + layerCount + " column=" + terrainColumn + " role=" + role + " materials=" + materials;
|
||||
+ " layers=" + layerCount + " column=" + terrainColumn + " role=" + role + " materials=" + materials
|
||||
+ " neighbour=" + fallX + "," + fallZ + " " + fallRole + "@" + fallHead;
|
||||
}
|
||||
|
||||
private boolean fallColumn(double x, double z) {
|
||||
return (int) Math.floor(x) == fallX && (int) Math.floor(z) == fallZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -209,6 +225,7 @@ public class IrisTerrainNormalActuatorColumnParityTest {
|
||||
NativeBlockState airState = B.getState("AIR");
|
||||
boolean wet = role.wet();
|
||||
boolean seaFloor = !wet || role == WaterRole.INLET || role == WaterRole.MOUTH;
|
||||
boolean openUnderFall = wet && seaFloor && fallRole.wet() && fallHead > surfaceFluid;
|
||||
IrisHydrologyMaterials materials = role == WaterRole.INLET ? null : this.materials;
|
||||
int he = Math.min(chunkHeight, this.he);
|
||||
int surfaceFluidHeight = Math.min(chunkHeight, this.surfaceFluid);
|
||||
@@ -279,7 +296,7 @@ public class IrisTerrainNormalActuatorColumnParityTest {
|
||||
if (seaFloor && fblocks == null) {
|
||||
fblocks = biome.generateSeaLayers(realX, realZ, rng, hf - he, data);
|
||||
}
|
||||
h.setRaw(xf, i, zf, HydrologyFluidLayerSelector.select(fblocks, fdepth, columnFluid, !seaFloor));
|
||||
h.setRaw(xf, i, zf, HydrologyFluidLayerSelector.select(fblocks, fdepth, columnFluid, !seaFloor || openUnderFall));
|
||||
continue;
|
||||
}
|
||||
if (i <= he) {
|
||||
|
||||
+18
-5
@@ -191,24 +191,37 @@ public class IrisTerrainNormalActuatorHydrologyTest {
|
||||
|
||||
@Test
|
||||
public void aFallIntoAFrozenMouthLandsInOpenWater() {
|
||||
Painter fall = frozenMouth();
|
||||
Painter fall = frozenSeaFloor(WaterRole.MOUTH);
|
||||
fall.neighbour(12, -4, WaterRole.CHANNEL, HEAD + 1);
|
||||
Hunk<NativeBlockState> plunge = fall.paint();
|
||||
for (int y = GROUND + 1; y <= HEAD; y++) {
|
||||
assertSame("the fall lands in open sea water at y " + y, fall.sea, plunge.get(0, y, 0));
|
||||
}
|
||||
|
||||
Painter level = frozenMouth();
|
||||
Painter level = frozenSeaFloor(WaterRole.MOUTH);
|
||||
level.neighbour(11, -3, WaterRole.CHANNEL, HEAD);
|
||||
assertSame("water beside the mouth at its own level is no fall", level.ice, level.paint().get(0, HEAD, 0));
|
||||
|
||||
Painter dry = frozenMouth();
|
||||
Painter dry = frozenSeaFloor(WaterRole.MOUTH);
|
||||
dry.neighbour(10, -4, WaterRole.BANK, HEAD + 4);
|
||||
assertSame("a higher dry bank is no fall", dry.ice, dry.paint().get(0, HEAD, 0));
|
||||
}
|
||||
|
||||
private static Painter frozenMouth() {
|
||||
Painter painter = new Painter(WaterRole.MOUTH, HEAD);
|
||||
@Test
|
||||
public void aFallIntoAFrozenInletMouthLandsInOpenWater() {
|
||||
Painter fall = frozenSeaFloor(WaterRole.INLET);
|
||||
fall.neighbour(12, -4, WaterRole.CHANNEL, HEAD + 1);
|
||||
Hunk<NativeBlockState> plunge = fall.paint();
|
||||
for (int y = GROUND + 1; y <= HEAD; y++) {
|
||||
assertSame("the fall lands in open sea water at y " + y, fall.sea, plunge.get(0, y, 0));
|
||||
}
|
||||
|
||||
Painter still = frozenSeaFloor(WaterRole.INLET);
|
||||
assertSame("an inlet mouth with no fall keeps its sea layers", still.ice, still.paint().get(0, HEAD, 0));
|
||||
}
|
||||
|
||||
private static Painter frozenSeaFloor(WaterRole role) {
|
||||
Painter painter = new Painter(role, HEAD);
|
||||
when(painter.complex.resolveWaterFluid(11, -4)).thenReturn(painter.sea);
|
||||
when(painter.complex.naturalTrueHeight(11, -4)).thenReturn(GROUND);
|
||||
painter.thickSeaLayers();
|
||||
|
||||
Reference in new issue
Block a user