apiType) {
+ return SAME_JSON.fromJson(SAME_JSON.toJsonTree(irisValue), apiType);
+ }
+}
diff --git a/src/main/java/art/arcane/iris/engine/mantle/components/StructureModule.java b/src/main/java/art/arcane/iris/engine/mantle/components/StructureModule.java
index 5aa19e9b9..4f7952044 100644
--- a/src/main/java/art/arcane/iris/engine/mantle/components/StructureModule.java
+++ b/src/main/java/art/arcane/iris/engine/mantle/components/StructureModule.java
@@ -19,6 +19,7 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.builtin.IrisStages;
+import art.arcane.iris.builtin.structure.StructureSettings;
import art.arcane.iris.core.modules.IrisMantleChunk;
import art.arcane.iris.core.modules.IrisPackSettings;
import art.arcane.iris.core.modules.IrisPackWorld;
@@ -27,17 +28,15 @@ import art.arcane.iris.engine.framework.IrisStructureLocator;
import art.arcane.iris.engine.framework.structure.StructureLocating;
import art.arcane.iris.engine.framework.structure.StructureResources;
import art.arcane.iris.engine.framework.structure.StructureValidator;
+import art.arcane.iris.engine.framework.structure.StructureVanillaHook;
import com.volmit.FeatureRegistry;
import com.volmit.IrisModule;
import com.volmit.ModuleInfo;
import com.volmit.ModuleLifecycle;
import com.volmit.config.PackSettings;
-import com.volmit.resource.ResourceId;
import com.volmit.service.StructureLocator;
import com.volmit.stage.MantleStageContext;
import com.volmit.stage.StageGraph;
-import com.volmit.vanilla.VanillaStructureContext;
-import com.volmit.vanilla.VanillaStructureRule;
import com.volmit.world.PackWorld;
/**
@@ -51,8 +50,9 @@ import com.volmit.world.PackWorld;
* {@link StructureLocating}, and forgets a world's structure index when the world stops, which includes every reload of
* the pack's structure files.
*
- * It decides over the platform's own structures through its vanilla structure hook ({@link #vanillaRule}): a structure
- * an Iris structure replaces is blocked, and one a structure placement of the pack places is reported as placed here.
+ * It decides over the platform's own structures through its vanilla structure hook ({@link StructureVanillaHook}): the
+ * dimension's {@code iris:structure} settings disable, adjust and set them up, and the pack's structure placements
+ * replace them, place them alongside, and start them where their {@code nativeStructures} grids say.
*/
public final class StructureModule implements IrisModule, ModuleLifecycle {
private static final String VERSION = "built-in";
@@ -70,11 +70,12 @@ public final class StructureModule implements IrisModule, ModuleLifecycle {
@Override
public void register(FeatureRegistry registry) {
+ registry.registerSettings(StructureSettings.class);
StructureResources.kinds().forEach(registry::registerResourceKind);
registry.registerValidator(new StructureValidator());
registry.registerService(StructureLocator.class, new StructureLocating());
registry.registerLifecycle(this);
- registry.registerVanillaStructureHook(StructureModule::vanillaRule);
+ registry.registerVanillaStructureHook(new StructureVanillaHook());
}
/** The structure index is still kept per engine rather than in the world's state, so a stopping world drops it. */
@@ -83,20 +84,6 @@ public final class StructureModule implements IrisModule, ModuleLifecycle {
IrisStructureLocator.invalidate(IrisPackWorld.of(world).engine());
}
- /**
- * {@link VanillaStructureRule#REPLACE} for a platform structure that an Iris structure of the world's placements
- * replaces (its {@code vanillaSource} with native suppression), {@link VanillaStructureRule#ALSO_PLACE} for one
- * a placement of the world places itself, {@link VanillaStructureRule#GENERATE} otherwise.
- */
- static VanillaStructureRule vanillaRule(ResourceId structure, VanillaStructureContext context) {
- Engine engine = IrisPackSettings.of(context.settings()).engine();
- String key = structure.toString();
- if (IrisStructureLocator.suppressesVanilla(engine, key)) {
- return VanillaStructureRule.REPLACE;
- }
- return IrisStructureLocator.isPlaced(engine, key) ? VanillaStructureRule.ALSO_PLACE : VanillaStructureRule.GENERATE;
- }
-
private static void place(MantleStageContext context) {
IrisMantleChunk chunk = IrisMantleChunk.current();
placing(chunk.engine()).place(chunk.writer(), chunk.chunkX(), chunk.chunkZ(), chunk.context());
diff --git a/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListVanillaStructure.java b/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListVanillaStructure.java
index 1560df858..7768b6818 100644
--- a/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListVanillaStructure.java
+++ b/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListVanillaStructure.java
@@ -18,7 +18,6 @@
package art.arcane.iris.engine.object.annotations;
-import art.arcane.iris.engine.object.structure.vanilla.IrisImportedStructureControl;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@@ -30,12 +29,4 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)
@Target({PARAMETER, TYPE, FIELD})
public @interface RegistryListVanillaStructure {
- /**
- * When true the field accepts family/namespace prefixes in addition to exact registered keys
- * (the {@code IrisImportedStructureControl.matchesKey} contract: "minecraft:village" matches
- * every village variant, "nova_structures:" matches a whole namespace). The generated editor
- * schema then validates entries against the registry enum OR a key/prefix pattern instead of
- * rejecting anything that is not an exact registered key.
- */
- boolean prefixes() default false;
}
diff --git a/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListVanillaStructureSet.java b/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListVanillaStructureSet.java
deleted file mode 100644
index e877e6ff5..000000000
--- a/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListVanillaStructureSet.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Iris is a World Generator for Minecraft Bukkit Servers
- * Copyright (c) 2022 Arcane Arts (Volmit Software)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package art.arcane.iris.engine.object.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-@Retention(RUNTIME)
-@Target({PARAMETER, TYPE, FIELD})
-public @interface RegistryListVanillaStructureSet {
-
-}
diff --git a/src/main/java/art/arcane/iris/engine/object/decoration/IrisImportedFeatureControl.java b/src/main/java/art/arcane/iris/engine/object/decoration/IrisImportedFeatureControl.java
index bf44eb3bc..28a572d6c 100644
--- a/src/main/java/art/arcane/iris/engine/object/decoration/IrisImportedFeatureControl.java
+++ b/src/main/java/art/arcane/iris/engine/object/decoration/IrisImportedFeatureControl.java
@@ -18,7 +18,7 @@
package art.arcane.iris.engine.object.decoration;
-import art.arcane.iris.engine.object.structure.vanilla.IrisImportedStructureControl;
+import art.arcane.iris.engine.framework.structure.ImportedStructures;
import art.arcane.iris.engine.object.annotations.ArrayType;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.volmlib.util.collection.KList;
@@ -98,7 +98,7 @@ public class IrisImportedFeatureControl {
KList deniedKeys = Objects.requireNonNull(
disabled, "importedFeatures.disabled must not be null");
for (String entry : deniedKeys) {
- if (IrisImportedStructureControl.matchesKey(entry, placedFeatureKey)) {
+ if (ImportedStructures.matchesKey(entry, placedFeatureKey)) {
return NativeFeatureGenerationStatus.DISABLED_BY_PACK;
}
}
diff --git a/src/main/java/art/arcane/iris/engine/object/structure/vanilla/IrisImportedStructureControl.java b/src/main/java/art/arcane/iris/engine/object/structure/vanilla/IrisImportedStructureControl.java
deleted file mode 100644
index 22824b12b..000000000
--- a/src/main/java/art/arcane/iris/engine/object/structure/vanilla/IrisImportedStructureControl.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Iris is a World Generator for Minecraft Bukkit Servers
- * Copyright (c) 2022 Arcane Arts (Volmit Software)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package art.arcane.iris.engine.object.structure.vanilla;
-
-import art.arcane.iris.engine.object.structure.IrisStructureStiltSettings;
-import art.arcane.iris.engine.object.structure.IrisStructureTerrain;
-import art.arcane.iris.engine.object.structure.IrisStructureYBand;
-import art.arcane.iris.engine.object.annotations.ArrayType;
-import art.arcane.iris.engine.object.annotations.Desc;
-import art.arcane.iris.engine.object.annotations.MaxNumber;
-import art.arcane.iris.engine.object.annotations.MinNumber;
-import art.arcane.iris.engine.object.annotations.RegistryListVanillaStructure;
-import art.arcane.volmlib.util.collection.KList;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.Accessors;
-
-import java.util.Locale;
-import java.util.Objects;
-
-@Accessors(chain = true)
-@NoArgsConstructor
-@AllArgsConstructor
-@Desc("Controls native vanilla, mod, and ingested datapack structure generation for this dimension (set as the dimension's 'importedStructures' field). Every registered structure generates through its native placement unless its key matches 'disabled', equals a key in 'disabledExact', or a viable dimension-level Iris placement explicitly replaces its source. Family matching uses namespace, slash, or underscore boundaries, while exact matching compares normalized complete keys only. Run '/iris structure list ' to dump every valid key. Only affects newly generated chunks and is separate from Iris structure placements.")
-@Data
-public class IrisImportedStructureControl {
- @ArrayType(type = String.class, min = 1)
- @RegistryListVanillaStructure(prefixes = true)
- @Desc("Structure keys to deny explicitly, e.g. 'minecraft:stronghold'. A namespace:path prefix also matches, so 'minecraft:village' disables every village variant and 'minecraft:ruined_portal' disables every ruined portal. Every key not matched here remains enabled.")
- private KList disabled = new KList<>();
-
- @ArrayType(type = String.class, min = 1)
- @RegistryListVanillaStructure(prefixes = false)
- @Desc("Exact structure keys to deny after trimming and case normalization. Unlike 'disabled', entries never match key families, so 'minecraft:ruined_portal' does not disable 'minecraft:ruined_portal_nether'.")
- private KList disabledExact = new KList<>();
-
- @MinNumber(-512)
- @MaxNumber(512)
- @Desc("Vertical block offset applied only to UNDERGROUND vanilla structures (the UNDERGROUND_STRUCTURES, UNDERGROUND_DECORATION, and STRONGHOLDS generation steps: strongholds, trial chambers, mineshafts, ancient cities, etc.). Surface structures (villages, outposts, etc.) are never shifted. Use a negative value to push deep structures lower when your dimension's sea/terrain level differs from vanilla's (e.g. -64 if you lowered the fluid height to 0). 0 = no shift.")
- private int undergroundYShift = 0;
-
- @Desc("Controls whether ingested datapacks may replace minecraft-namespaced structure definitions, sets, pools, and templates. When false, those overrides are stripped from installed datapack copies so vanilla definitions stay intact. Non-minecraft structures from datapacks and mods remain governed by disabled because namespace alone cannot identify their origin. Resolved globally across loaded packs: if any dimension sets this false, minecraft-namespaced overrides are stripped from every installed datapack copy.")
- private boolean datapackOverrides = true;
-
- @ArrayType(type = IrisStructureSetFrequencyOverride.class, min = 1)
- @Desc("Exact registered structure-set frequency overrides for native generation. The last entry for a normalized structure-set key wins. These do not convert native structures into Iris placements and affect only newly generated chunks.")
- private KList frequencyOverrides = new KList<>();
-
- @ArrayType(type = IrisVanillaStructureAdjustment.class, min = 1)
- @Desc("Per-structure adjustments applied to vanilla, mod, and datapack structures that still generate natively. Vertical shifts from every matching entry stack. A matching preserveSourceY option disables Iris burial repositioning for that structure. The last matching entry with stilt settings controls foundation columns, and likewise for terrain and yBand settings. A structure suppressed by an Iris placement is unaffected.")
- private KList adjustments = new KList<>();
-
- public boolean shouldGenerate(String key) {
- return key != null && !key.isBlank()
- && !matches(disabled, key)
- && !matchesExact(disabledExact, key);
- }
-
- public IrisNativeStructureDecision resolve(String key, boolean undergroundStep) {
- KList activeAdjustments = Objects.requireNonNull(
- adjustments, "importedStructures.adjustments must not be null");
- int y = undergroundStep ? undergroundYShift : 0;
- boolean preserveSourceY = false;
- IrisStructureStiltSettings stilt = null;
- IrisStructureTerrain terrain = null;
- IrisStructureYBand yBand = null;
- for (IrisVanillaStructureAdjustment adjustment : activeAdjustments) {
- if (adjustment != null && adjustment.matches(key)) {
- y += adjustment.getYShift();
- preserveSourceY |= adjustment.isPreserveSourceY();
- if (adjustment.getStilt() != null) {
- stilt = adjustment.getStilt();
- }
- if (adjustment.getTerrain() != null) {
- terrain = adjustment.getTerrain();
- }
- if (adjustment.getYBand() != null) {
- yBand = adjustment.getYBand();
- }
- }
- }
- return new IrisNativeStructureDecision(
- generationStatus(key), y, yBand, preserveSourceY, stilt, terrain);
- }
-
- public double frequencyMultiplier(String structureSetKey) {
- KList activeOverrides = Objects.requireNonNull(
- frequencyOverrides, "importedStructures.frequencyOverrides must not be null");
- String normalizedKey = normalizeKey(structureSetKey);
- if (normalizedKey.isEmpty()) {
- return 1D;
- }
- double multiplier = 1D;
- for (IrisStructureSetFrequencyOverride override : activeOverrides) {
- if (override != null && normalizeKey(override.getStructureSet()).equals(normalizedKey)) {
- multiplier = override.getMultiplier();
- }
- }
- return multiplier;
- }
-
- public boolean hasFrequencyOverrides() {
- return !Objects.requireNonNull(
- frequencyOverrides, "importedStructures.frequencyOverrides must not be null").isEmpty();
- }
-
- private NativeStructureGenerationStatus generationStatus(String key) {
- if (key == null || key.isBlank()) {
- return NativeStructureGenerationStatus.INVALID_REGISTRY_KEY;
- }
- if (matches(disabled, key) || matchesExact(disabledExact, key)) {
- return NativeStructureGenerationStatus.DISABLED_BY_PACK;
- }
- return NativeStructureGenerationStatus.GENERATE_NATIVE;
- }
-
- private boolean matches(KList list, String key) {
- if (key == null) {
- return false;
- }
- KList activeList = Objects.requireNonNull(
- list, "importedStructures.disabled must not be null");
- for (String entry : activeList) {
- if (matchesKey(entry, key)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean matchesExact(KList list, String key) {
- KList activeList = Objects.requireNonNull(
- list, "importedStructures.disabledExact must not be null");
- String normalizedKey = normalizeKey(key);
- for (String entry : activeList) {
- String normalizedEntry = normalizeKey(entry);
- if (!normalizedEntry.isEmpty() && normalizedEntry.equals(normalizedKey)) {
- return true;
- }
- }
- return false;
- }
-
- public static boolean matchesKey(String pattern, String key) {
- if (pattern == null || key == null) {
- return false;
- }
- String normalizedPattern = pattern.trim().toLowerCase(Locale.ROOT);
- String normalizedKey = key.trim().toLowerCase(Locale.ROOT);
- if (normalizedPattern.isEmpty() || !normalizedKey.startsWith(normalizedPattern)) {
- return false;
- }
- if (normalizedKey.length() == normalizedPattern.length()) {
- return true;
- }
- char patternEnd = normalizedPattern.charAt(normalizedPattern.length() - 1);
- if (patternEnd == ':' || patternEnd == '/' || patternEnd == '_') {
- return true;
- }
- char boundary = normalizedKey.charAt(normalizedPattern.length());
- return boundary == '/' || boundary == '_';
- }
-
- private static String normalizeKey(String key) {
- return key == null ? "" : key.trim().toLowerCase(Locale.ROOT);
- }
-}
diff --git a/src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimension.java b/src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimension.java
index 206b1d1ee..53d3dcf40 100644
--- a/src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimension.java
+++ b/src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimension.java
@@ -32,7 +32,6 @@ import art.arcane.iris.engine.object.noise.NoiseStyle;
import art.arcane.iris.engine.object.procedural.tree.IrisTreeSettings;
import art.arcane.iris.engine.object.runtime.StudioMode;
import art.arcane.iris.engine.object.structure.IrisStructurePlacement;
-import art.arcane.iris.engine.object.structure.vanilla.IrisImportedStructureControl;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveProfile;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingEntry;
import art.arcane.iris.engine.object.terrain.deposit.IrisDepositVariant;
@@ -292,8 +291,6 @@ public class IrisDimension extends IrisRegistrant {
@Desc("Dimension-wide Iris structure placements, independent of biome/region placements")
@ArrayType(type = IrisStructurePlacement.class, min = 1)
private KList structures = new KList<>();
- @Desc("Controls native vanilla, mod, and ingested datapack structure generation for this dimension. Every registered structure is enabled by default; 'disabled' is the sole generation deny list and autocompletes live structure keys.")
- private IrisImportedStructureControl importedStructures = new IrisImportedStructureControl();
@Desc("Controls native vanilla, mod, and ingested datapack PLACED FEATURE generation (ores, trees, plants, springs, geodes) for this dimension. Disabled by default: leaving this out generates exactly the terrain Iris always has. Set 'enabled' true to run the vanilla decoration feature pass over Iris terrain. Carvers are never imported.")
private IrisImportedFeatureControl importedFeatures = new IrisImportedFeatureControl();
@ArrayType(type = String.class, min = 1)