mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Mantle.caverns(): where the mantle carved voids for a chunk to take over, read-only like the planned blocks
This commit is contained in:
1 parent
d2d746734f
commit
f3d1ff8d13
5 files changed
+55
No files matched your search
@@ -185,6 +185,34 @@ class ChunkPipelineTest {
|
||||
assertThrows(UnsupportedOperationException.class, () -> mantle.within(chunkArea).blocks().set(0, 0, 0, stone));
|
||||
}
|
||||
|
||||
@Test
|
||||
void chunkStagesReadWhereTheMantleCarvedVoidsButCannotCarveAny() {
|
||||
var mantle = new MemoryMantle();
|
||||
mantle.carve(6, 9, 2);
|
||||
var chunkArea = new BlockBox(0, BOTTOM, 0, CHUNK, TOP, CHUNK);
|
||||
var carved = new ArrayList<String>();
|
||||
var probe = Stage.chunk("test:caves/probe");
|
||||
IrisModule module = new IrisModule() {
|
||||
public ModuleInfo info() { return ModuleInfo.of("test:caves", "Caves", "1"); }
|
||||
public void install(StageGraph graph) {
|
||||
graph.define(probe).run(context -> {
|
||||
var caverns = context.mantle().caverns();
|
||||
carved.add(String.valueOf(caverns.get(6, 9, 2)));
|
||||
carved.add(String.valueOf(caverns.get(6, 10, 2)));
|
||||
});
|
||||
}
|
||||
};
|
||||
var builder = new StageGraphBuilder();
|
||||
builder.install(DiscoveredModule.builtIn(module));
|
||||
var blocks = new ArrayHunk<>(BlockState.class, CHUNK, HEIGHT, CHUNK, AIR);
|
||||
|
||||
new ChunkRunner(builder.resolve(Pipeline.CHUNK)).generate(
|
||||
TestContexts.generation(Map.of(BlockState.class, blocks), ColumnSettings.NONE, mantle.within(chunkArea)), TestContexts.SEED);
|
||||
|
||||
assertEquals(List.of("true", "null"), carved);
|
||||
assertThrows(UnsupportedOperationException.class, () -> mantle.within(chunkArea).caverns().set(0, 0, 0, true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theRunnerReportsHowLongEachStageThatRanTook() {
|
||||
var timed = new ArrayList<String>();
|
||||
|
||||
Reference in new issue
Block a user