From ed8c33fca785430944a6a72e5e0d40ae0507b0eb Mon Sep 17 00:00:00 2001 From: piexel Date: Mon, 12 Oct 2026 02:19:37 +0200 Subject: [PATCH] iris:objects and iris:post only order after iris:carve; README --- README.md | 14 ++++++++--- .../mantle/components/ObjectModule.java | 3 ++- .../iris/engine/modifier/PostModule.java | 3 ++- .../floating/ResolvedFloatingChild.java | 23 +++++++++++++++---- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3c3ad9e5f..0ae66aff9 100644 --- a/README.md +++ b/README.md @@ -137,12 +137,12 @@ naming the class and what it uses. A VolmLib class that Iris's Bukkit jar strips `core/volmlib-left-out-of-bukkit-jar.txt`, which its shadowJar reads too) is on that classpath but missing on a server, so the check treats it as missing and fails the task naming it. `check` runs the task. -The jar holds `iris:post`, `iris:perfection` and `iris:matter`. They are written against IrisApi and +The jar holds `iris:post`, `iris:perfection`, `iris:matter` and `iris:carve`. They are written against IrisApi and `art.arcane.iris.builtin` alone: the chunk's `BlockState` hunk, the block registry's traits and `canPlaceOn`, the terrain sampler (heights around the chunk, slope, fluid height, where the upper dimension begins) and the mantle's planned blocks. Iris no longer compiles them in (`IrisModuleHost.generationModules()`), so a pack gets them by putting `iris-builtins.jar` into its `modules` folder; the built-ins that order after their stages (`iris:floating`, -`iris:decorant`, `iris:custom`) only order, so a pack without the jar still loads. Iris warns once per pack folder +`iris:objects`, `iris:decorant`, `iris:custom`) only order, so a pack without the jar still loads. Iris warns once per pack folder when a pack loads none of the jar's modules (`IrisModuleHost.JAR_MODULE_IDS`, which a test keeps equal to `builtin-modules.txt`): add a module to the jar and to that list together. @@ -150,4 +150,12 @@ when a pack loads none of the jar's modules (`IrisModuleHost.JAR_MODULE_IDS`, wh every other class: `IrisSeed` (Iris's per-feature world seeds, a facade Iris's worlds implement, so existing worlds generate the same) and `terrain.LayerBlocks` (the world's picks from the biomes' palette layers: terrain, caves and post pick from the same layers, and a layer's noise is built once per world by whichever asks first). `iris:post` reads its switches -(`postProcessingWalls`, `postProcessingSlabs`) and the biome's `wall` and `slab` as module settings through its context. \ No newline at end of file +(`postProcessingWalls`, `postProcessingSlabs`) and the biome's `wall` and `slab` as module settings through its context. + +`iris:carve` also reads the mantle's matter slices through `MatterMantle` (a facade Iris's mantle implements: the chunk of +`MatterCavern`s and markers it plans and applies, which the platform and the rest of Iris read as slices, not as module layers) and asks +`CaveDressing` for what the biome layers, decorators and fluid palette give a cave's walls, floor and ceiling. `CaveDressing` is +transitional: it goes when `iris:terrain` and `iris:decorant` are modules of the same jar and carve asks their classes directly. +A cave's dimension, region and biome settings are found by the id the layout's biome samples carry (`DeclaredByLevel`), its +absolute world Y bands convert with `PackWorld.minHeight()`, and its noise reads `NoiseSampler.signed(...)` (Iris's memoised signed read) +and `scaled(...)`. `caveLavaHeight` and `upperDimensionCarving` are its dimension settings. \ No newline at end of file diff --git a/src/main/java/art/arcane/iris/engine/mantle/components/ObjectModule.java b/src/main/java/art/arcane/iris/engine/mantle/components/ObjectModule.java index b4b572e9b..9566e8dfb 100644 --- a/src/main/java/art/arcane/iris/engine/mantle/components/ObjectModule.java +++ b/src/main/java/art/arcane/iris/engine/mantle/components/ObjectModule.java @@ -63,7 +63,8 @@ public final class ObjectModule implements IrisModule, ModuleLifecycle { @Override public void install(StageGraph graph) { - graph.define(IrisStages.Objects.PLACE).requires(IrisStages.Carve.CAVES).reach(this::reach).run(ObjectModule::place); + // Ordering only: iris:carve ships in the built-ins jar, which a pack may not have. + graph.define(IrisStages.Objects.PLACE).softAfter(IrisStages.Carve.CAVES.ref()).reach(this::reach).run(ObjectModule::place); } @Override diff --git a/src/main/java/art/arcane/iris/engine/modifier/PostModule.java b/src/main/java/art/arcane/iris/engine/modifier/PostModule.java index 7aa2578af..7b99a0856 100644 --- a/src/main/java/art/arcane/iris/engine/modifier/PostModule.java +++ b/src/main/java/art/arcane/iris/engine/modifier/PostModule.java @@ -45,6 +45,7 @@ public final class PostModule implements IrisModule { @Override public void install(StageGraph graph) { - graph.define(IrisStages.Post.SMOOTH).requires(IrisStages.Carve.APPLY).run(SurfaceSmoothing::smooth); + // Ordering only: iris:carve ships in the built-ins jar, which a pack may not have. + graph.define(IrisStages.Post.SMOOTH).softAfter(IrisStages.Carve.APPLY.ref()).run(SurfaceSmoothing::smooth); } } diff --git a/src/main/java/art/arcane/iris/engine/object/terrain/floating/ResolvedFloatingChild.java b/src/main/java/art/arcane/iris/engine/object/terrain/floating/ResolvedFloatingChild.java index 6949b9003..6001176fe 100644 --- a/src/main/java/art/arcane/iris/engine/object/terrain/floating/ResolvedFloatingChild.java +++ b/src/main/java/art/arcane/iris/engine/object/terrain/floating/ResolvedFloatingChild.java @@ -18,6 +18,8 @@ package art.arcane.iris.engine.object.terrain.floating; +import art.arcane.iris.builtin.carve.CarvingEntry; +import art.arcane.iris.builtin.carve.CarvingSettings; import art.arcane.iris.builtin.carve.CaveProfile; import art.arcane.iris.builtin.floating.FloatingChildBiome; import art.arcane.iris.core.loader.IrisData; @@ -28,8 +30,6 @@ import art.arcane.iris.engine.object.terrain.carving.CaveProfiles; import art.arcane.iris.engine.object.noise.IrisGeneratorStyle; import art.arcane.iris.engine.object.placement.IrisObjectPlacement; import art.arcane.iris.engine.object.prefab.IrisObjectScale; -import art.arcane.iris.engine.object.terrain.carving.ResolvedCarvingEntry; -import art.arcane.iris.engine.object.terrain.carving.CarvingResolver; import art.arcane.iris.engine.object.terrain.carving.CaveProfileSampler; import art.arcane.iris.engine.object.value.IRare; import art.arcane.iris.engine.object.world.biome.IrisBiome; @@ -37,6 +37,8 @@ import art.arcane.iris.util.project.noise.CNG; import art.arcane.volmlib.util.collection.KList; import art.arcane.volmlib.util.math.RNG; +import java.util.List; + /** * A {@link FloatingChildBiome} made ready for one engine: the noise its styles build (each from the world seed it is first * asked with), the edge taper profile, the biome it targets, the carving profile sampler and the objects it hosts. The @@ -157,10 +159,10 @@ public final class ResolvedFloatingChild implements IRare { return null; } - CarvingResolver resolver = CarvingResolver.of(engine.getGeneration().world()); - ResolvedCarvingEntry entry = resolver.index().get(carving); + CarvingEntry entry = dimensionCarvingEntry(carving, engine); if (entry != null) { - return resolver.entryBiome(entry) == null || data.getBiomeLoader() == null ? null : data.getBiomeLoader().load(entry.biomeKey().trim()); + String biomeKey = entry.biome().trim(); + return biomeKey.isEmpty() || data.getBiomeLoader() == null ? null : data.getBiomeLoader().load(biomeKey); } if (data.getBiomeLoader() == null) { @@ -170,6 +172,17 @@ public final class ResolvedFloatingChild implements IRare { return data.getBiomeLoader().load(carving); } + /** The dimension's carving entry with this id (the last of several with one id); null when it declares none. */ + private static CarvingEntry dimensionCarvingEntry(String id, Engine engine) { + CarvingEntry found = null; + for (CarvingEntry entry : engine.getDimension().getModuleSettings().find(CarvingSettings.class).map(CarvingSettings::entries).orElse(List.of())) { + if (entry != null && !entry.id().isBlank() && entry.id().trim().equals(id)) { + found = entry; + } + } + return found; + } + public KList resolveTopObjects(IrisBiome target) { KList surfaceObjects = (settings.inheritObjects() && target != null) ? target.getSurfaceObjects() : new KList<>(); return resolveTopObjectsFromSurface(surfaceObjects);