diff --git a/README.md b/README.md index 3c3ad9e5f..3bc9a7759 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,16 @@ chunk it reaches and every restart fits it the same way. Object place modes are stilt, `VacuumProfile`, `PlaceTrait`s) that the placement stages ask; the pack JSON keeps the mode names. `iris:objects` also provides `SaplingGrowth` (`TreeGrowing`: the tree a sapling grows into, as placed blocks, and which objects are trees) and says which biomes and regions place an object (`ObjectLocating`, for the object search). +`iris:objects` ships in the built-ins jar. It declares the settings `objects` (region, biome: the list of `ObjectPlacement`s), +`proceduralObjects` (region, biome), `treeSettings` (dimension), `requireObjectSurfaceSupport`, `objectSurfaceSupportBuffer`, +`upperDimensionObjects` and `upperObjectsForcePlace` (dimension), all written as they always were. `ObjectPlacement` describes +the same JSON as Iris's `IrisObjectPlacement` and keeps the JSON it was read from, because Iris's placement stages still read +a placement as their own class (`ObjectPlacements.host`). What a jar cannot do, Iris does through the facades `ObjectHost` and +`ObjectChunk` in `art.arcane.iris.builtin.objects`: loading and scaling the pack's objects, placing one with the placement +stages into the chunk's mantle (on the surface, in a cave inside the cave's bounds, or hung from the terrain above), reading the +carved space the cave carver planned, and the layout around a position. `ObjectPlacing` and its helpers (`ChunkObjectPlacing`, +`CaveAnchors`, `PlacementReach`) decide what to place and where. The procedural generators (`engine/object/procedural`) stay +compiled in, behind `ProceduralPlacement`, until they build `GeneratedObject`s instead of Iris objects. `iris:loot` owns the loot table resource kind (`LootResources`, folder `loot`), checks the tables and the references to them (`LootValidator`), and provides `Loot` (`LootGiving`: which tables a container draws from and the `ItemDrop`s a table gives) and `BlockDrops` (`BlockDropping`). `iris:spawn` owns spawners, entities and markers (`SpawnResources`, diff --git a/src/main/java/art/arcane/iris/builtin/package-info.java b/src/main/java/art/arcane/iris/builtin/package-info.java index 4e62e77b1..b609b5b97 100644 --- a/src/main/java/art/arcane/iris/builtin/package-info.java +++ b/src/main/java/art/arcane/iris/builtin/package-info.java @@ -29,7 +29,7 @@ *

* Besides those, it holds what the compiled-in built-ins and the built-ins jar must share, since each sees its own copy * of every other class: narrow facades only Iris's own built-ins use, interfaces Iris's worlds implement - * ({@link art.arcane.iris.builtin.IrisSeed}), and per-world state several of them use + * ({@link art.arcane.iris.builtin.IrisSeed}, {@link art.arcane.iris.builtin.objects.ObjectHost}), and per-world state several of them use * ({@link art.arcane.iris.builtin.terrain.LayerBlocks}). Keep them few: each is a promise. *

* Some built-in stages produce Iris's own types, such as the placement settings of {@code iris:prepare}. A diff --git a/src/main/java/art/arcane/iris/engine/mantle/components/ChunkObjectPlacing.java b/src/main/java/art/arcane/iris/engine/mantle/components/ChunkObjectPlacing.java index 677f0aba4..eb8338d9e 100644 --- a/src/main/java/art/arcane/iris/engine/mantle/components/ChunkObjectPlacing.java +++ b/src/main/java/art/arcane/iris/engine/mantle/components/ChunkObjectPlacing.java @@ -461,7 +461,7 @@ final class ChunkObjectPlacing { private void placeProceduralVariant(ProceduralPlacement placement, PlaceableObject variant, String scope, CaveProfile caveProfile, CaveAnchors.Search search, CaveAnchors.Anchor anchor, int x, int z, int id) { String goldenTag = golden ? scope + "/" + placement.name() : null; - PlacementTags tags = tags(variant, id, "procedural", placement.tree(), placement, false); + PlacementTags tags = tags(variant, id, "procedural", placement.tree(), false); int resultY; String commit = "n/a"; if (anchor != null) { @@ -556,11 +556,10 @@ final class ChunkObjectPlacing { } private PlacementTags tags(PlaceableObject object, int id, String context, boolean treePlacement, PlacementSource placement) { - return tags(object, id, context, treePlacement, placement, placement.isDolphinTarget() && placement.underwater()); + return tags(object, id, context, treePlacement, placement.isDolphinTarget() && placement.underwater()); } - private PlacementTags tags(PlaceableObject object, int id, String context, boolean treePlacement, PlacementSource placement, - boolean buriedTreasure) { + private PlacementTags tags(PlaceableObject object, int id, String context, boolean treePlacement, boolean buriedTreasure) { return new PlacementTags(placementMarker(object, id, context), treePlacement, buriedTreasure); } @@ -608,15 +607,15 @@ final class ChunkObjectPlacing { } private void logCaveDiagnostics(Column column) { - CarvedCount carved = new CarvedCount(); + int carvedBlocks = 0; int maxY = Math.min(worldHeight - 1, column.surfaceY() - DIAGNOSTIC_SURFACE_MARGIN); for (int y = 1; y < maxY; y++) { if (chunk.carved().isCarved(centerX, y, centerZ)) { - carved.blocks++; + carvedBlocks++; } } log.debug("Cave object diag: chunk=" + chunkX + "," + chunkZ + " surfaceBiome=" + column.surface() + " caveBiome=" + column.cave() - + " surfaceY=" + column.surfaceY() + " maxAnchorY=" + maxY + " carvedAtCenter=" + carved.blocks + + " surfaceY=" + column.surfaceY() + " maxAnchorY=" + maxY + " carvedAtCenter=" + carvedBlocks + " biomeCarvingObjects=" + carvingObjects(column.objects().cave()).size() + " regionCarvingObjects=" + carvingObjects(column.objects().region()).size() + " sameBiome=" + column.cave().equals(column.surface())); @@ -649,10 +648,6 @@ final class ChunkObjectPlacing { private record ColumnProfiles(CaveProfile surface, CaveProfile cave, CaveProfile region) { } - private static final class CarvedCount { - private int blocks; - } - /** What placing the objects of a chunk came to. */ private static final class Tally { private final java.util.Map scopes = new java.util.LinkedHashMap<>(); diff --git a/src/main/java/art/arcane/iris/engine/mantle/components/EffectivePlacements.java b/src/main/java/art/arcane/iris/engine/mantle/components/EffectivePlacements.java index 22315d331..6979b60f1 100644 --- a/src/main/java/art/arcane/iris/engine/mantle/components/EffectivePlacements.java +++ b/src/main/java/art/arcane/iris/engine/mantle/components/EffectivePlacements.java @@ -78,7 +78,7 @@ final class EffectivePlacements { return key.toLowerCase(Locale.ROOT).contains(IMPORTS_FOLDER); } - /** The dimension acts as the floor: it can force support on and widen the buffer, never weaken either. */ + /** The dimension widens the buffer of a placement, never narrows it, and its support requirement applies on top of the placement's own: both have to want it. */ private PlacementChanges withDimensionSurfaceSupport(PlacementSource placement, PlacementChanges changes) { boolean require = placement.requireSurfaceSupport() && dimensionRequiresSurfaceSupport; int buffer = Math.max(placement.surfaceSupportBuffer(), dimensionSurfaceSupportBuffer); diff --git a/src/main/java/art/arcane/iris/engine/object/procedural/ResolvedProceduralObjects.java b/src/main/java/art/arcane/iris/engine/object/procedural/ResolvedProceduralObjects.java index e2109ace6..1c294004e 100644 --- a/src/main/java/art/arcane/iris/engine/object/procedural/ResolvedProceduralObjects.java +++ b/src/main/java/art/arcane/iris/engine/object/procedural/ResolvedProceduralObjects.java @@ -34,13 +34,10 @@ import java.util.function.Function; /** The procedural objects a region or biome declares, each made placeable once, in the order the settings list them. */ public final class ResolvedProceduralObjects { private final KList all = new KList<>(); - private final KList trees = new KList<>(); public ResolvedProceduralObjects(ProceduralObjectSettings settings) { for (Tree tree : settings.trees()) { - ResolvedTree resolved = new ResolvedTree(tree); - trees.add(resolved); - all.add(resolved); + all.add(new ResolvedTree(tree)); } addAll(settings.ruins(), ResolvedRuin::new); addAll(settings.formations(), ResolvedFormation::new); @@ -59,10 +56,6 @@ public final class ResolvedProceduralObjects { return all; } - public KList getTrees() { - return trees; - } - public boolean isEmpty() { return all.isEmpty(); } diff --git a/src/main/java/art/arcane/iris/engine/object/procedural/tree/ResolvedTree.java b/src/main/java/art/arcane/iris/engine/object/procedural/tree/ResolvedTree.java index 36b493834..3a6004d29 100644 --- a/src/main/java/art/arcane/iris/engine/object/procedural/tree/ResolvedTree.java +++ b/src/main/java/art/arcane/iris/engine/object/procedural/tree/ResolvedTree.java @@ -20,7 +20,6 @@ package art.arcane.iris.engine.object.procedural.tree; import art.arcane.iris.builtin.objects.tree.Tree; import art.arcane.iris.core.loader.IrisData; -import art.arcane.iris.engine.object.placement.IrisObjectPlacement; import art.arcane.iris.engine.object.prefab.IrisObject; import art.arcane.iris.engine.object.procedural.ResolvedProceduralPlacement; import art.arcane.iris.spi.IrisLogging; @@ -48,10 +47,6 @@ public final class ResolvedTree extends ResolvedProceduralPlacement { return Tree.variantLoadKey(settings.name(), index); } - public Tree settings() { - return settings; - } - @Override public boolean isPlausible() { return settings.plausible();