Mantle.caverns(): where the mantle carved voids for a chunk to take over, read-only like the planned blocks

This commit is contained in:
piexel committed 2026-10-10 18:05:50 +02:00
1 parent d2d746734f
commit f3d1ff8d13
5 files changed
+55

No files matched your search

@@ -111,6 +111,12 @@ final class PlacementViews {
bounds();
return new RestrictedMantleLayer<>(this, parent.blocks());
}
@Override
public MantleLayer<Boolean> caverns() {
bounds();
return new RestrictedMantleLayer<>(this, parent.caverns());
}
}
private static final class RestrictedMantleLayer<T> implements MantleLayer<T> {
@@ -36,6 +36,11 @@ final class ReadOnlyMantle implements Mantle {
return new ReadOnlyLayer<>(mantle.blocks());
}
@Override
public MantleLayer<Boolean> caverns() {
return new ReadOnlyLayer<>(mantle.caverns());
}
@Override
public MantleEdit edit() {
throw new UnsupportedOperationException(READ_ONLY);
@@ -32,6 +32,13 @@ public interface Mantle {
*/
MantleLayer<BlockState> blocks();
/** Where the mantle holds a carved void for the chunk to take over: a cave's air or fluid, planned before the chunks
* were generated. Present ({@code true}) at carved positions, absent elsewhere, also where the chunk's own blocks
* show no void, such as under a dimension stacked above. The host owns this layer, so it needs no registration.
* Stages read it only, and writes throw UnsupportedOperationException. A dimension that keeps no mantle holds none.
*/
MantleLayer<Boolean> caverns();
/** Only one edit may be active per view. Parent reads remain allowed, but parent
* mutations are prohibited until the edit ends (IllegalStateException).
*/