mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
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:
1 parent
2d63a9aaa4
commit
182bb12cbc
6 files changed
+19
-26
No files matched your search
@@ -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`,
|
||||
|
||||
@@ -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);
|
||||
|
||||
+1
-8
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user