mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 09:44:24 +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.
|
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
|
`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).
|
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
|
`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
|
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`,
|
table gives) and `BlockDrops` (`BlockDropping`). `iris:spawn` owns spawners, entities and markers (`SpawnResources`,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
* <p>
|
* <p>
|
||||||
* Besides those, it holds what the compiled-in built-ins and the built-ins jar must share, since each sees its own copy
|
* 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
|
* 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.
|
* ({@link art.arcane.iris.builtin.terrain.LayerBlocks}). Keep them few: each is a promise.
|
||||||
* <p>
|
* <p>
|
||||||
* Some built-in stages produce Iris's own types, such as the placement settings of {@code iris:prepare}. A
|
* 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,
|
private void placeProceduralVariant(ProceduralPlacement placement, PlaceableObject variant, String scope, CaveProfile caveProfile,
|
||||||
CaveAnchors.Search search, CaveAnchors.Anchor anchor, int x, int z, int id) {
|
CaveAnchors.Search search, CaveAnchors.Anchor anchor, int x, int z, int id) {
|
||||||
String goldenTag = golden ? scope + "/" + placement.name() : null;
|
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;
|
int resultY;
|
||||||
String commit = "n/a";
|
String commit = "n/a";
|
||||||
if (anchor != null) {
|
if (anchor != null) {
|
||||||
@@ -556,11 +556,10 @@ final class ChunkObjectPlacing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlacementTags tags(PlaceableObject object, int id, String context, boolean treePlacement, PlacementSource placement) {
|
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,
|
private PlacementTags tags(PlaceableObject object, int id, String context, boolean treePlacement, boolean buriedTreasure) {
|
||||||
boolean buriedTreasure) {
|
|
||||||
return new PlacementTags(placementMarker(object, id, context), treePlacement, buriedTreasure);
|
return new PlacementTags(placementMarker(object, id, context), treePlacement, buriedTreasure);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,15 +607,15 @@ final class ChunkObjectPlacing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void logCaveDiagnostics(Column column) {
|
private void logCaveDiagnostics(Column column) {
|
||||||
CarvedCount carved = new CarvedCount();
|
int carvedBlocks = 0;
|
||||||
int maxY = Math.min(worldHeight - 1, column.surfaceY() - DIAGNOSTIC_SURFACE_MARGIN);
|
int maxY = Math.min(worldHeight - 1, column.surfaceY() - DIAGNOSTIC_SURFACE_MARGIN);
|
||||||
for (int y = 1; y < maxY; y++) {
|
for (int y = 1; y < maxY; y++) {
|
||||||
if (chunk.carved().isCarved(centerX, y, centerZ)) {
|
if (chunk.carved().isCarved(centerX, y, centerZ)) {
|
||||||
carved.blocks++;
|
carvedBlocks++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.debug("Cave object diag: chunk=" + chunkX + "," + chunkZ + " surfaceBiome=" + column.surface() + " caveBiome=" + column.cave()
|
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()
|
+ " biomeCarvingObjects=" + carvingObjects(column.objects().cave()).size()
|
||||||
+ " regionCarvingObjects=" + carvingObjects(column.objects().region()).size()
|
+ " regionCarvingObjects=" + carvingObjects(column.objects().region()).size()
|
||||||
+ " sameBiome=" + column.cave().equals(column.surface()));
|
+ " sameBiome=" + column.cave().equals(column.surface()));
|
||||||
@@ -649,10 +648,6 @@ final class ChunkObjectPlacing {
|
|||||||
private record ColumnProfiles(CaveProfile surface, CaveProfile cave, CaveProfile region) {
|
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. */
|
/** What placing the objects of a chunk came to. */
|
||||||
private static final class Tally {
|
private static final class Tally {
|
||||||
private final java.util.Map<String, int[]> scopes = new java.util.LinkedHashMap<>();
|
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);
|
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) {
|
private PlacementChanges withDimensionSurfaceSupport(PlacementSource placement, PlacementChanges changes) {
|
||||||
boolean require = placement.requireSurfaceSupport() && dimensionRequiresSurfaceSupport;
|
boolean require = placement.requireSurfaceSupport() && dimensionRequiresSurfaceSupport;
|
||||||
int buffer = Math.max(placement.surfaceSupportBuffer(), dimensionSurfaceSupportBuffer);
|
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. */
|
/** The procedural objects a region or biome declares, each made placeable once, in the order the settings list them. */
|
||||||
public final class ResolvedProceduralObjects {
|
public final class ResolvedProceduralObjects {
|
||||||
private final KList<IrisProceduralPlacement> all = new KList<>();
|
private final KList<IrisProceduralPlacement> all = new KList<>();
|
||||||
private final KList<ResolvedTree> trees = new KList<>();
|
|
||||||
|
|
||||||
public ResolvedProceduralObjects(ProceduralObjectSettings settings) {
|
public ResolvedProceduralObjects(ProceduralObjectSettings settings) {
|
||||||
for (Tree tree : settings.trees()) {
|
for (Tree tree : settings.trees()) {
|
||||||
ResolvedTree resolved = new ResolvedTree(tree);
|
all.add(new ResolvedTree(tree));
|
||||||
trees.add(resolved);
|
|
||||||
all.add(resolved);
|
|
||||||
}
|
}
|
||||||
addAll(settings.ruins(), ResolvedRuin::new);
|
addAll(settings.ruins(), ResolvedRuin::new);
|
||||||
addAll(settings.formations(), ResolvedFormation::new);
|
addAll(settings.formations(), ResolvedFormation::new);
|
||||||
@@ -59,10 +56,6 @@ public final class ResolvedProceduralObjects {
|
|||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KList<ResolvedTree> getTrees() {
|
|
||||||
return trees;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return all.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.builtin.objects.tree.Tree;
|
||||||
import art.arcane.iris.core.loader.IrisData;
|
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.prefab.IrisObject;
|
||||||
import art.arcane.iris.engine.object.procedural.ResolvedProceduralPlacement;
|
import art.arcane.iris.engine.object.procedural.ResolvedProceduralPlacement;
|
||||||
import art.arcane.iris.spi.IrisLogging;
|
import art.arcane.iris.spi.IrisLogging;
|
||||||
@@ -48,10 +47,6 @@ public final class ResolvedTree extends ResolvedProceduralPlacement {
|
|||||||
return Tree.variantLoadKey(settings.name(), index);
|
return Tree.variantLoadKey(settings.name(), index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tree settings() {
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPlausible() {
|
public boolean isPlausible() {
|
||||||
return settings.plausible();
|
return settings.plausible();
|
||||||
|
|||||||
Reference in new issue
Block a user