mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-28 06:50:02 +00:00
Trim cave decoration markers
- Stop writing cave ceiling markers, which nothing reads - Write cave floor markers only when the dimension has cave spawners - Reuse the zone floor subterrain cell for zone decoration
This commit is contained in:
1 parent
41142ee5b5
commit
1821fedb24
2 files changed
+29
-20
No files matched your search
@@ -7,6 +7,7 @@ import art.arcane.iris.generation.decoration.IrisCeilingDecorator;
|
||||
import art.arcane.iris.generation.decoration.IrisSurfaceDecorator;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.runtime.SeedManager;
|
||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.generation.terrain.transform.TerrainTransformRuntime;
|
||||
import art.arcane.iris.generation.terrain.Terrain3DColumn;
|
||||
import art.arcane.iris.generation.context.ChunkContext;
|
||||
@@ -72,12 +73,17 @@ public class IrisNaturalCaveScanTest {
|
||||
|
||||
@Test
|
||||
public void narrowScanPreservesDecoratedBlocksMarkersAndMutationOrder() throws Exception {
|
||||
verifyScan(5, 3);
|
||||
verifyScan(5, 3, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void chunkScanPreservesDecoratedBlocksMarkersAndMutationOrder() throws Exception {
|
||||
verifyScan(16, 16);
|
||||
verifyScan(16, 16, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scanWithoutCaveSpawnersWritesNoCaveMarkers() throws Exception {
|
||||
verifyScan(16, 16, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -277,8 +283,8 @@ public class IrisNaturalCaveScanTest {
|
||||
assertEquals(List.of("floor:0:0:3:3", "ceiling:0:0:8:3"), fixture.calls);
|
||||
}
|
||||
|
||||
private static void verifyScan(int width, int depth) throws Exception {
|
||||
Fixture fixture = new Fixture();
|
||||
private static void verifyScan(int width, int depth, boolean caveSpawners) throws Exception {
|
||||
Fixture fixture = new Fixture(false, caveSpawners);
|
||||
Hunk<NativeBlockState> output = fixture.output(width, depth);
|
||||
List<String> writes = new ArrayList<>();
|
||||
fixture.modifier.decorateNaturalCaves(-32, 48,
|
||||
@@ -302,10 +308,8 @@ public class IrisNaturalCaveScanTest {
|
||||
}
|
||||
}
|
||||
expectedWrites.add(x + ":" + ceiling + ":" + z + ":minecraft:calcite");
|
||||
if ((boolean) markerRoll.invoke(fixture.modifier, x - 32, ceiling, z + 48, 0x9E3779B97F4A7C15L)) {
|
||||
expectedMarkers.add((x - 32) + ":" + ceiling + ":" + (z + 48) + ":" + MarkerMatter.CAVE_CEILING);
|
||||
}
|
||||
if ((boolean) markerRoll.invoke(fixture.modifier, x - 32, floor, z + 48, 0xC2B2AE3D27D4EB4FL)) {
|
||||
if (caveSpawners
|
||||
&& (boolean) markerRoll.invoke(fixture.modifier, x - 32, floor, z + 48, 0xC2B2AE3D27D4EB4FL)) {
|
||||
expectedMarkers.add((x - 32) + ":" + floor + ":" + (z + 48) + ":" + MarkerMatter.CAVE_FLOOR);
|
||||
}
|
||||
}
|
||||
@@ -327,7 +331,7 @@ public class IrisNaturalCaveScanTest {
|
||||
assertEquals(expectedCalls, fixture.calls);
|
||||
assertEquals(expectedWrites, writes);
|
||||
assertEquals(expectedMarkers, fixture.markers);
|
||||
assertTrue("fixture must exercise marker writes", !expectedMarkers.isEmpty());
|
||||
assertEquals("fixture must exercise marker writes", caveSpawners, !expectedMarkers.isEmpty());
|
||||
verify(fixture.mantle).useChunk(-2, 3);
|
||||
verify(fixture.chunk).release();
|
||||
}
|
||||
@@ -361,9 +365,16 @@ public class IrisNaturalCaveScanTest {
|
||||
this(false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Fixture(boolean buildAboveTop) throws Exception {
|
||||
this(buildAboveTop, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Fixture(boolean buildAboveTop, boolean caveSpawners) throws Exception {
|
||||
Engine engine = mock(Engine.class);
|
||||
IrisDimension dimension = mock(IrisDimension.class);
|
||||
doReturn(dimension).when(engine).getDimension();
|
||||
doReturn(caveSpawners).when(dimension).hasUndergroundSpawners(engine);
|
||||
EngineMantle engineMantle = mock(EngineMantle.class);
|
||||
mantle = mock(Mantle.class);
|
||||
chunk = mock(MantleChunk.class);
|
||||
|
||||
Reference in new issue
Block a user