Remove Mantle.isCarved, carved().get(x, y, z) != null asks the same

The mantle had two ways to ask whether a position holds a carved void.
The layer is the one way now.
This commit is contained in:
piexel committed 2026-11-06 12:55:41 +01:00
1 parent 307b89c5fe
commit 0691753d21
8 files changed
+7 -24

No files matched your search

+1 -1
View File
@@ -161,7 +161,7 @@ running Iris is the pack publisher's responsibility.
the host's own identity of it (a custom block of a content plugin stays one).
- Serve `Mantle.carved()` in every invocation, keeping the voids in the host's own form: a mantle stage's view writes them, a chunk
stage's view only reads them (its writes throw UnsupportedOperationException), and a dimension that keeps no mantle holds none. Answer
`Mantle.isCarved(x, y, z)` (false where it holds none) and cover the chunk and the 16 blocks around it in a chunk stage's mantle, as the
`carved().get(x, y, z)` (null where it holds none) and cover the chunk and the 16 blocks around it in a chunk stage's mantle, as the
sampler does.
- Name pack resources to services by `ResourceId` and convert to the host's keys at the host's edge; read a `ResourceId`
setting written as a bare pack key as the pack's id of that key.
+1 -1
View File
@@ -630,7 +630,7 @@ biome it shows), as `blocks()` is its layer of planned blocks. It is the one hos
(Iris's cave carver does, thousands per chunk, so the plain fills are shared constants and the host keeps them in its own form), and a chunk
stage reads them, around its chunk as far as its mantle reaches, and cuts them out of its terrain. A chunk stage's writes throw, as the
mantle is complete when chunk stages run. A void the planner marked need not show in the chunk (under a dimension above, the cave stage
leaves it solid), so `Mantle.isCarved(x, y, z)` stays as the short question for a stage that places something solid.
leaves it solid), so a stage that places something solid asks `carved().get(x, y, z) != null`; there is no separate `isCarved` on the mantle.
`Mantle.setPlatformBiome(x, y, z, biome)` is the other way round: modules write it and only the host's biome pass reads it, in the host's own form
(Iris stores the platform's id for the biome), so it is a write rather than a layer a module could read back. It is general rather than a
floating-island call: any stage that makes a block belong elsewhere, such as an island floating over another biome, can set the biome it shows.
+1 -1
View File
@@ -182,7 +182,7 @@ block show that platform biome instead of its column's, inside the stage's own c
`ctx.settings().declaredBy(biomeId, Type.class)` reads what a biome declares itself, such as a cave biome of a `BiomeSample`, which is no level of
`at(...)`. A mantle stage's `ctx.terrain()` covers the chunk and the larger of its reach and 16 blocks around it; a chunk stage's `ctx.mantle()` covers the same area as its terrain. `ctx.mantle().blocks()` holds the blocks placements wrote into the mantle for the chunks to
take over, such as objects and structures; a chunk stage copies them in (Iris's `iris:matter`). `ctx.mantle().carved()` is the layer of voids the cave planner carved (`CarvedVoid`: `OPEN`, `FLUID`, `LAVA` or `AIR`, optionally with a biome), and
`isCarved(x, y, z)` asks whether one is there, whatever the chunk's blocks show. A chunk stage only reads both; a mantle stage plans the voids
`carved().get(x, y, z) != null` asks whether one is there, whatever the chunk's blocks show. A chunk stage only reads both; a mantle stage plans the voids
with `carved().set(...)`, and a chunk stage's write throws. A chunk stage may write the layers its module registered, inside
its own chunk's columns; around it, the mantle stays as the mantle stages left it. `blocks().oreFor(rock, ore)` gives the ore variant that suits the rock
(deepslate ores in deepslate), which the platform decides, and `PackBiome.vanillaBiome()` the biome vanilla's rules see a pack biome as.
@@ -38,15 +38,12 @@ public interface Mantle {
* Mantle stages write it ({@code set} plans a void, {@code remove} takes it back); a chunk stage only reads it, around
* its chunk as far as its mantle reaches, and its writes throw UnsupportedOperationException. A chunk stage takes the
* voids over into its chunk (Iris's {@code iris:carve} cuts them out of the terrain). The host owns this layer and keeps
* it in its own form, so it needs no registration. A dimension that keeps no mantle carves nothing.
* it in its own form, so it needs no registration. A dimension that keeps no mantle carves nothing. A stage that only
* asks whether a position is carved, whether or not the chunk's own blocks show it, such as under a dimension stacked
* above, tests {@code carved().get(x, y, z) != null}.
*/
MantleLayer<CarvedVoid> carved();
/** Whether the mantle holds a carved void at the position, whether or not the chunk's own blocks show it, such as
* under a dimension stacked above: the same as {@code carved().get(x, y, z) != null}, for a stage that only asks.
*/
boolean isCarved(int x, int y, int z);
/** Shows the block as platform biome {@code biome}, such as {@code minecraft:plains} or a pack's custom biome, instead
* of the biome its column generates as; the host's biome pass reads it when it writes the chunk's biomes. The host
* owns this layer and keeps it in its own form, so it is written only and needs no registration. A chunk stage
@@ -60,11 +60,6 @@ final class ChunkMantle implements Mantle {
return carved;
}
@Override
public boolean isCarved(int x, int y, int z) {
return mantle.isCarved(x, y, z);
}
@Override
public void setPlatformBiome(int x, int y, int z, ResourceId biome) {
requireOwnChunk(x, y, z);
@@ -140,12 +140,6 @@ final class PlacementViews {
return carved;
}
@Override
public boolean isCarved(int x, int y, int z) {
checkPosition(bounds(), x, y, z);
return parent.isCarved(x, y, z);
}
@Override
public void setPlatformBiome(int x, int y, int z, ResourceId biome) {
checkPosition(bounds(), x, y, z);
@@ -198,8 +198,6 @@ class ChunkPipelineTest {
public ModuleInfo info() { return ModuleInfo.of("test:caves", "Caves", "1"); }
public void setup(ModuleSetup setup) {
setup.stages().define(probe).run(context -> {
carved.add(String.valueOf(context.mantle().isCarved(6, 9, 2)));
carved.add(String.valueOf(context.mantle().isCarved(6, 10, 2)));
carved.add(String.valueOf(context.mantle().carved().get(6, 9, 2)));
carved.add(String.valueOf(context.mantle().carved().get(6, 10, 2)));
carved.add(assertThrows(UnsupportedOperationException.class,
@@ -216,7 +214,7 @@ class ChunkPipelineTest {
StageTimings.NONE);
var cannotCarve = "Carved voids are planned by mantle stages (Stage.mantle), not by chunk stages";
assertEquals(List.of("true", "false", CarvedVoid.OPEN.toString(), "null", cannotCarve, cannotCarve), carved);
assertEquals(List.of(CarvedVoid.OPEN.toString(), "null", cannotCarve, cannotCarve), carved);
}
@Test
@@ -38,7 +38,6 @@ public final class MemoryMantle {
public <T> MantleLayer<T> layer(MantleKey<T> key) { return new Layer<>(key, bounds, true); }
public MantleLayer<BlockState> blocks() { return new Layer<>(PLANNED_BLOCKS, bounds, false); }
public MantleLayer<CarvedVoid> carved() { return new Layer<>(CAVERNS, bounds, true); }
public boolean isCarved(int x, int y, int z) { return new Layer<>(CAVERNS, bounds, false).get(x, y, z) != null; }
public void setPlatformBiome(int x, int y, int z, ResourceId biome) {
if (!bounds.contains(x, y, z)) throw new IndexOutOfBoundsException("Outside the mantle view: " + x + "," + y + "," + z);
values(PLATFORM_BIOMES).put(new BlockPosition(x, y, z), biome);