diff --git a/core/purity-allowlist.txt b/core/purity-allowlist.txt index 50a4d26c9..36b3c155c 100644 --- a/core/purity-allowlist.txt +++ b/core/purity-allowlist.txt @@ -83,7 +83,6 @@ art/arcane/iris/core/tools/IrisPackBenchmarking.java art/arcane/iris/core/tools/IrisReflectiveAPI.java art/arcane/iris/core/tools/IrisToolbelt.java art/arcane/iris/core/tools/IrisWorldCreator.java -art/arcane/iris/core/tools/WorldCreationProgressReporter.java art/arcane/iris/engine/IrisEngineEffects.java art/arcane/iris/engine/IrisWorldManager.java art/arcane/iris/engine/MarkerSpawnScanner.java diff --git a/core/src/main/java/art/arcane/iris/core/project/SchemaBuilder.java b/core/src/main/java/art/arcane/iris/core/project/SchemaBuilder.java index b192014d6..9a16ff00a 100644 --- a/core/src/main/java/art/arcane/iris/core/project/SchemaBuilder.java +++ b/core/src/main/java/art/arcane/iris/core/project/SchemaBuilder.java @@ -48,7 +48,6 @@ import art.arcane.iris.engine.object.annotations.RegistryListEntityType; import art.arcane.iris.engine.object.annotations.RegistryListFont; import art.arcane.iris.engine.object.annotations.RegistryListFunction; import art.arcane.iris.engine.object.annotations.RegistryListItemType; -import art.arcane.iris.engine.object.annotations.RegistryListNativeJigsawPool; import art.arcane.iris.engine.object.annotations.RegistryListPotionEffect; import art.arcane.iris.engine.object.annotations.RegistryListResource; import art.arcane.iris.engine.object.annotations.RegistryListSpecialEntity; @@ -446,6 +445,7 @@ public class SchemaBuilder { case STRUCTURE_PREFIX -> putRegistryEnumOrPrefixRef(property, "enum-vanilla-structure-or-prefix", "enum-vanilla-structure", this::vanillaStructures, VANILLA_STRUCTURE_PREFIX_PATTERN); case STRUCTURE_SET -> putRegistryEnumRef(property, "enum-vanilla-structure-set", this::vanillaStructureSets); + case TEMPLATE_POOL -> putRegistryEnumRef(property, "enum-native-jigsaw-pool", this::nativeJigsawPools); case POTION_EFFECT -> putRegistryEnumRef(property, "enum-potion-effect-type", this::potionTypes); case ENCHANTMENT -> putRegistryEnumRef(property, "enum-enchantment", this::enchantTypes); case PACK_BIOME -> putPackResourceRef(property, IrisBiome.class); @@ -615,11 +615,6 @@ public class SchemaBuilder { putRegistryEnumRef(prop, "enum-block-type", this::blockTypes); description.add(SYMBOL_TYPE__N + " Must be a valid Block Type (use ctrl+space for auto complete!)"); - } else if (k.isAnnotationPresent(RegistryListNativeJigsawPool.class)) { - fancyType = "Native Jigsaw Pool"; - putRegistryEnumRef(prop, "enum-native-jigsaw-pool", this::nativeJigsawPools); - description.add(SYMBOL_TYPE__N + " Must be a registered vanilla, datapack, or modded template pool key (use ctrl+space for auto complete!)"); - } else if (k.isAnnotationPresent(RegistryListVanillaStructure.class)) { fancyType = "Vanilla Structure"; putRegistryEnumRef(prop, "enum-vanilla-structure", this::vanillaStructures); @@ -792,10 +787,6 @@ public class SchemaBuilder { items.put("$ref", "#/definitions/" + key); prop.put("items", items); description.add(SYMBOL_TYPE__N + " Must be a valid vanilla, datapack, or imported Iris structure (use ctrl+space for auto complete!)"); - } else if (k.isAnnotationPresent(RegistryListNativeJigsawPool.class)) { - fancyType = "List"; - putRegistryEnumItems(prop, "enum-native-jigsaw-pool", this::nativeJigsawPools); - description.add(SYMBOL_TYPE__N + " Must be a registered vanilla, datapack, or modded template pool key (use ctrl+space for auto complete!)"); } else if (k.isAnnotationPresent(RegistryListVanillaStructure.class)) { fancyType = "List"; putRegistryEnumItems(prop, "enum-vanilla-structure", this::vanillaStructures); diff --git a/core/src/test/java/art/arcane/iris/core/project/SchemaBuilderParityTest.java b/core/src/test/java/art/arcane/iris/core/project/SchemaBuilderParityTest.java index 4d715378a..b887519c9 100644 --- a/core/src/test/java/art/arcane/iris/core/project/SchemaBuilderParityTest.java +++ b/core/src/test/java/art/arcane/iris/core/project/SchemaBuilderParityTest.java @@ -44,6 +44,7 @@ import art.arcane.iris.engine.object.annotations.RegistryListSpecialEntity; import art.arcane.iris.engine.object.annotations.RegistryListVanillaStructure; import art.arcane.iris.engine.object.annotations.functions.LootTableKeyFunction; import art.arcane.iris.spi.IrisPlatform; +import art.arcane.iris.engine.object.structure.vanilla.IrisNativeStructure; import art.arcane.iris.spi.IrisPlatforms; import art.arcane.iris.spi.LogLevel; import art.arcane.iris.spi.PlatformBiome; @@ -127,7 +128,7 @@ public class SchemaBuilderParityTest { if (previous != null) { IrisPlatforms.unbind(); } - IrisPlatforms.bind(new FakePlatform()); + IrisPlatforms.bind(new FakePlatform(null)); } @After @@ -231,6 +232,24 @@ public class SchemaBuilderParityTest { assertFalse("the feature ids are not keys", properties.has("iris:decorant")); } + /** A native structure's jigsaw start pool names one of the platform's template pools, and studio lists them. */ + @Test + public void jigsawStartPoolsCompleteThePlatformsTemplatePools() { + PlatformStructureHooks hooks = mock(PlatformStructureHooks.class); + when(hooks.templatePoolKeys()).thenReturn(List.of("minecraft:village/plains/town_centers")); + IrisPlatforms.unbind(); + IrisPlatforms.bind(new FakePlatform(hooks)); + + JSONObject schema = new SchemaBuilder(IrisNativeStructure.class, structureSchemaData()).construct(); + JSONObject definitions = schema.getJSONObject("definitions"); + JSONObject jigsaw = definitions.getJSONObject(definitionKey(schema.getJSONObject("properties").getJSONObject("jigsaw"))) + .getJSONObject("properties"); + + assertEquals("enum-native-jigsaw-pool", definitionKey(jigsaw.getJSONObject("startPool"))); + assertEquals(List.of("minecraft:village/plains/town_centers"), + values(definitions.getJSONObject("enum-native-jigsaw-pool").getJSONArray("enum"))); + } + @Test public void structureSettingsRenderTheirFitsWithTheModulesDefinitions() throws IOException { JSONObject schema = new SchemaBuilder(IrisDimension.class, structureSchemaData(structureSettingsSchema())).construct(); @@ -670,6 +689,11 @@ public class SchemaBuilderParityTest { private static final class FakePlatform implements IrisPlatform { private final PlatformRegistries registries = new FakeRegistries(); + private final PlatformStructureHooks structureHooks; + + private FakePlatform(PlatformStructureHooks structureHooks) { + this.structureHooks = structureHooks; + } @Override public String platformName() { @@ -693,7 +717,7 @@ public class SchemaBuilderParityTest { @Override public PlatformStructureHooks structureHooks() { - return null; + return structureHooks; } @Override