mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 09:44:24 +00:00
Core reads structure placements from settings; package exports leave structures to their own closure
ModuleResourceClosure.exportingElsewhere(type) names the resources of a kind another exporter writes: IrisPackageCompiler and the modded studio export take the placed structure keys from it, and StructurePackageClosure still copies structures with their pools, pieces and loot. SchemaBuilder loses the RegistryListStructure branches and StructureSchemaKeys. Tests build placements as packs write them (StructurePlacementFixtures); a decoding test pins the overworld's ancient city placement and an anonymous cave placement to the identities and starts the old classes gave.
This commit is contained in:
1 parent
7d9fd3faa6
commit
57d5a65c57
26 files changed
+770
-711
No files matched your search
+3
-20
@@ -38,7 +38,7 @@ import art.arcane.iris.engine.object.terrain.IrisGenerator;
|
||||
import art.arcane.iris.core.pack.ModuleResourceClosure;
|
||||
import art.arcane.iris.core.pack.PackExportClosure;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.iris.engine.object.structure.IrisStructurePlacement;
|
||||
import art.arcane.iris.engine.object.structure.IrisStructure;
|
||||
import art.arcane.iris.modded.ModdedDimensionManager;
|
||||
import art.arcane.iris.modded.ModdedEngineBootstrap;
|
||||
import art.arcane.iris.modded.ModdedScheduler;
|
||||
@@ -881,9 +881,8 @@ public final class ModdedStudioCommands {
|
||||
LinkedHashSet<String> regionKeys = new LinkedHashSet<>();
|
||||
LinkedHashSet<String> biomeKeys = new LinkedHashSet<>();
|
||||
LinkedHashSet<String> generatorKeys = new LinkedHashSet<>();
|
||||
ModuleResourceClosure moduleResources = new ModuleResourceClosure(dm);
|
||||
ModuleResourceClosure moduleResources = new ModuleResourceClosure(dm).exportingElsewhere(IrisStructure.class);
|
||||
LinkedHashSet<String> objectKeys = new LinkedHashSet<>();
|
||||
LinkedHashSet<String> structureKeys = new LinkedHashSet<>();
|
||||
|
||||
dimension.getAllRegions(() -> dm).forEach((IrisRegion region) -> {
|
||||
if (region != null && region.getLoadKey() != null) {
|
||||
@@ -896,7 +895,6 @@ public final class ModdedStudioCommands {
|
||||
}
|
||||
});
|
||||
moduleResources.followSettingsOf(dimension);
|
||||
collectStructureKeys(structureKeys, dimension.getStructures());
|
||||
|
||||
for (String regionKey : regionKeys) {
|
||||
IrisRegion region = dm.getRegionLoader().load(regionKey);
|
||||
@@ -910,7 +908,6 @@ public final class ModdedStudioCommands {
|
||||
});
|
||||
moduleResources.followSettingsOf(region);
|
||||
moduleResources.follow(region.getObjects());
|
||||
collectStructureKeys(structureKeys, region.getStructures());
|
||||
objectKeys.addAll(PackExportClosure.collectObjectKeys(region.getObjects()));
|
||||
}
|
||||
for (String biomeKey : biomeKeys) {
|
||||
@@ -921,11 +918,11 @@ public final class ModdedStudioCommands {
|
||||
biome.getGenerators().forEach((IrisBiomeGeneratorLink link) -> generatorKeys.add(link.getGenerator()));
|
||||
moduleResources.followSettingsOf(biome);
|
||||
moduleResources.follow(biome.getObjects());
|
||||
collectStructureKeys(structureKeys, biome.getStructures());
|
||||
objectKeys.addAll(PackExportClosure.collectObjectKeys(biome.getObjects()));
|
||||
}
|
||||
|
||||
StringBuilder hashes = new StringBuilder();
|
||||
List<String> structureKeys = moduleResources.keysOf(IrisStructure.class);
|
||||
StructurePackageClosure structureClosure = StructurePackageClosure.collect(packFolder, structureKeys);
|
||||
if (!structureClosure.isValid()) {
|
||||
throw new IOException("Structure package closure is invalid: " + String.join("; ", structureClosure.errors()));
|
||||
@@ -969,20 +966,6 @@ public final class ModdedStudioCommands {
|
||||
return output;
|
||||
}
|
||||
|
||||
private static void collectStructureKeys(LinkedHashSet<String> keys, List<IrisStructurePlacement> placements) {
|
||||
if (placements == null) {
|
||||
return;
|
||||
}
|
||||
for (IrisStructurePlacement placement : placements) {
|
||||
if (placement == null || placement.getStructures() == null) {
|
||||
continue;
|
||||
}
|
||||
for (String structureKey : placement.getStructures()) {
|
||||
keys.add(structureKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String copyJson(File folder, String category, String key, File file) {
|
||||
if (file == null || !file.isFile()) {
|
||||
return "";
|
||||
|
||||
Reference in new issue
Block a user