mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 09:15:27 +00:00
Probe gates know estuaries
- missingSurface lets mouth columns take the biome sea layers like inlet columns, as the terrain stage paints them - missingSurface accepts the biome's own decoration at the head of mouth and inlet columns, which are decorated like the sea they join - missingSurface expects each column's effective fluid, so seam columns expect their seam - risingWaterSegments compares reach heads with the pond's snapped head instead of its raw level - bermOverCap spares the containment wall of pond outlet water held at its pond's head, the accepted perched flume
This commit is contained in:
1 parent
2ed13f9b7f
commit
ecbd177360
5 files changed
+163
-16
No files matched your search
@@ -156,6 +156,47 @@ public class HydrologyMetricsTest {
|
||||
assertRises(0L, null, List.of(mouth), List.of(), level);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aReachEndingInItsPondAtThePondsSnappedHeadDoesNotRise() {
|
||||
Pond odd = pond(10L, 51, square(96, 96, 3), 0L, 100, 100);
|
||||
Reach inflow = reach(4L, STREAM, 0L, 1000f, new int[]{60, 51, 51}, 60f, 100f, 80f, 100f, 100f, 100f);
|
||||
Map<Long, Column> level = new HashMap<>();
|
||||
wet(level, inflow, 60, 50, HydrologyVoxels.NO_WATER);
|
||||
assertRises(0L, null, List.of(inflow), List.of(odd), level);
|
||||
Map<Long, Column> below = new HashMap<>();
|
||||
wet(below, inflow, 60, 48, HydrologyVoxels.NO_WATER);
|
||||
assertRises(1L, "rise from reach 4 at 48 into pond 10 at 50", List.of(inflow), List.of(odd), below);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bermOverCapSparesOnlyTheWallOfOutletWaterHeldAtItsPondsHead() {
|
||||
int maxFill = SETTINGS.deformation().maxFill();
|
||||
int head = 50;
|
||||
Reach outlet = reach(3L, STREAM, 0L, 1000f, new int[]{51, 51}, 8f, 4f, 20f, 4f);
|
||||
Pond held = pond(10L, 51, square(0, 0, 2), 3L, 4, 4);
|
||||
Map<Long, Column> columns = new HashMap<>();
|
||||
columns.put(HydrologyVoxels.columnKey(10, 4), new Column(WaterRole.CHANNEL, head, head - 2, 3L));
|
||||
columns.put(HydrologyVoxels.columnKey(10, 5), new Column(WaterRole.BANK, HydrologyVoxels.NO_WATER, head, 3L));
|
||||
HydrologyRasterMetrics.Rasters rasters = rasters(columns);
|
||||
int low = head - maxFill - 2;
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
private static long berms(List<Reach> reaches, List<Pond> ponds, HydrologyRasterMetrics.Rasters rasters, int natural) {
|
||||
HydrologyPlanMetrics plans = new HydrologyPlanMetrics(SETTINGS, windows(plan(WEST, reaches, ponds), plan(EAST, List.of(), List.of())),
|
||||
List.of(), BOTH, ignored -> {
|
||||
});
|
||||
List<String> examples = new ArrayList<>();
|
||||
long overCap = new HydrologyRasterMetrics(SETTINGS, plans, rasters, (x, z) -> x == 10 && z == 5 ? natural : NATURAL, BOTH, examples::add)
|
||||
.bermOverCap(WEST);
|
||||
assertEquals(examples.toString(), overCap, examples.size());
|
||||
return overCap;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void chunkSeamsFireOnDryColumnsLeftBelowTheirBermAndOnePondAtTwoLevels() {
|
||||
HydrologyPlanMetrics plans = new HydrologyPlanMetrics(SETTINGS, windows(plan(WEST, List.of(), List.of()), plan(EAST, List.of(), List.of())),
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
package art.arcane.iris.probe;
|
||||
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.decoration.IrisDecorator;
|
||||
import art.arcane.iris.generation.hydrology.raster.WaterRole;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -164,6 +173,36 @@ public class HydrologyVoxelsTest {
|
||||
assertEquals(1L, scan(volume(chunk)).missingSurfaces);
|
||||
}
|
||||
|
||||
@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));
|
||||
assertEquals(role.name(), HydrologyVoxels.WATER, HydrologyVoxels.plannedSurface(role, false, false, 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));
|
||||
assertEquals(role.name(), HydrologyVoxels.LAVA, HydrologyVoxels.plannedSurface(role, false, false, false, HydrologyVoxels.LAVA));
|
||||
assertEquals(role.name(), HydrologyVoxels.SOLID, HydrologyVoxels.plannedSurface(role, true, false, false, HydrologyVoxels.WATER));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onlyBlocksTheBiomeDecoratesWithAreItsDecoration() {
|
||||
IrisData data = mock(IrisData.class);
|
||||
NativeBlockState coralBlock = state("minecraft:fire_coral_block", false);
|
||||
NativeBlockState pickles = state("minecraft:sea_pickle[pickles=2,waterlogged=true]", true);
|
||||
IrisDecorator coral = mock(IrisDecorator.class);
|
||||
when(coral.getBlockData(data)).thenReturn(new KList<>(List.of(coralBlock)));
|
||||
when(coral.getBlockDataTops(data)).thenReturn(new KList<>(List.of(pickles)));
|
||||
IrisBiome biome = new IrisBiome().setDecorators(new KList<>(List.of(coral)));
|
||||
assertTrue(HydrologyVoxels.decoratedBy(biome, state("minecraft:fire_coral_block", false), data));
|
||||
assertTrue(HydrologyVoxels.decoratedBy(biome, state("minecraft:sea_pickle[pickles=1,waterlogged=true]", true), data));
|
||||
assertFalse(HydrologyVoxels.decoratedBy(biome, state("minecraft:stone", false), data));
|
||||
assertFalse(HydrologyVoxels.decoratedBy(biome, state("minecraft:fire_coral_block_slab", false), data));
|
||||
assertFalse(HydrologyVoxels.decoratedBy(biome, null, data));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unknownNeighboursAreCensoredNotLeaks() {
|
||||
HydrologyVoxels.ChunkBlocks chunk = solid();
|
||||
|
||||
Reference in new issue
Block a user