Read settings per column with every level as its own entry, add the mantle pipeline, host types and the one-option shorthand

Settings no longer resolve to one value per type. FeatureSettings.at(type, x, z) returns one entry per
level that declares the type at that column (dimension, region, surface biome, placement), each with
its level, source and value; levels stack and a module decides what several mean. Conditional stage
bodies receive every configured entry. Chunk and mantle runners collect a chunk's settings themselves,
so a stage runs when any column of the chunk configures it.

Work that writes the mantle or reaches beyond its chunk moves to a new MANTLE pipeline (Stage.mantle,
MantleRunner) that the host runs around a chunk before it generates. Chunk stages may no longer declare
a reach or mantle writes and see the mantle read-only.

Built-in settings may hold host types the host describes itself (ModuleHost.describingHostTypesIn,
ValueKind.HostKind); pack modules cannot. FeatureSchema.shorthand() names the only option of settings
packs may write as a bare value.
This commit is contained in:
piexel committed 2026-10-08 11:31:03 +02:00
1 parent 09df1af88e
commit 97ac2a2982
61 files changed
+1316 -184

No files matched your search

@@ -0,0 +1,64 @@
package com.volmit.host;
import com.volmit.mantle.BlockBox;
import com.volmit.mantle.Mantle;
import com.volmit.mantle.MantleEdit;
import com.volmit.mantle.MantleKey;
import com.volmit.mantle.MantleLayer;
import com.volmit.mantle.MantleVisitor;
/** The mantle as chunk stages see it: reads pass through, every write throws. The mantle pipeline has
* finished around the chunk by then, and its neighbors may already be generated.
*/
final class ReadOnlyMantle implements Mantle {
private static final String READ_ONLY = "Chunk stages read the mantle but do not write it;"
+ " write it from a mantle stage (Stage.mantle), which runs before the chunks it reaches";
private final Mantle mantle;
ReadOnlyMantle(Mantle mantle) {
this.mantle = mantle;
}
@Override
public BlockBox bounds() {
return mantle.bounds();
}
@Override
public <T> MantleLayer<T> layer(MantleKey<T> key) {
return new ReadOnlyLayer<>(mantle.layer(key));
}
@Override
public MantleEdit edit() {
throw new UnsupportedOperationException(READ_ONLY);
}
private record ReadOnlyLayer<T>(MantleLayer<T> layer) implements MantleLayer<T> {
@Override
public T get(int x, int y, int z) {
return layer.get(x, y, z);
}
@Override
public void set(int x, int y, int z, T value) {
throw new UnsupportedOperationException(READ_ONLY);
}
@Override
public void remove(int x, int y, int z) {
throw new UnsupportedOperationException(READ_ONLY);
}
@Override
public void visit(BlockBox area, MantleVisitor<T> visitor) {
layer.visit(area, visitor);
}
@Override
public void clear(BlockBox area) {
throw new UnsupportedOperationException(READ_ONLY);
}
}
}