mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Place v3e's parts-based procedural objects like any object
Procedural objects are now definitions of parts in the pack's procedural/ folder (module resource kind iris:objects/procedural) that bake into variants; an object placement names them as procedural/<path>, or procedural/<path>#<index> for one variant. The v4-era proceduralObjects settings and their tests are gone. - TreeDefinitionIndex knows trees/ and the ids modules report as trees; ModuleServices merges only those. - Golden test: the 72 definitions of the overworld pack (fixture procedural-parts) bake as when the digests were taken, on a game-like block platform (GameLikeBlocks). - Fixtures pack-before-the-port, pack-terrain and pack-before-loot-and-spawn converted: their proceduralObjects became object placements, sets became placement snippets. - Tests follow: tree index, warm-up, placement reach, surface support.
This commit is contained in:
1 parent
d0ca502a56
commit
8be0597a36
106 files changed
+11165
-832
No files matched your search
@@ -197,13 +197,10 @@ public final class ModuleServices {
|
||||
/** The objects every module places as trees. */
|
||||
public static SaplingGrowth.TreeObjects treeObjects(Engine engine) {
|
||||
Set<ResourceId> objects = new LinkedHashSet<>();
|
||||
Set<ResourceId> procedural = new LinkedHashSet<>();
|
||||
for (Provider<SaplingGrowth> provider : providers(engine, SaplingGrowth.class)) {
|
||||
SaplingGrowth.TreeObjects trees = provider.service().treeObjects(provider.world());
|
||||
objects.addAll(trees.objects());
|
||||
procedural.addAll(trees.procedural());
|
||||
objects.addAll(provider.service().treeObjects(provider.world()).objects());
|
||||
}
|
||||
return new SaplingGrowth.TreeObjects(objects, procedural);
|
||||
return new SaplingGrowth.TreeObjects(objects);
|
||||
}
|
||||
|
||||
/** What the first module with something to spawn at {@code site} plans; empty when none does. */
|
||||
|
||||
@@ -9,22 +9,21 @@ import com.volmit.service.SaplingGrowth;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/** Tells tree placements from others: objects in {@code trees/}, and every object a module says it places as a tree. */
|
||||
public final class TreeDefinitionIndex {
|
||||
private static final String PROCEDURAL_TREE_PREFIX = "procedural/tree/";
|
||||
private static final String TREE_FOLDER = "trees/";
|
||||
|
||||
private final PackResources resources;
|
||||
private final Set<ResourceId> explicitObjects;
|
||||
private final Set<ResourceId> proceduralTrees;
|
||||
private final Set<ResourceId> treeObjects;
|
||||
|
||||
private TreeDefinitionIndex(PackResources resources, Set<ResourceId> explicitObjects, Set<ResourceId> proceduralTrees) {
|
||||
private TreeDefinitionIndex(PackResources resources, Set<ResourceId> treeObjects) {
|
||||
this.resources = resources;
|
||||
this.explicitObjects = Set.copyOf(explicitObjects);
|
||||
this.proceduralTrees = Set.copyOf(proceduralTrees);
|
||||
this.treeObjects = Set.copyOf(treeObjects);
|
||||
}
|
||||
|
||||
public static TreeDefinitionIndex build(Engine engine) {
|
||||
SaplingGrowth.TreeObjects trees = ModuleServices.treeObjects(engine);
|
||||
return new TreeDefinitionIndex(engine.getData().getPackResources(), trees.objects(), trees.procedural());
|
||||
return new TreeDefinitionIndex(engine.getData().getPackResources(), trees.objects());
|
||||
}
|
||||
|
||||
public boolean isTreeMarker(String marker) {
|
||||
@@ -34,12 +33,6 @@ public final class TreeDefinitionIndex {
|
||||
}
|
||||
|
||||
String objectKey = decoded.objectKey();
|
||||
if (objectKey.startsWith(PROCEDURAL_TREE_PREFIX)) {
|
||||
return proceduralTrees.contains(resources.idOf(objectKey));
|
||||
}
|
||||
if (objectKey.startsWith("procedural/")) {
|
||||
return false;
|
||||
}
|
||||
return objectKey.startsWith("trees/") || explicitObjects.contains(resources.idOf(objectKey));
|
||||
return objectKey.startsWith(TREE_FOLDER) || treeObjects.contains(resources.idOf(objectKey));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user