Run each mantle stage as its own pass and let mantle stages work out their reach per pack

MantleRunner.generate(stage, inputs, seed) runs one mantle stage for one chunk. The host runs every
mantle stage as its own pass in resolved order, so a stage sees what earlier stages wrote into the
chunks around it. Activation still follows requires(...): the runner collects the settings of the stage
and of everything it requires, and only those. Because the stages of one chunk now run in different
invocations, mantle stages have no output (Stage.mantle declares Void) and pass data on through
mantle layers.

A mantle stage whose reach depends on the pack declares reach(PackReach). The host works it out once
per pack load from PackSettings, every entry the dimension and its regions and biomes declare, with
ResolvedStage.reachBlocks(settings); a negative result fails naming the stage. Placement and chunk
stages may not declare one, and ResolvedGraph.reach() throws for a mantle pipeline that has one.
VeinModule now sizes its reach from the pack's longest vein.
This commit is contained in:
piexel committed 2026-10-08 12:35:04 +02:00
1 parent 97ac2a2982
commit 50f51db8b2
25 files changed
+410 -89

No files matched your search

+10 -7
View File
@@ -22,7 +22,7 @@ types that carry them and lists what the Iris adapter still owes.
| Reference execution | host `PlacementRunner`, `ChunkRunner`, `MantleRunner` |
| Work across chunks and mantle writes | `Stage.mantle`, `MantleStage`, `MantleStageContext`, `MantleGenerationContext`; chunk stages read the mantle only |
| Annotated settings | `IrisFeature`, `@Feature` (id as JSON key, built-in alias), config annotations, `OptionsMetadata` |
| Area a stage writes | `reach(blocks)`, `writesMantle(...)` on stage definitions, host `StageReach`, `PipelineReach` |
| Area a stage writes | `reach(blocks)`, `reach(PackReach)`, `writesMantle(...)` on stage definitions, `PackSettings`, host `StageReach`, `ResolvedStage.reachBlocks`, `PipelineReach` |
| Settings described for studio | `@Desc`, `@Required`, `@MinNumber`, `@MaxNumber`, `@Snippet`, `@Ref`/`Reference`, `FeatureRegistry.registerSettings`, host `LoadedPack.schema()` (`PackSchema`, `FeatureSchema` with `shorthand()`, `ObjectType`, `SchemaOption`, `ValueKind` with `HostKind`), `ModuleHost.describingHostTypesIn` |
| Geometry and mantle registration | `FeatureRegistry`, host `ModuleRegistry`, `FeatureCatalog` |
| Block states and palettes | `BlockState`, `BlockRegistry`, `BlockPalette` |
@@ -90,12 +90,15 @@ running Iris is the pack publisher's responsibility.
work inside the ported stages.
- Derive one seed per placement (world seed and the placement's stable identity) and per chunk
(world seed and chunk position) and pass it to `PlacementRunner.place` / `ChunkRunner.generate`.
- Prepare the area a placement or chunk may read or write, including neighbors: the pipeline's
`reach()` around the chunk or the placed object's bounds, each mantle layer by its own maximum.
Never clip.
- Run the mantle pipeline (`MantleRunner`) for every chunk within its reach of a chunk, each chunk once,
before that chunk generates, with the mantle widened by the reach. Give chunk stages that chunk's
mantle; `ChunkRunner` makes it read-only.
- Prepare the area a placement may read or write, including neighbors: the placement pipeline's
`reach()` around the placed object's bounds, each mantle layer by its own maximum. Never clip.
- Work out each mantle stage's reach once per pack load (`ResolvedStage.reachBlocks(PackSettings)`),
answering `PackSettings.declared(type)` with every entry of the dimension and of the regions and
biomes it can reach.
- Run each mantle stage (`MantleRunner.generate(stage, ...)`) as its own pass, in resolved order: for
every chunk within that stage's reach plus the reach of every later stage of a chunk, each chunk once,
before the next stage and before that chunk generates, with the mantle widened by the stage's reach.
Give chunk stages that chunk's mantle; `ChunkRunner` makes it read-only.
- Make placement edits atomic across blocks, block entities, markers and mantle in generation
storage. Abort chunk publication when any stage fails.
- Preserve unknown persisted mantle layers or fail explicitly.