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:
piexel committed 2026-10-10 18:16:20 +02:00
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);
}
}