mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
Batch 1 of the API review: one setup entry point, per-pipeline definitions
- IrisModule.setup(ModuleSetup) replaces install(StageGraph) and register(FeatureRegistry); ModuleSetups.run is the host entry point. - The conditional definition variants are gone: a stage body reads the settings it is conditioned on through ctx.configured(Type.class). - Placement, block, chunk and mantle stages each get their own definition interface; chunk definitions offer neither reach nor writesMantle. MantleStage is no longer generic. - softAfter/softBefore take stage constants as well as StageRefs. - A producer that rejected the attempt may return null. - PlacementRunner, ChunkRunner and MantleRunner all take StageTimings. - ConfiguredSettings groups entries by the type that declares @Feature. - README, DESIGN and CONTRACTS updated, with the edge choice table.
This commit is contained in:
1 parent
d3c0e4d6cc
commit
1677f4414b
75 files changed
+1201
-838
No files matched your search
@@ -2,16 +2,14 @@ package com.volmit.example.placement;
|
||||
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.ModuleSetup;
|
||||
import com.volmit.object.ObjectBlock;
|
||||
import com.volmit.placement.PlacedBlock;
|
||||
import com.volmit.stage.BlockStage;
|
||||
import com.volmit.stage.PlacementStage;
|
||||
import com.volmit.stage.PlacementStageContext;
|
||||
import com.volmit.stage.Stage;
|
||||
import com.volmit.stage.StageGraph;
|
||||
import com.volmit.world.BlockPosition;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/** Port of PlacementModuleStilt: collect the lowest layer per block, then fill down after writes. */
|
||||
@@ -25,19 +23,20 @@ public final class StiltModule implements IrisModule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void install(StageGraph graph) {
|
||||
graph.define(BOUNDS)
|
||||
public void setup(ModuleSetup setup) {
|
||||
var stages = setup.stages();
|
||||
stages.define(BOUNDS)
|
||||
.when(StiltSettings.class)
|
||||
.requires(PrepareModule.ROTATE, AnchorModule.HEIGHT)
|
||||
.accumulate(StiltBounds::new, (context, stilt, bounds) -> bounds.include(context.block()));
|
||||
graph.define(FILL)
|
||||
.accumulate(StiltBounds::new, (context, bounds) -> bounds.include(context.block()));
|
||||
stages.define(FILL)
|
||||
.when(StiltSettings.class)
|
||||
.requires(BOUNDS, BlocksModule.COMPLETE)
|
||||
.run(StiltModule::fill);
|
||||
}
|
||||
|
||||
private static void fill(PlacementStageContext context, List<Entry<StiltSettings>> settings) {
|
||||
var stilt = settings.getFirst().value(); // a placement declares its settings once
|
||||
private static void fill(PlacementStageContext context) {
|
||||
var stilt = context.configured(StiltSettings.class).getFirst().value(); // a placement declares its settings once
|
||||
var anchor = context.output(AnchorModule.HEIGHT);
|
||||
for (var block : context.output(BOUNDS).lowestLayer()) {
|
||||
var bottom = anchor.worldPosition(context.request(), block.position());
|
||||
|
||||
Reference in new issue
Block a user