iris:objects and iris:post only order after iris:carve; README

This commit is contained in:
piexel committed 2026-10-12 02:19:37 +02:00
1 parent 703f206248
commit ed8c33fca7
4 files changed
+32 -9

No files matched your search

+10 -2
View File
@@ -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 `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. 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 `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. 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 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-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 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. `builtin-modules.txt`): add a module to the jar and to that list together.
@@ -151,3 +151,11 @@ every other class: `IrisSeed` (Iris's per-feature world seeds, a facade Iris's w
same) and `terrain.LayerBlocks` (the world's picks from the biomes' palette layers: terrain, caves and post pick from the same 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 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. (`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.
@@ -63,7 +63,8 @@ public final class ObjectModule implements IrisModule, ModuleLifecycle {
@Override @Override
public void install(StageGraph graph) { 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 @Override
@@ -45,6 +45,7 @@ public final class PostModule implements IrisModule {
@Override @Override
public void install(StageGraph graph) { 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);
} }
} }
@@ -18,6 +18,8 @@
package art.arcane.iris.engine.object.terrain.floating; 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.carve.CaveProfile;
import art.arcane.iris.builtin.floating.FloatingChildBiome; import art.arcane.iris.builtin.floating.FloatingChildBiome;
import art.arcane.iris.core.loader.IrisData; 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.noise.IrisGeneratorStyle;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement; import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.prefab.IrisObjectScale; 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.terrain.carving.CaveProfileSampler;
import art.arcane.iris.engine.object.value.IRare; import art.arcane.iris.engine.object.value.IRare;
import art.arcane.iris.engine.object.world.biome.IrisBiome; 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.collection.KList;
import art.arcane.volmlib.util.math.RNG; 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 * 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 * 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; return null;
} }
CarvingResolver resolver = CarvingResolver.of(engine.getGeneration().world()); CarvingEntry entry = dimensionCarvingEntry(carving, engine);
ResolvedCarvingEntry entry = resolver.index().get(carving);
if (entry != null) { 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) { if (data.getBiomeLoader() == null) {
@@ -170,6 +172,17 @@ public final class ResolvedFloatingChild implements IRare {
return data.getBiomeLoader().load(carving); 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<IrisObjectPlacement> resolveTopObjects(IrisBiome target) { public KList<IrisObjectPlacement> resolveTopObjects(IrisBiome target) {
KList<IrisObjectPlacement> surfaceObjects = (settings.inheritObjects() && target != null) ? target.getSurfaceObjects() : new KList<>(); KList<IrisObjectPlacement> surfaceObjects = (settings.inheritObjects() && target != null) ? target.getSurfaceObjects() : new KList<>();
return resolveTopObjectsFromSurface(surfaceObjects); return resolveTopObjectsFromSurface(surfaceObjects);