mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 01:34:04 +00:00
Remove inlet passage
- Delete SeaInlet, its rasterizer, space and footprint, and the old inlet probe - Keep the mantle cells, old chunk seal and cave headroom behind SealedPassage - Keep their tests on a test passage so grottos can build on them - Report tidal arm counts from the plan in the hydrology probe
This commit is contained in:
21 files changed
+315
-1681
No files matched your search
@@ -2,6 +2,8 @@ package art.arcane.iris.probe;
|
||||
|
||||
import art.arcane.iris.generation.hydrology.plan.WindowKey;
|
||||
import art.arcane.iris.generation.hydrology.plan.WindowPlan;
|
||||
import art.arcane.iris.generation.hydrology.water.Reach;
|
||||
import art.arcane.iris.generation.hydrology.water.ReachStyle;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -21,21 +23,25 @@ final class HydrologyUnderground {
|
||||
static final Counts NONE = new Counts(0, 0L, 0, 0L, List.of());
|
||||
}
|
||||
|
||||
private static int tidal(WindowPlan plan) {
|
||||
int arms = 0;
|
||||
for (Reach reach : plan.reaches()) {
|
||||
arms += reach.style()[0] == ReachStyle.TIDAL ? 1 : 0;
|
||||
}
|
||||
return arms;
|
||||
}
|
||||
|
||||
static Source generated(Engine engine, ExecutorService workers) {
|
||||
return (key, plan) -> {
|
||||
SeaInletProbe.Checks inlets = SeaInletProbe.check(engine, List.of(), workers);
|
||||
int minChunkX = key.wx() * HydrologyWindows.CHUNKS;
|
||||
int minChunkZ = key.wz() * HydrologyWindows.CHUNKS;
|
||||
CavePoolProbe.Counts pools = CavePoolProbe.check(engine, new CavePoolProbe.Area(minChunkX, minChunkX + HydrologyWindows.CHUNKS - 1,
|
||||
minChunkZ, minChunkZ + HydrologyWindows.CHUNKS - 1), workers);
|
||||
List<String> examples = new ArrayList<>();
|
||||
for (String example : inlets.examples()) {
|
||||
examples.add("inlet " + example);
|
||||
}
|
||||
for (String example : pools.examples()) {
|
||||
examples.add("pool " + example);
|
||||
}
|
||||
return new Counts(inlets.inlets(), inlets.failures(), pools.pools(), pools.failures(), examples);
|
||||
return new Counts(tidal(plan), 0L, pools.pools(), pools.failures(), examples);
|
||||
};
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,76 +0,0 @@
|
||||
package art.arcane.iris.probe;
|
||||
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class SeaInletChecksTest {
|
||||
@Test
|
||||
public void roofBreachesFailWithTheContainmentSealAndRoofChecks() {
|
||||
SeaInletProbe.Checks breached = new SeaInletProbe.Checks(3, 0L, 0L, 0L, 0L, 1939L, 0L, 0L, 0L, 0L, 0L, List.of());
|
||||
assertEquals(1939L, breached.failures());
|
||||
SeaInletProbe.Checks failing = new SeaInletProbe.Checks(3, 1L, 2L, 3L, 4L, 9L, 5L, 6L, 7L, 8L, 0L, List.of());
|
||||
assertEquals(45L, failing.failures());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void looseBedsAreReportedButDoNotFail() {
|
||||
SeaInletProbe.Checks reported = new SeaInletProbe.Checks(3, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 952L, List.of());
|
||||
assertEquals(0L, reported.failures());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theGateFailsOnEveryCheckIncludingOrderSeaLevelAndAddedLeaks() {
|
||||
SeaInletProbe.Checks clean = new SeaInletProbe.Checks(3, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 952L, List.of());
|
||||
SeaInletProbe.Gate passing = new SeaInletProbe.Gate(clean, 0, 0, 0);
|
||||
assertEquals(0L, passing.failures());
|
||||
assertTrue(passing.line(), passing.line().startsWith("SEA_INLET_GATE status=PASS failures=0 "));
|
||||
assertEquals(2L, new SeaInletProbe.Gate(clean, 0, 0, 2).failures());
|
||||
assertEquals(1L, new SeaInletProbe.Gate(clean, 1, 0, 0).failures());
|
||||
assertEquals(1L, new SeaInletProbe.Gate(clean, 0, 1, 0).failures());
|
||||
SeaInletProbe.Checks breached = new SeaInletProbe.Checks(3, 0L, 0L, 0L, 0L, 4L, 0L, 0L, 0L, 0L, 0L, List.of());
|
||||
SeaInletProbe.Gate failing = new SeaInletProbe.Gate(breached, 0, 0, 0);
|
||||
assertEquals(4L, failing.failures());
|
||||
assertTrue(failing.line(), failing.line().startsWith("SEA_INLET_GATE status=FAIL failures=4 "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addedLeaksAreTheLeaksMissingWithoutInlets() {
|
||||
long kept = SeaInletProbe.cellKey(10, 300, -20);
|
||||
long removed = SeaInletProbe.cellKey(11, 300, -20);
|
||||
long added = SeaInletProbe.cellKey(10, 301, -20);
|
||||
assertEquals(0, SeaInletProbe.addedLeaks(Set.of(kept), Set.of(kept)));
|
||||
assertEquals("inlets that remove natural leaks do not fail", 0, SeaInletProbe.addedLeaks(Set.of(kept), Set.of(kept, removed)));
|
||||
assertEquals("a leak the inlets move counts although the totals match", 1, SeaInletProbe.addedLeaks(Set.of(kept, added),
|
||||
Set.of(kept, removed)));
|
||||
assertEquals(2, SeaInletProbe.addedLeaks(Set.of(added, removed), Set.of()));
|
||||
assertNotEquals(SeaInletProbe.cellKey(-1, 300, 0), SeaInletProbe.cellKey(0, 300, -1));
|
||||
assertNotEquals(SeaInletProbe.cellKey(5, 0, 5), SeaInletProbe.cellKey(5, 4095, 5));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inletCellsAreClassifiedAgainstTheDimensionSeaFluid() {
|
||||
assertEquals(SeaInletProbe.classify(state("minecraft:water"), "minecraft:water"), SeaInletProbe.classify(state("minecraft:lava"),
|
||||
"minecraft:lava"));
|
||||
assertEquals(SeaInletProbe.classify(state("minecraft:water[level=8]"), "minecraft:water"),
|
||||
SeaInletProbe.classify(state("minecraft:lava[level=8]"), "minecraft:lava"));
|
||||
assertEquals(SeaInletProbe.classify(state("minecraft:lava"), "minecraft:water"), SeaInletProbe.classify(state("minecraft:water"),
|
||||
"minecraft:lava"));
|
||||
assertNotEquals(SeaInletProbe.classify(state("minecraft:lava"), "minecraft:lava"), SeaInletProbe.classify(state("minecraft:lava"),
|
||||
"minecraft:water"));
|
||||
}
|
||||
|
||||
private static NativeBlockState state(String key) {
|
||||
NativeBlockState state = mock(NativeBlockState.class);
|
||||
when(state.key()).thenReturn(key);
|
||||
return state;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user