mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
importedStructures becomes iris:structure settings; the native structure planner moves into the module's vanilla hook
builtin.structure: StructureSettings (feature iris:structure, target DIMENSION, the JSON of IrisImportedStructureControl: disabled, disabledExact, undergroundYShift, datapackOverrides, frequencyOverrides, adjustments), StructureSetFrequency, StructureAdjustment, IrisApi types only (fits are StructureTerrain, StructureStilts, YBand). ImportedStructures reads them: disables (family and exact keys), adjustment per structure and underground step, setup (frequencies, protecting vanilla definitions), matchesKey. NativeStartPlanner is the planner that was core's (selectSource, resolveBaseY, priority by placementIdentity, same RNG domain). StructureVanillaHook answers rule (REPLACE/BLOCK/ALSO_PLACE from placements and settings), adjustment, starts (planner plans as VanillaStructureStarts, heights above the bottom) and setup; StructureModule registers it and its settings. Deleted: IrisDimension.importedStructures, IrisImportedStructureControl, IrisVanillaStructureAdjustment, IrisStructureSetFrequencyOverride, RegistryListVanillaStructureSet, RegistryListVanillaStructure.prefixes.
This commit is contained in:
1 parent
c1f23830a2
commit
8a6bc5bfc0
13 files changed
+643
-304
No files matched your search
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.vanilla.StructureStilts;
|
||||
import com.volmit.vanilla.StructureTerrain;
|
||||
import com.volmit.vanilla.YBand;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/** One entry of {@link StructureSettings#adjustments()}: how the platform's own starts of the structures it matches are moved and fitted. */
|
||||
@Desc("A per-structure adjustment applied to vanilla, mod, and datapack structures that still generate natively (those NOT suppressed by an Iris 'structures' placement). Vertical shifts move the structure start, pieces, bounds, and jigsaw metadata together before references and placement. Intersecting trees are cleared automatically inside structure piece envelopes; optional postprocessing can build palette-driven foundation columns.")
|
||||
public final class StructureAdjustment {
|
||||
@MinItems(1)
|
||||
@Ref(Reference.STRUCTURE_PREFIX)
|
||||
@Desc("Structure keys this adjustment applies to, e.g. 'minecraft:stronghold'. A namespace:path prefix also matches, so 'minecraft:village' adjusts every village variant and 'minecraft:ruined_portal' adjusts every ruined portal. Empty matches nothing.")
|
||||
private List<String> match = List.of();
|
||||
|
||||
@MinNumber(-512)
|
||||
@MaxNumber(512)
|
||||
@Desc("Vertical block offset. Negative pushes the structure down, positive lifts it. The resolved shift is clamped so the structure remains inside the world's vertical build bounds.")
|
||||
private int yShift = 0;
|
||||
|
||||
@Desc("Optional absolute world Y band. The structure is relocated so its vertical midpoint lands inside the band, deterministically from its start chunk and clamped to the world's build bounds. Precedence: preserveSourceY wins over yBand, and yBand wins over both yShift and Iris burial repositioning. Structures with a fixed vanilla alignment (ocean monument sea level, desert and jungle pyramid surface fit) ignore it.")
|
||||
private YBand yBand = null;
|
||||
|
||||
@Desc("When true, skip Iris burial repositioning so the structure keeps the Y its own vanilla placement chose. Underground structures are otherwise pushed below the lowest solid column across their whole footprint, which hides terrain-aware structures such as mineshafts that intentionally breach cliffs and surfaces. Vertical shifts still apply on top of the preserved Y: this dimension's undergroundYShift plus every matching adjustment's yShift.")
|
||||
private boolean preserveSourceY = false;
|
||||
|
||||
@Desc("Optional foundation columns placed beneath the native structure piece bases after placement.")
|
||||
private StructureStilts stilt = null;
|
||||
|
||||
@Desc("Optional terrain integration override. VACUUM raises surface terrain from processed solid rigid-template foundations at or below each authored ground plane with a 12-block falloff without lowering existing ground. BORE and FORCE_CARVE clear every intersecting chunk before native pieces are placed, while ENCASE fills it with solid blocks instead. Left unset, SOURCE replays the registered structure's authored terrain adaptation, including surface fitting, burial, and encapsulation.")
|
||||
private StructureTerrain terrain = null;
|
||||
|
||||
public StructureAdjustment() {
|
||||
}
|
||||
|
||||
public StructureAdjustment(List<String> match, int yShift, YBand yBand, boolean preserveSourceY, StructureStilts stilt,
|
||||
StructureTerrain terrain) {
|
||||
this.match = List.copyOf(match);
|
||||
this.yShift = yShift;
|
||||
this.yBand = yBand;
|
||||
this.preserveSourceY = preserveSourceY;
|
||||
this.stilt = stilt;
|
||||
this.terrain = terrain;
|
||||
}
|
||||
|
||||
/** Family patterns of the structures this adjustment applies to. */
|
||||
public List<String> match() {
|
||||
return StructureSettings.listOrEmpty(match);
|
||||
}
|
||||
|
||||
public int yShift() {
|
||||
return yShift;
|
||||
}
|
||||
|
||||
public Optional<YBand> yBand() {
|
||||
return Optional.ofNullable(yBand);
|
||||
}
|
||||
|
||||
public boolean preserveSourceY() {
|
||||
return preserveSourceY;
|
||||
}
|
||||
|
||||
public Optional<StructureStilts> stilt() {
|
||||
return Optional.ofNullable(stilt);
|
||||
}
|
||||
|
||||
public Optional<StructureTerrain> terrain() {
|
||||
return Optional.ofNullable(terrain);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
|
||||
/** One entry of {@link StructureSettings#frequencyOverrides()}: how often the structures of one platform structure set start. */
|
||||
@Desc("An exact registered structure-set frequency multiplier. Iris retains the set's structures, weights, biome eligibility, placement algorithm, salt, exclusion zone, starts, processors, mobs, loot, and locate behavior while scaling only its native placement density.")
|
||||
public final class StructureSetFrequency {
|
||||
@Ref(Reference.STRUCTURE_SET)
|
||||
@Desc("Exact registered structure-set key, for example 'minecraft:nether_complexes'. Structure keys such as 'minecraft:fortress' are not valid here.")
|
||||
private String structureSet = "";
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(16)
|
||||
@Desc("Requested placement-density multiplier. Random-spread sets scale their placement frequency first and then their integer chunk spacing; integer spacing and separation constraints can make the realized increase slightly lower or higher. The default 1 leaves the registered placement unchanged.")
|
||||
private double multiplier = 1D;
|
||||
|
||||
public StructureSetFrequency() {
|
||||
}
|
||||
|
||||
public StructureSetFrequency(String structureSet, double multiplier) {
|
||||
this.structureSet = structureSet;
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public String structureSet() {
|
||||
return structureSet == null ? "" : structureSet;
|
||||
}
|
||||
|
||||
public double multiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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.structure;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* How a dimension treats the platform's own structures (vanilla, data pack and mod structures), written as
|
||||
* {@code "iris:structure": {"disabled": [...], "adjustments": [...]}}: which ones it disables, how the ones that still
|
||||
* generate are moved and fitted, how often structure sets start, and whether installed data packs may replace the
|
||||
* platform's own definitions. The JSON packs wrote as {@code importedStructures}. IrisApi types only.
|
||||
*/
|
||||
@Desc("Controls native vanilla, mod, and ingested datapack structure generation for this dimension. 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 <dimension>' to dump every valid key. Only affects newly generated chunks and is separate from Iris structure placements.")
|
||||
@Feature(id = "iris:structure", name = "Structures", targets = Target.DIMENSION)
|
||||
public final class StructureSettings implements IrisFeature {
|
||||
@MinItems(1)
|
||||
@Ref(Reference.STRUCTURE_PREFIX)
|
||||
@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 List<String> disabled = List.of();
|
||||
|
||||
@MinItems(1)
|
||||
@Ref(Reference.STRUCTURE)
|
||||
@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 List<String> disabledExact = List.of();
|
||||
|
||||
@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;
|
||||
|
||||
@MinItems(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 List<StructureSetFrequency> frequencyOverrides = List.of();
|
||||
|
||||
@MinItems(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 List<StructureAdjustment> adjustments = List.of();
|
||||
|
||||
public StructureSettings() {
|
||||
}
|
||||
|
||||
public StructureSettings(List<String> disabled, List<String> disabledExact, int undergroundYShift, boolean datapackOverrides,
|
||||
List<StructureSetFrequency> frequencyOverrides, List<StructureAdjustment> adjustments) {
|
||||
this.disabled = List.copyOf(disabled);
|
||||
this.disabledExact = List.copyOf(disabledExact);
|
||||
this.undergroundYShift = undergroundYShift;
|
||||
this.datapackOverrides = datapackOverrides;
|
||||
this.frequencyOverrides = List.copyOf(frequencyOverrides);
|
||||
this.adjustments = List.copyOf(adjustments);
|
||||
}
|
||||
|
||||
/** Family patterns of the structures the dimension disables. */
|
||||
public List<String> disabled() {
|
||||
return listOrEmpty(disabled);
|
||||
}
|
||||
|
||||
/** Complete keys of the structures the dimension disables. */
|
||||
public List<String> disabledExact() {
|
||||
return listOrEmpty(disabledExact);
|
||||
}
|
||||
|
||||
public int undergroundYShift() {
|
||||
return undergroundYShift;
|
||||
}
|
||||
|
||||
public boolean datapackOverrides() {
|
||||
return datapackOverrides;
|
||||
}
|
||||
|
||||
public List<StructureSetFrequency> frequencyOverrides() {
|
||||
return listOrEmpty(frequencyOverrides);
|
||||
}
|
||||
|
||||
public List<StructureAdjustment> adjustments() {
|
||||
return listOrEmpty(adjustments);
|
||||
}
|
||||
|
||||
static <T> List<T> listOrEmpty(List<T> list) {
|
||||
return list == null ? List.of() : Collections.unmodifiableList(list);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user