mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
iris:vanilla-features: importedFeatures become module settings answered through VanillaFeatures, in the built-ins jar
New module iris:vanilla-features (VanillaFeaturesModule, no stages): ImportedFeaturesSettings (key importedFeatures, dimension; enabled, disabled, steps, disabledSteps as packs wrote them, steps as IrisApi DecorationStep) and the provider ImportedFeatures (generates / generatesStep / generatesFeature, same rules as IrisImportedFeatureControl). The family rule both importedFeatures and importedStructures use moves to art.arcane.iris.builtin.RegistryKeyFamily (ImportedStructures calls it). Listed in builtin-modules.txt and source-patterns.txt. Deleted: IrisImportedFeatureControl, IrisDecorationStep, NativeFeatureGenerationStatus and IrisDimension.importedFeatures. README.
This commit is contained in:
1 parent
6ff5664f4e
commit
71d0780fcb
12 files changed
+268
-264
No files matched your search
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<String> 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<DecorationStep> 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<DecorationStep> 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<String> disabled() {
|
||||
return listOrEmpty(disabled);
|
||||
}
|
||||
|
||||
/** The only decoration steps whose features generate; empty for every step. */
|
||||
public List<DecorationStep> steps() {
|
||||
return listOrEmpty(steps);
|
||||
}
|
||||
|
||||
/** Decoration steps whose features never generate, whatever {@link #steps} says. */
|
||||
public List<DecorationStep> disabledSteps() {
|
||||
return listOrEmpty(disabledSteps);
|
||||
}
|
||||
|
||||
private static <T> List<T> listOrEmpty(List<T> list) {
|
||||
return list == null ? List.of() : Collections.unmodifiableList(list);
|
||||
}
|
||||
}
|
||||
@@ -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<String> 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) {
|
||||
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<DecorationStep> 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<Entry<ImportedFeaturesSettings>> declared = world.settings().declared(ImportedFeaturesSettings.class);
|
||||
return declared.isEmpty() ? NONE : declared.getFirst().value();
|
||||
}
|
||||
}
|
||||
+51
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
-107
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<String> 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<IrisDecorationStep> 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<IrisDecorationStep> 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<IrisDecorationStep> allowed = Objects.requireNonNull(
|
||||
steps, "importedFeatures.steps must not be null");
|
||||
KList<IrisDecorationStep> 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<String> 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;
|
||||
}
|
||||
}
|
||||
-28
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.decoration;
|
||||
|
||||
public enum NativeFeatureGenerationStatus {
|
||||
GENERATE_NATIVE,
|
||||
FEATURES_DISABLED,
|
||||
STEP_DISABLED,
|
||||
DISABLED_BY_PACK,
|
||||
CYCLE_DEGRADED,
|
||||
INVALID_REGISTRY_KEY
|
||||
}
|
||||
@@ -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<IrisStructurePlacement> 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<String> datapackImports = new KList<>();
|
||||
|
||||
Reference in new issue
Block a user