diff --git a/README.md b/README.md index 3c3ad9e5f..94d9f5fed 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,11 @@ which ones its placements replace or the dimension's `importedStructures` disabl placements make, the shift and band of the platform's starts, and the whole terrain fit of every start (SOURCE, PRESERVE, VACUUM, ENCASE, BORE, FORCE_CARVE, stilts) in `engine/framework/structure/fit`, written against IrisApi's `StructureFit` and `BlockAccess` only. A start carries its fit as a memo (its terrain and stilts JSON), so every -chunk it reaches and every restart fits it the same way. Object place modes are data (`PlaceMode`: height sampling, +chunk it reaches and every restart fits it the same way. `iris:vanilla-features` (`VanillaFeaturesModule`, no stages) +reads the dimension's `importedFeatures` (`ImportedFeaturesSettings`) and provides `VanillaFeatures` (`ImportedFeatures`): +whether the platform's own placed features run over the terrain and which decoration steps and features they leave out; +the family patterns of `disabled` and of `importedStructures` share one rule (`art.arcane.iris.builtin.RegistryKeyFamily`). +Object place modes are data (`PlaceMode`: height sampling, stilt, `VacuumProfile`, `PlaceTrait`s) that the placement stages ask; the pack JSON keeps the mode names. `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). @@ -137,7 +141,7 @@ naming the class and what it uses. A VolmLib class that Iris's Bukkit jar strips `core/volmlib-left-out-of-bukkit-jar.txt`, which its shadowJar reads too) is on that classpath but missing on a server, so the check treats it as missing and fails the task naming it. `check` runs the task. -The jar holds `iris:post`, `iris:perfection` and `iris:matter`. They are written against IrisApi and +The jar holds `iris:post`, `iris:perfection`, `iris:matter` and `iris:vanilla-features`. They are written against IrisApi and `art.arcane.iris.builtin` alone: the chunk's `BlockState` hunk, the block registry's traits and `canPlaceOn`, the terrain sampler (heights around the chunk, slope, fluid height, where the upper dimension begins) and the mantle's planned blocks. Iris no longer compiles them in (`IrisModuleHost.generationModules()`), so a pack gets them by putting diff --git a/builtin-modules.txt b/builtin-modules.txt index 824782905..b83d19049 100644 --- a/builtin-modules.txt +++ b/builtin-modules.txt @@ -18,3 +18,5 @@ module art.arcane.iris.engine.modifier.PostModule include art/arcane/iris/engine/modifier/SurfaceSmoothing*.class module art.arcane.iris.engine.modifier.PerfectionModule module art.arcane.iris.engine.modifier.MatterModule +module art.arcane.iris.engine.framework.vanillafeatures.VanillaFeaturesModule +include art/arcane/iris/engine/framework/vanillafeatures/** diff --git a/source-patterns.txt b/source-patterns.txt index c42d04a72..00f98cd55 100644 --- a/source-patterns.txt +++ b/source-patterns.txt @@ -6,6 +6,7 @@ art/arcane/iris/engine/mantle/components/** art/arcane/iris/engine/object/** art/arcane/iris/engine/image/** art/arcane/iris/engine/framework/structure/** +art/arcane/iris/engine/framework/vanillafeatures/** art/arcane/iris/engine/framework/StructureAssembler.java art/arcane/iris/engine/framework/IrisStructureLocator.java art/arcane/iris/engine/framework/StructureCaveAnchorResolver.java diff --git a/src/main/java/art/arcane/iris/builtin/RegistryKeyFamily.java b/src/main/java/art/arcane/iris/builtin/RegistryKeyFamily.java new file mode 100644 index 000000000..eec55b733 --- /dev/null +++ b/src/main/java/art/arcane/iris/builtin/RegistryKeyFamily.java @@ -0,0 +1,57 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 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.builtin; + +import java.util.Locale; + +/** + * How the settings of Iris's built-ins name families of the platform's registry keys, such as structures and placed + * features: a pattern matches the keys equal to it and the keys it starts at a namespace, slash or underscore boundary, + * ignoring case and surrounding space. So {@code minecraft:village} matches {@code minecraft:village_plains}, + * {@code minecraft:ore} every vanilla ore, and {@code nova_structures:} a whole namespace. + */ +public final class RegistryKeyFamily { + private RegistryKeyFamily() { + } + + /** Whether the family pattern {@code pattern} matches the registry key {@code key}. */ + public static boolean matches(String pattern, String key) { + if (pattern == null || key == null) { + return false; + } + String normalizedPattern = normalize(pattern); + String normalizedKey = normalize(key); + 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 normalize(String key) { + return key.trim().toLowerCase(Locale.ROOT); + } +} diff --git a/src/main/java/art/arcane/iris/builtin/vanillafeatures/ImportedFeaturesSettings.java b/src/main/java/art/arcane/iris/builtin/vanillafeatures/ImportedFeaturesSettings.java new file mode 100644 index 000000000..cf5bfaf2b --- /dev/null +++ b/src/main/java/art/arcane/iris/builtin/vanillafeatures/ImportedFeaturesSettings.java @@ -0,0 +1,80 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 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.builtin.vanillafeatures; + +import com.volmit.FeatureAttachment.Target; +import com.volmit.IrisFeature; +import com.volmit.config.Desc; +import com.volmit.config.Feature; +import com.volmit.config.MinItems; +import com.volmit.vanilla.DecorationStep; + +import java.util.Collections; +import java.util.List; + +/** + * Whether a dimension runs the platform's own placed features over its terrain, written as + * {@code "importedFeatures": {"enabled": true, "disabledSteps": ["VEGETAL_DECORATION"]}}: the switch, and the features and + * decoration steps it leaves out. IrisApi types only. + */ +@Desc("Controls native vanilla, mod, and ingested datapack PLACED FEATURE generation for this dimension. Placed features are ores, trees, plants, springs, geodes and every other decoration entry a biome declares. This is OFF by default: with 'enabled' false Iris generates exactly the terrain it always has and no native feature runs. With it true, every placed feature the biome's vanilla derivative declares runs over Iris terrain, in vanilla step order, on the same worldgen thread vanilla uses. Carvers are never imported - Iris has no NoiseGeneratorSettings, so there is nothing for a carver to carve against. Family matching on 'disabled' uses namespace, slash, or underscore boundaries, so 'minecraft:ore' covers every vanilla ore feature without matching unrelated names.") +@Feature(id = "iris:vanilla-features", name = "Vanilla features", key = "importedFeatures", targets = Target.DIMENSION) +public final class ImportedFeaturesSettings implements IrisFeature { + @Desc("Master switch. False (the default) means no native placed feature generates and chunk output is identical to a pack without this block at all. True runs the vanilla decoration feature pass over Iris terrain.") + private boolean enabled = false; + + @MinItems(1) + @Desc("Placed feature keys to deny explicitly, e.g. 'minecraft:ore_diamond'. A namespace:path prefix also matches, so 'minecraft:ore' denies every vanilla ore and 'minecraft:trees' denies every tree placement. Every key not matched here generates while 'enabled' is true.") + private List disabled = List.of(); + + @MinItems(1) + @Desc("Restrict feature generation to these decoration steps only. Empty (the default) means every step is eligible. Use this to import ores without importing vegetation: set it to UNDERGROUND_ORES.") + private List steps = List.of(); + + @MinItems(1) + @Desc("Decoration steps to deny. Applied after 'steps', so a step listed here never generates even if 'steps' allows it. VEGETAL_DECORATION is the usual entry for packs that grow their own trees.") + private List disabledSteps = List.of(); + + public ImportedFeaturesSettings() { + } + + /** Whether the platform's placed features run over the dimension's terrain. */ + public boolean enabled() { + return enabled; + } + + /** Family patterns of the placed features the dimension leaves out. */ + public List disabled() { + return listOrEmpty(disabled); + } + + /** The only decoration steps whose features generate; empty for every step. */ + public List steps() { + return listOrEmpty(steps); + } + + /** Decoration steps whose features never generate, whatever {@link #steps} says. */ + public List disabledSteps() { + return listOrEmpty(disabledSteps); + } + + private static List listOrEmpty(List list) { + return list == null ? List.of() : Collections.unmodifiableList(list); + } +} diff --git a/src/main/java/art/arcane/iris/engine/framework/structure/ImportedStructures.java b/src/main/java/art/arcane/iris/engine/framework/structure/ImportedStructures.java index a7d215973..fd4680bfd 100644 --- a/src/main/java/art/arcane/iris/engine/framework/structure/ImportedStructures.java +++ b/src/main/java/art/arcane/iris/engine/framework/structure/ImportedStructures.java @@ -18,6 +18,7 @@ package art.arcane.iris.engine.framework.structure; +import art.arcane.iris.builtin.RegistryKeyFamily; import art.arcane.iris.builtin.structure.StructureAdjustment; import art.arcane.iris.builtin.structure.StructureSetFrequency; import art.arcane.iris.builtin.structure.StructureSettings; @@ -34,7 +35,7 @@ import java.util.Optional; * What a dimension's {@link StructureSettings} say about the platform's own structures: which ones it disables, how * the starts of the others are adjusted, and how the platform sets them up. Keys match ignoring case and surrounding * space; a family pattern also matches the keys it starts at a namespace, slash or underscore boundary - * ({@link #matchesKey}). + * ({@link RegistryKeyFamily}). */ public final class ImportedStructures { private final StructureSettings settings; @@ -55,7 +56,7 @@ public final class ImportedStructures { if (normalizedKey.isEmpty()) { return false; } - return settings.disabled().stream().anyMatch(pattern -> matchesKey(pattern, key)) + return settings.disabled().stream().anyMatch(pattern -> RegistryKeyFamily.matches(pattern, key)) || settings.disabledExact().stream().map(ImportedStructures::normalize) .anyMatch(exact -> !exact.isEmpty() && exact.equals(normalizedKey)); } @@ -99,33 +100,8 @@ public final class ImportedStructures { } } - /** - * Whether the family pattern {@code pattern} matches the structure {@code key}: equal keys, or a pattern the key - * starts with that ends in, or is followed in the key by, {@code :}, {@code /} or {@code _}. So - * {@code minecraft:village} matches {@code minecraft:village_plains} and {@code nova_structures:} a whole namespace. - */ - public static boolean matchesKey(String pattern, String key) { - if (pattern == null || key == null) { - return false; - } - String normalizedPattern = normalize(pattern); - String normalizedKey = normalize(key); - 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 boolean matchesAny(List patterns, String key) { - return patterns.stream().anyMatch(pattern -> matchesKey(pattern, key)); + return patterns.stream().anyMatch(pattern -> RegistryKeyFamily.matches(pattern, key)); } private static NativeStructureFit asAdjustment(StructureAdjustment entry) { diff --git a/src/main/java/art/arcane/iris/engine/framework/vanillafeatures/ImportedFeatures.java b/src/main/java/art/arcane/iris/engine/framework/vanillafeatures/ImportedFeatures.java new file mode 100644 index 000000000..0cafe0ba5 --- /dev/null +++ b/src/main/java/art/arcane/iris/engine/framework/vanillafeatures/ImportedFeatures.java @@ -0,0 +1,67 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 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.framework.vanillafeatures; + +import art.arcane.iris.builtin.RegistryKeyFamily; +import art.arcane.iris.builtin.vanillafeatures.ImportedFeaturesSettings; +import com.volmit.config.FeatureSettings.Entry; +import com.volmit.resource.ResourceId; +import com.volmit.service.VanillaFeatures; +import com.volmit.vanilla.DecorationStep; +import com.volmit.world.PackWorld; + +import java.util.List; +import java.util.Optional; + +/** + * What a dimension's {@link ImportedFeaturesSettings} say about the platform's own placed features: whether they run, + * and which decoration steps and features they leave out. A dimension without the settings runs none. + */ +public final class ImportedFeatures implements VanillaFeatures { + private static final ImportedFeaturesSettings NONE = new ImportedFeaturesSettings(); + + @Override + public boolean generates(PackWorld world) { + return settings(world).enabled(); + } + + /** A step the API does not name is allowed unless the dimension narrowed generation to listed steps. */ + @Override + public boolean generatesStep(PackWorld world, Optional step) { + ImportedFeaturesSettings settings = settings(world); + if (step.isEmpty()) { + return settings.steps().isEmpty(); + } + if (!settings.steps().isEmpty() && !settings.steps().contains(step.get())) { + return false; + } + return !settings.disabledSteps().contains(step.get()); + } + + @Override + public boolean generatesFeature(PackWorld world, ResourceId feature) { + String key = feature.toString(); + return settings(world).disabled().stream().noneMatch(pattern -> RegistryKeyFamily.matches(pattern, key)); + } + + private static ImportedFeaturesSettings settings(PackWorld world) { + List> declared = world.settings().declared(ImportedFeaturesSettings.class); + return declared.isEmpty() ? NONE : declared.getFirst().value(); + } +} diff --git a/src/main/java/art/arcane/iris/engine/framework/vanillafeatures/VanillaFeaturesModule.java b/src/main/java/art/arcane/iris/engine/framework/vanillafeatures/VanillaFeaturesModule.java new file mode 100644 index 000000000..035b15463 --- /dev/null +++ b/src/main/java/art/arcane/iris/engine/framework/vanillafeatures/VanillaFeaturesModule.java @@ -0,0 +1,51 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 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.framework.vanillafeatures; + +import art.arcane.iris.builtin.vanillafeatures.ImportedFeaturesSettings; +import com.volmit.FeatureRegistry; +import com.volmit.IrisModule; +import com.volmit.ModuleInfo; +import com.volmit.service.VanillaFeatures; +import com.volmit.stage.StageGraph; + +/** + * Module {@code iris:vanilla-features}: whether the platform's own placed features (ores, trees, plants, springs) run + * over a dimension's terrain, and which steps and features they leave out, decided from the dimension's + * {@code importedFeatures} settings and answered through {@link VanillaFeatures} ({@link ImportedFeatures}). The + * platform runs the feature pass itself; the module has no stages. + */ +public final class VanillaFeaturesModule implements IrisModule { + private static final String VERSION = "built-in"; + + @Override + public ModuleInfo info() { + return ModuleInfo.of("iris:vanilla-features", "Vanilla features", VERSION); + } + + @Override + public void install(StageGraph graph) { + } + + @Override + public void register(FeatureRegistry registry) { + registry.registerSettings(ImportedFeaturesSettings.class); + registry.registerService(VanillaFeatures.class, new ImportedFeatures()); + } +} diff --git a/src/main/java/art/arcane/iris/engine/object/decoration/IrisDecorationStep.java b/src/main/java/art/arcane/iris/engine/object/decoration/IrisDecorationStep.java deleted file mode 100644 index a2ee1d3ab..000000000 --- a/src/main/java/art/arcane/iris/engine/object/decoration/IrisDecorationStep.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Iris is a World Generator for Minecraft Servers - * Copyright (c) 2026 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.decoration; - -import art.arcane.iris.engine.object.annotations.Desc; - -import java.util.Locale; - -/** - * Pure-JVM mirror of Minecraft's decoration generation steps, in registry (ordinal) order. The ordinals and - * serialized names match {@code GenerationStep.Decoration} on MC 26.2 so a platform can convert either way - * without core depending on a Minecraft type. Verified against MC 26.2 GenerationStep.Decoration. - */ -@Desc("A vanilla decoration generation step. Placed features are grouped into these steps and run in this order.") -public enum IrisDecorationStep { - @Desc("Raw generation - the earliest step, before lakes.") - RAW_GENERATION("raw_generation"), - - @Desc("Lakes.") - LAKES("lakes"), - - @Desc("Local modifications such as amethyst geodes, icebergs and dripstone clusters.") - LOCAL_MODIFICATIONS("local_modifications"), - - @Desc("Underground structure features (not the structure system - features tagged as underground structures).") - UNDERGROUND_STRUCTURES("underground_structures"), - - @Desc("Surface structure features.") - SURFACE_STRUCTURES("surface_structures"), - - @Desc("Stronghold step.") - STRONGHOLDS("strongholds"), - - @Desc("Underground ores. This is the step that carries vanilla and mod ore veins.") - UNDERGROUND_ORES("underground_ores"), - - @Desc("Underground decoration such as glow lichen, sculk patches and cave vegetation.") - UNDERGROUND_DECORATION("underground_decoration"), - - @Desc("Fluid springs - the small water and lava spring features.") - FLUID_SPRINGS("fluid_springs"), - - @Desc("Vegetal decoration - trees, grass, flowers, kelp and most surface plant life.") - VEGETAL_DECORATION("vegetal_decoration"), - - @Desc("Top layer modification - freezing and snow placement.") - TOP_LAYER_MODIFICATION("top_layer_modification"); - - private final String serializedName; - - IrisDecorationStep(String serializedName) { - this.serializedName = serializedName; - } - - public String getSerializedName() { - return serializedName; - } - - /** - * Resolves a step by its vanilla ordinal. Returns null when the running Minecraft version declares more - * decoration steps than this enum knows about, which the callers treat as "unknown step, generate it". - */ - public static IrisDecorationStep byOrdinal(int ordinal) { - IrisDecorationStep[] values = values(); - return ordinal < 0 || ordinal >= values.length ? null : values[ordinal]; - } - - public static IrisDecorationStep byKey(String key) { - if (key == null || key.isBlank()) { - return null; - } - String normalized = key.trim().toLowerCase(Locale.ROOT); - for (IrisDecorationStep step : values()) { - if (step.serializedName.equals(normalized) || step.name().toLowerCase(Locale.ROOT).equals(normalized)) { - return step; - } - } - return null; - } -} 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 deleted file mode 100644 index 28a572d6c..000000000 --- a/src/main/java/art/arcane/iris/engine/object/decoration/IrisImportedFeatureControl.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Iris is a World Generator for Minecraft Servers - * Copyright (c) 2026 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.decoration; - -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; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.Objects; - -@Accessors(chain = true) -@NoArgsConstructor -@AllArgsConstructor -@Desc("Controls native vanilla, mod, and ingested datapack PLACED FEATURE generation for this dimension (set as the dimension's 'importedFeatures' field). Placed features are ores, trees, plants, springs, geodes and every other decoration entry a biome declares. This is OFF by default: with 'enabled' false Iris generates exactly the terrain it always has and no native feature runs. With it true, every placed feature the biome's vanilla derivative declares runs over Iris terrain, in vanilla step order, on the same worldgen thread vanilla uses. Carvers are never imported - Iris has no NoiseGeneratorSettings, so there is nothing for a carver to carve against. Family matching on 'disabled' uses namespace, slash, or underscore boundaries, so 'minecraft:ore' covers every vanilla ore feature without matching unrelated names.") -@Data -public class IrisImportedFeatureControl { - @Desc("Master switch. False (the default) means no native placed feature generates and chunk output is identical to a pack without this block at all. True runs the vanilla decoration feature pass over Iris terrain.") - private boolean enabled = false; - - @ArrayType(type = String.class, min = 1) - @Desc("Placed feature keys to deny explicitly, e.g. 'minecraft:ore_diamond'. A namespace:path prefix also matches, so 'minecraft:ore' denies every vanilla ore and 'minecraft:trees' denies every tree placement. Every key not matched here generates while 'enabled' is true.") - private KList disabled = new KList<>(); - - @ArrayType(type = IrisDecorationStep.class, min = 1) - @Desc("Restrict feature generation to these decoration steps only. Empty (the default) means every step is eligible. Use this to import ores without importing vegetation: set it to UNDERGROUND_ORES.") - private KList steps = new KList<>(); - - @ArrayType(type = IrisDecorationStep.class, min = 1) - @Desc("Decoration steps to deny. Applied after 'steps', so a step listed here never generates even if 'steps' allows it. VEGETAL_DECORATION is the usual entry for packs that grow their own trees.") - private KList disabledSteps = new KList<>(); - - /** - * True when this dimension wants the native feature pass at all. Every other accessor on this class is - * meaningless while this is false, and the platform must not build any feature machinery. - */ - public boolean shouldGenerateFeatures() { - return enabled; - } - - public boolean shouldGenerateStep(IrisDecorationStep step) { - if (!enabled) { - return false; - } - KList allowed = Objects.requireNonNull( - steps, "importedFeatures.steps must not be null"); - KList denied = Objects.requireNonNull( - disabledSteps, "importedFeatures.disabledSteps must not be null"); - if (step == null) { - // A step this Iris build does not know about (newer Minecraft): allow it unless the pack - // narrowed generation to an explicit step list. - return allowed.isEmpty(); - } - if (!allowed.isEmpty() && !allowed.contains(step)) { - return false; - } - return !denied.contains(step); - } - - public boolean shouldGenerate(String placedFeatureKey) { - return resolve(placedFeatureKey, null) == NativeFeatureGenerationStatus.GENERATE_NATIVE; - } - - /** - * Resolves one placed feature against this control. A null step skips the step gate, which is what the - * key-only query does. - */ - public NativeFeatureGenerationStatus resolve(String placedFeatureKey, IrisDecorationStep step) { - if (!enabled) { - return NativeFeatureGenerationStatus.FEATURES_DISABLED; - } - if (placedFeatureKey == null || placedFeatureKey.isBlank()) { - return NativeFeatureGenerationStatus.INVALID_REGISTRY_KEY; - } - if (step != null && !shouldGenerateStep(step)) { - return NativeFeatureGenerationStatus.STEP_DISABLED; - } - KList deniedKeys = Objects.requireNonNull( - disabled, "importedFeatures.disabled must not be null"); - for (String entry : deniedKeys) { - if (ImportedStructures.matchesKey(entry, placedFeatureKey)) { - return NativeFeatureGenerationStatus.DISABLED_BY_PACK; - } - } - return NativeFeatureGenerationStatus.GENERATE_NATIVE; - } -} diff --git a/src/main/java/art/arcane/iris/engine/object/decoration/NativeFeatureGenerationStatus.java b/src/main/java/art/arcane/iris/engine/object/decoration/NativeFeatureGenerationStatus.java deleted file mode 100644 index 8c828b99d..000000000 --- a/src/main/java/art/arcane/iris/engine/object/decoration/NativeFeatureGenerationStatus.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Iris is a World Generator for Minecraft Servers - * Copyright (c) 2026 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.decoration; - -public enum NativeFeatureGenerationStatus { - GENERATE_NATIVE, - FEATURES_DISABLED, - STEP_DISABLED, - DISABLED_BY_PACK, - CYCLE_DEGRADED, - INVALID_REGISTRY_KEY -} 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 327edb132..05269765d 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 @@ -18,7 +18,6 @@ package art.arcane.iris.engine.object.world.dimension; -import art.arcane.iris.engine.object.decoration.IrisImportedFeatureControl; import art.arcane.iris.engine.object.image.IrisImageMap; import art.arcane.iris.engine.object.image.IrisImageMapApplication; import art.arcane.iris.engine.object.image.IrisImageMapBinding; @@ -240,8 +239,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 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) @Desc("External datapack sources owned by this dimension. Bukkit registers their resources server-wide, but Iris excludes their structure sets and definitions from generation and locate state in vanilla worlds and Iris dimensions that do not declare the same source. Editable auto-import is limited to resources supplied by the URLs declared by each Iris pack. Any registered datapack structure can be placed directly through nativeStructures without conversion. Replacing native generation requires a dimension-level structure placement with nativeSuppression set to REPLACE_SOURCE; provenance alone never disables native structures.") private KList datapackImports = new KList<>();