diff --git a/README.md b/README.md index 8de696f27..b51dcd8c5 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,14 @@ provides `ObjectsAt` (the objects a chunk would get, for the object search and s provides `StructureLocator` (`StructureLocating`: the pack's structure keys for Iris's structure index, the ones a world places, and their nearest start for the find commands). `iris:structure` also has a lifecycle hook that drops a world's structure index when the world stops, which includes every reload of the pack's structure files. +`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: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`, +folders `spawners`, `entities`, `markers`) and provides `EntitySpawns` (`EntitySpawning`: what to spawn in a chunk or at +a marker, as `EntitySpec`s; `EntityResolution` makes the entity's random choices). Iris's Bukkit code creates the items +and entities from those values (`BukkitItemStacks`, `BukkitEntitySpawner`). `iris:decorant` keeps its per-world `Decorating` in the world's state store (`context.world().state(...)`); the other built-ins still reach the same store through `IrisChunk.state(...)` / `engine.getGeneration().state(...)`. diff --git a/src/main/java/art/arcane/iris/engine/mantle/components/TreeGrowing.java b/src/main/java/art/arcane/iris/engine/mantle/components/TreeGrowing.java index 1bcfe3226..40dee1a6d 100644 --- a/src/main/java/art/arcane/iris/engine/mantle/components/TreeGrowing.java +++ b/src/main/java/art/arcane/iris/engine/mantle/components/TreeGrowing.java @@ -41,7 +41,6 @@ import com.volmit.placement.PlacedBlock; import com.volmit.service.SaplingGrowth; import com.volmit.world.BlockPosition; import com.volmit.world.PackWorld; -import org.bukkit.TreeType; import java.util.ArrayList; import java.util.HashSet; @@ -100,19 +99,18 @@ public final class TreeGrowing implements SaplingGrowth { /** One placement, picked at random, of the tree placements that grow {@code sapling}'s species; null for none. */ private static IrisObjectPlacement pickPlacement(Engine engine, Sapling sapling) { - TreeType species = TreeType.valueOf(sapling.species()); KList placements = new KList<>(); boolean useAll = engine.getDimension().getTreeSettings().getMode().equals(IrisTreeModes.ALL); BlockPosition at = sapling.at(); - placements.addAll(matching(engine.getBiome(at.x(), at.y(), at.z()).getObjects(), species)); + placements.addAll(matching(engine.getBiome(at.x(), at.y(), at.z()).getObjects(), sapling.species())); if (useAll || placements.isEmpty()) { - placements.addAll(matching(engine.getRegion(at.x(), at.z()).getObjects(), species)); + placements.addAll(matching(engine.getRegion(at.x(), at.z()).getObjects(), sapling.species())); } return placements.isNotEmpty() ? placements.getRandom() : null; } - private static KList matching(KList objects, TreeType species) { + private static KList matching(KList objects, String species) { KList matches = new KList<>(); for (IrisObjectPlacement placement : objects) { if (placement.matches(SAPLING_SIZE, species)) { diff --git a/src/main/java/art/arcane/iris/engine/object/placement/IrisObjectPlacement.java b/src/main/java/art/arcane/iris/engine/object/placement/IrisObjectPlacement.java index f63e0fa69..3b6559a38 100644 --- a/src/main/java/art/arcane/iris/engine/object/placement/IrisObjectPlacement.java +++ b/src/main/java/art/arcane/iris/engine/object/placement/IrisObjectPlacement.java @@ -272,6 +272,11 @@ public class IrisObjectPlacement { return g.getData().getObjectLoader().load(place.get(random.nextInt(place.size()))); } + /** Whether a tree placement grows the species the platform calls {@code species} for a sapling area of {@code size}. */ + public boolean matches(IrisTreeSize size, String species) { + return matches(size, TreeType.valueOf(species)); + } + public boolean matches(IrisTreeSize size, TreeType type) { for (IrisTree i : getTrees()) { if (i.matches(size, type)) {