iris:objects docs for the objects facade; ResolvedTree and ResolvedProceduralObjects drop what nothing reads; EffectivePlacements says what the dimension really does

This commit is contained in:
piexel committed 2026-10-15 07:08:44 +02:00
1 parent 2d63a9aaa4
commit 182bb12cbc
6 files changed
+19 -26

No files matched your search

@@ -29,7 +29,7 @@
* <p>
* 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.
* <p>
* Some built-in stages produce Iris's own types, such as the placement settings of {@code iris:prepare}. A
@@ -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<String, int[]> scopes = new java.util.LinkedHashMap<>();
@@ -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);
@@ -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<IrisProceduralPlacement> all = new KList<>();
private final KList<ResolvedTree> 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<ResolvedTree> getTrees() {
return trees;
}
public boolean isEmpty() {
return all.isEmpty();
}
@@ -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();