Merge IrisModule into module/ with its history

git-subtree-dir: module
git-subtree-mainline: 925c942764
git-subtree-split: 27b0036450
This commit is contained in:
piexel committed 2026-11-06 16:52:56 +01:00
commit 68ae3c8d3a
391 files changed
+43895

No files matched your search

@@ -0,0 +1,39 @@
/*
* 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.modules.blocks;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.Level;
/** Whether a dimension shows the air smart boring writes as cobwebs, written as {@code "debugSmartBore": true}. */
@Desc("Write the air that smart boring places as cobwebs, to see where it bored.")
@Feature(id = "iris:blocks/debug-smart-bore", name = "Debug smart bore", key = "debugSmartBore", root = "show", targets = Level.DIMENSION)
public final class SmartBoreDebugSettings implements IrisFeature {
@Desc("Write the air that smart boring places as cobwebs, to see where it bored.")
private boolean show = false;
public SmartBoreDebugSettings() {
}
public boolean show() {
return show;
}
}
@@ -0,0 +1,56 @@
/*
* 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.modules.carve;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.ResourceRef;
import com.volmit.world.LinkedBiomes;
import com.volmit.world.PackBiome;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import java.util.Set;
/** A biome's {@code carvingBiome}, written as the biome key: it registers that biome with the pack's layout and is not applied as a substitute under carvings. */
@Desc("Registers the referenced biome with this pack's reachable biome set. It is NOT applied as a substitute under carvings; cave biomes come from the region's caveBiomes list.")
@Feature(id = "iris:carve/biome", name = "Carving biome", key = "carvingBiome", root = "biome", targets = Level.BIOME)
public final class CarvingBiomeSettings implements IrisFeature, LinkedBiomes {
@ResourceRef(PackBiome.class)
@Desc("Registers the referenced biome with this pack's reachable biome set. It is NOT applied as a substitute under carvings; cave biomes come from the region's caveBiomes list.")
private String biome = "";
public CarvingBiomeSettings() {
}
public CarvingBiomeSettings(String biome) {
this.biome = biome;
}
public String biome() {
return biome == null ? "" : biome;
}
@Override
public Set<ResourceId> treeBiomes(PackResources pack) {
return biome().isBlank() ? Set.of() : Set.of(pack.idOf(biome()));
}
}
@@ -0,0 +1,43 @@
/*
* 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.modules.carve;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** A dimension's {@code carvingEnabled}, written as the bare boolean. */
@Desc("Enable or disable all carving for this dimension")
@Feature(id = "iris:carve/enabled", name = "Carving enabled", key = "carvingEnabled", root = "enabled", targets = Level.DIMENSION)
public final class CarvingEnabledSettings implements IrisFeature {
@Desc("Enable or disable all carving for this dimension")
private boolean enabled = true;
public CarvingEnabledSettings() {
}
public CarvingEnabledSettings(boolean enabled) {
this.enabled = enabled;
}
public boolean enabled() {
return enabled;
}
}
@@ -0,0 +1,103 @@
/*
* 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.modules.carve;
import com.volmit.config.Desc;
import com.volmit.config.Range;
import com.volmit.config.ResourceRef;
import com.volmit.world.PackBiome;
import com.volmit.config.Snippet;
import com.volmit.noise.NoiseStyle;
import java.util.Collections;
import java.util.List;
/**
* One dimension-level cave biome override, an entry of {@code carving}: a pack biome that replaces the cave biome within a band
* of world Y, optionally split into child entries by a noise pattern. IrisApi types only; {@code CarvingResolver} picks
* the entry for a position.
*/
@Snippet("iris/carve/dimension-carving-entry")
@Desc("Dimension-level cave biome override with absolute world Y bounds.")
public final class CarvingEntry {
private static final double DEFAULT_WORLD_Y_MIN = -64;
private static final double DEFAULT_WORLD_Y_MAX = 320;
private static final double DEFAULT_CHILD_SHRINK_FACTOR = 1.5;
private static final int DEFAULT_CHILD_RECURSION_DEPTH = 3;
@Desc("Stable id for this carving entry")
private String id = "";
@Desc("Enable or disable this carving entry")
private boolean enabled = true;
@ResourceRef(PackBiome.class)
@Desc("Cave biome to apply when world Y falls within worldYRange")
private String biome = "";
@Desc("Absolute world Y bounds where this carving entry applies")
private Range worldYRange = Range.of(DEFAULT_WORLD_Y_MIN, DEFAULT_WORLD_Y_MAX);
@Desc("If this carving entry has child carving entries, this controls how small those child carving patches are.")
private double childShrinkFactor = DEFAULT_CHILD_SHRINK_FACTOR;
@Desc("If this carving entry has child carving entries, this controls the shape pattern used to pick them.")
private NoiseStyle childStyle = NoiseStyle.of("CELLULAR_IRIS_DOUBLE");
@Desc("Child carving entry ids. Child ids can point back to parent ids to create cycles; recursion is bounded by childRecursionDepth.")
private List<String> children = List.of();
@Desc("Maximum recursion depth when resolving child carving entries from this entry.")
private int childRecursionDepth = DEFAULT_CHILD_RECURSION_DEPTH;
public CarvingEntry() {
}
public String id() {
return id == null ? "" : id;
}
public boolean enabled() {
return enabled;
}
public String biome() {
return biome == null ? "" : biome;
}
public Range worldYRange() {
return worldYRange;
}
public double childShrinkFactor() {
return childShrinkFactor;
}
public NoiseStyle childStyle() {
return childStyle;
}
public List<String> children() {
return children == null ? List.of() : Collections.unmodifiableList(children);
}
public int childRecursionDepth() {
return childRecursionDepth;
}
}
@@ -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.modules.carve;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.PackSettings;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.world.LinkedBiomes;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
/**
* The cave biome overrides a dimension declares, written as {@code "carving": [...]}, the list of {@link CarvingEntry}s.
* The biome of every enabled entry takes part in the pack's layout like any biome the dimension reaches.
*/
@Desc("Dimension-level cave biome carving overrides with absolute world Y ranges")
@Feature(id = "iris:carve/bands", name = "Cave biome bands", key = "carving", root = "entries", targets = Level.DIMENSION)
public final class CarvingSettings implements IrisFeature, LinkedBiomes {
@Desc("Dimension-level cave biome carving overrides with absolute world Y ranges")
private List<CarvingEntry> entries = List.of();
public CarvingSettings() {
}
public CarvingSettings(List<CarvingEntry> entries) {
this.entries = List.copyOf(entries);
}
public List<CarvingEntry> entries() {
return entries == null ? List.of() : Collections.unmodifiableList(entries);
}
/**
* The biome key {@code reference} stands for: the biome of the entry with that id, ignoring surrounding blanks, or
* {@code reference} itself when no entry has the id. When several entries share an id the last one counts.
*/
public String biomeOf(String reference) {
CarvingEntry entry = null;
for (CarvingEntry candidate : entries()) {
if (candidate != null && !candidate.id().isBlank() && candidate.id().trim().equals(reference)) {
entry = candidate;
}
}
return entry == null ? reference : entry.biome();
}
@Override
public Set<ResourceId> usedBiomes(PackResources pack, PackSettings dimension) {
Set<ResourceId> biomes = new LinkedHashSet<>();
for (CarvingEntry entry : entries()) {
if (entry != null && entry.enabled() && entry.biome() != null && !entry.biome().isBlank()) {
biomes.add(pack.idOf(entry.biome()));
}
}
return biomes;
}
}
@@ -0,0 +1,47 @@
/*
* 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.modules.carve;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
/** A biome's {@code caveMinDepthBelowSurface}, written as the bare number of blocks. */
@Desc("Minimum depth below terrain surface required before this cave biome can be selected.")
@Feature(id = "iris:carve/min-depth", name = "Cave minimum depth", key = "caveMinDepthBelowSurface", root = "depth", targets = Level.BIOME)
public final class CaveDepthSettings implements IrisFeature {
@MinNumber(0)
@MaxNumber(256)
@Desc("Minimum depth below terrain surface required before this cave biome can be selected.")
private int depth = 0;
public CaveDepthSettings() {
}
public CaveDepthSettings(int depth) {
this.depth = depth;
}
public int depth() {
return depth;
}
}
@@ -0,0 +1,308 @@
/*
* 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.modules.carve;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.carve.CaveAnchorMode;
import art.arcane.iris.builtin.carve.CaveFieldModule;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Range;
import com.volmit.config.Snippet;
import com.volmit.noise.NoiseStyle;
import com.volmit.noise.StyledRange;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
/**
* A 3D cave profile as packs write it for a dimension, region or biome ({@code caveProfile}) or under
* {@code snippet/iris/carve/cave-profile/}: the noise fields that decide where caves are, how they meet the surface, where
* cave fluid may sit and how objects find anchors in them. A level that writes none has no profile, which is the
* same as one that is not {@code enabled}. IrisApi types only; the carving module builds the noise.
*/
@Snippet("iris/carve/cave-profile")
@Desc("Represents a configurable 3D cave profile.")
@Feature(id = "iris:carve/profile", name = "Cave profile", key = "caveProfile", targets = {Level.DIMENSION, Level.REGION, Level.BIOME})
public final class CaveProfile implements IrisFeature {
@Desc("Enable profile-driven cave carving.")
private boolean enabled = false;
@Desc("Global vertical bounds for profile cave carving, in engine-local Y where 0 is the bottom of the dimension, not world Y.")
private Range verticalRange = Range.of(0, 384);
@MinNumber(0)
@MaxNumber(128)
@Desc("Vertical fade range applied near cave profile min/max bounds to avoid abrupt hard-stop ceilings/floors.")
private int verticalEdgeFade = 20;
@MinNumber(0)
@MaxNumber(1)
@Desc("Strength of the vertical edge fade at cave profile min/max bounds.")
private double verticalEdgeFadeStrength = 0.18;
@Desc("Base density style for cave field generation.")
private NoiseStyle baseDensityStyle = NoiseStyle.of("CELLULAR_IRIS_DOUBLE");
@Desc("Detail density style blended into base caves.")
private NoiseStyle detailDensityStyle = NoiseStyle.of("SIMPLEX");
@Desc("Warp style used to distort cave coordinates.")
private NoiseStyle warpStyle = NoiseStyle.of("FLAT");
@MinNumber(0)
@Desc("Base cave field multiplier.")
private double baseWeight = 1;
@MinNumber(0)
@Desc("Detail cave field multiplier.")
private double detailWeight = 0.35;
@MinNumber(0)
@Desc("Coordinate warp strength for cave fields.")
private double warpStrength = 0;
@Desc("Threshold range used for carve cutoff decisions.")
private StyledRange densityThreshold = StyledRange.of(-0.2, 0.2, NoiseStyle.of("CELLULAR_IRIS_DOUBLE"));
@MinNumber(0)
@MaxNumber(1)
@Desc("Extra threshold bias subtracted from sampled threshold before carve tests.")
private double thresholdBias = 0.16;
@MinNumber(1)
@MaxNumber(8)
@Desc("Vertical sample step used while evaluating cave density.")
private int sampleStep = 1;
@Desc("Use adaptive cave density prediction so only threshold-adjacent cells fall back to full-resolution evaluation.")
private boolean adaptiveSampling = true;
@MinNumber(2)
@MaxNumber(4)
@Desc("Horizontal adaptive predictor tuning. The carver always samples the predictor grid at a fixed step of 8; values below 8 only widen the ambiguity margin slightly and do not tighten the grid.")
private int adaptiveSampleStep = 2;
@MinNumber(0)
@MaxNumber(1)
@Desc("Additional adaptive ambiguity margin used before the cave predictor falls back to exact sampling.")
private double adaptiveThresholdMargin = 0.04;
@MinNumber(0)
@MaxNumber(64)
@Desc("Minimum solid clearance below terrain surface where carving may occur.")
private int surfaceClearance = 4;
@Desc("Allow profile-driven cave carving to break through terrain surface in selected columns.")
private boolean allowSurfaceBreak = true;
@Desc("Noise style used to decide where surface-breaking cave columns are allowed.")
private NoiseStyle surfaceBreakStyle = NoiseStyle.of("SIMPLEX").withZoom(0.08);
@MinNumber(-1)
@MaxNumber(1)
@Desc("Minimum signed surface-break noise value required before near-surface carving is allowed.")
private double surfaceBreakNoiseThreshold = 0.62;
@MinNumber(0)
@MaxNumber(64)
@Desc("Near-surface depth window used for surface-break carve logic.")
private int surfaceBreakDepth = 18;
@MinNumber(0)
@MaxNumber(1)
@Desc("Additional threshold boost applied while carving in the surface-break depth window.")
private double surfaceBreakThresholdBoost = 0.2;
@MinNumber(0)
@MaxNumber(64)
@Desc("Minimum depth below terrain surface required for cave-only object anchor placement.")
private int objectMinDepthBelowSurface = 6;
@Desc("Additional layered cave-density modules.")
private List<CaveFieldModule> modules = List.of();
@Desc("Default cave anchor mode for cave-only object placement.")
private CaveAnchorMode defaultObjectAnchor = CaveAnchorMode.FLOOR;
@Desc("Default placement mode for cave objects. Only applies to placements that are still on the default CENTER_HEIGHT mode; an explicit mode on the placement always wins. Stilt modes tile the object base block down to the cave floor surface. FAST_MIN_STILT is recommended for cave objects to prevent floating.")
private ObjectPlaceMode defaultObjectPlaceMode;
@MinNumber(1)
@MaxNumber(8)
@Desc("Vertical scan step used while searching cave anchors.")
private int anchorScanStep = 1;
@MinNumber(1)
@MaxNumber(64)
@Desc("Maximum random column retries while searching a valid cave object anchor in the chunk.")
private int anchorSearchAttempts = 6;
@Desc("Allow cave fluid placement from the dimension fluid palette below fluid level.")
private boolean allowFluid = true;
@MinNumber(0)
@MaxNumber(64)
@Desc("Minimum depth below terrain surface required before cave fluid may be placed.")
private int fluidMinDepthBelowSurface = 12;
@Desc("Require solid floor support below cave fluid to reduce unsupported fluid flows.")
private boolean fluidRequiresFloor = true;
@Desc("Allow cave lava placement based on lava height.")
private boolean allowLava = true;
public CaveProfile() {
}
public boolean enabled() {
return enabled;
}
public Range verticalRange() {
return verticalRange;
}
public int verticalEdgeFade() {
return verticalEdgeFade;
}
public double verticalEdgeFadeStrength() {
return verticalEdgeFadeStrength;
}
public NoiseStyle baseDensityStyle() {
return baseDensityStyle;
}
public NoiseStyle detailDensityStyle() {
return detailDensityStyle;
}
public NoiseStyle warpStyle() {
return warpStyle;
}
public double baseWeight() {
return baseWeight;
}
public double detailWeight() {
return detailWeight;
}
public double warpStrength() {
return warpStrength;
}
public StyledRange densityThreshold() {
return densityThreshold;
}
public double thresholdBias() {
return thresholdBias;
}
public int sampleStep() {
return sampleStep;
}
public boolean adaptiveSampling() {
return adaptiveSampling;
}
public int adaptiveSampleStep() {
return adaptiveSampleStep;
}
public double adaptiveThresholdMargin() {
return adaptiveThresholdMargin;
}
public int surfaceClearance() {
return surfaceClearance;
}
public boolean allowSurfaceBreak() {
return allowSurfaceBreak;
}
public NoiseStyle surfaceBreakStyle() {
return surfaceBreakStyle;
}
public double surfaceBreakNoiseThreshold() {
return surfaceBreakNoiseThreshold;
}
public int surfaceBreakDepth() {
return surfaceBreakDepth;
}
public double surfaceBreakThresholdBoost() {
return surfaceBreakThresholdBoost;
}
public int objectMinDepthBelowSurface() {
return objectMinDepthBelowSurface;
}
public List<CaveFieldModule> modules() {
return modules == null ? List.of() : Collections.unmodifiableList(modules);
}
public CaveAnchorMode defaultObjectAnchor() {
return defaultObjectAnchor == null ? CaveAnchorMode.FLOOR : defaultObjectAnchor;
}
/** The mode cave objects take where their placement has none of its own; empty when the profile sets none. */
public Optional<ObjectPlaceMode> defaultObjectPlaceMode() {
return Optional.ofNullable(defaultObjectPlaceMode);
}
public int anchorScanStep() {
return anchorScanStep;
}
public int anchorSearchAttempts() {
return anchorSearchAttempts;
}
public boolean allowFluid() {
return allowFluid;
}
public int fluidMinDepthBelowSurface() {
return fluidMinDepthBelowSurface;
}
public boolean fluidRequiresFloor() {
return fluidRequiresFloor;
}
public boolean allowLava() {
return allowLava;
}
}
@@ -0,0 +1,43 @@
/*
* 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.modules.carve;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** A dimension's {@code upperDimensionCarving}, written as the bare boolean. */
@Desc("When true, cave carving will cut through the upper dimension terrain. When false, the upper terrain is a solid untouched mass.")
@Feature(id = "iris:carve/upper-dimension", name = "Upper dimension carving", key = "upperDimensionCarving", root = "enabled", targets = Level.DIMENSION)
public final class UpperDimensionCarvingSettings implements IrisFeature {
@Desc("When true, cave carving will cut through the upper dimension terrain. When false, the upper terrain is a solid untouched mass.")
private boolean enabled = false;
public UpperDimensionCarvingSettings() {
}
public UpperDimensionCarvingSettings(boolean enabled) {
this.enabled = enabled;
}
public boolean enabled() {
return enabled;
}
}
@@ -0,0 +1,38 @@
/*
* 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.modules.decorant;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** Whether a dimension decorates at all, written as {@code "decorate": false}. A dimension without the key decorates. */
@Desc("Generate decorations or not")
@Feature(id = "iris:decorant/decorate", name = "Decorate", key = "decorate", root = "decorate", targets = Level.DIMENSION)
public final class DecorateSettings implements IrisFeature {
@Desc("Generate decorations or not")
private boolean decorate = true;
public DecorateSettings() {
}
public boolean decorate() {
return decorate;
}
}
@@ -0,0 +1,29 @@
/*
* 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.modules.deposit;
import com.volmit.config.Desc;
@Desc("Selects which biome identity is checked by a deposit's include and exclude filters.")
public enum DepositBiomeScope {
@Desc("Checks the surface biome selected for the deposit column.")
SURFACE,
@Desc("Checks the cave biome selected at the deposit origin.")
CAVE
}
@@ -0,0 +1,227 @@
/*
* 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.modules.deposit;
import com.volmit.block.BlockSpec;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Required;
import com.volmit.config.Snippet;
import java.util.Collections;
import java.util.List;
/**
* One kind of deposit a dimension, region or biome generates, as packs write it in the {@code "deposits"} list or under
* {@code snippet/iris/deposit/deposit/}: how many clumps of which blocks, how large, at which heights and in which biomes. A value
* of IrisApi types only; the deposit module builds the clumps and resolves the blocks.
*/
@Snippet("iris/deposit/deposit")
@Desc("Creates ore & other block deposits underground")
public final class DepositGenerator {
private static final int MAX_CLUMP_DIMENSION = 11;
@Required
@MinNumber(-8192)
@MaxNumber(8192)
@Desc("The inclusive minimum origin height in engine-local Y, where 0 is the bottom of the dimension. Negative values let an unclipped vanilla distribution taper into the world floor.")
private int minHeight = 1;
@Required
@MinNumber(-8192)
@MaxNumber(8192)
@Desc("The inclusive maximum origin height in engine-local Y, where 0 is the bottom of the dimension.")
private int maxHeight = 75;
@Desc("How origin heights are sampled. CLIPPED_UNIFORM preserves Iris behavior by clipping the band to terrain; UNIFORM and TRIANGLE sample the authored band first and discard cells outside terrain or build height.")
private DepositHeightDistribution heightDistribution = DepositHeightDistribution.CLIPPED_UNIFORM;
@Desc("TERRAIN places below the generated surface. ABOVE_TERRAIN places only in existing solid hosts above it. FULL_HEIGHT permits existing solid hosts anywhere in the dimension.")
private DepositPlacementScope placementScope = DepositPlacementScope.TERRAIN;
@MinNumber(0)
@MaxNumber(256)
@Desc("Solid blocks kept between a deposit and the terrain surface. Vanilla-like deposits use 0; the Iris default remains 7.")
private int surfaceClearance = 7;
@Required
@MinNumber(0)
@MaxNumber(8192)
@Desc("The minimum Iris block count or vanilla configured vein size, selected according to shape.")
private int minSize = 0;
@Required
@MinNumber(0)
@MaxNumber(8192)
@Desc("The maximum Iris block count or vanilla configured vein size, selected according to shape.")
private int maxSize = 128;
@Desc("IRIS places a fixed-count cube clump. VANILLA_ELLIPSOID uses Minecraft's chained ellipsoid geometry. VANILLA_SCATTERED uses Minecraft's sparse candidate offsets.")
private DepositShape shape = DepositShape.IRIS;
@Required
@MinNumber(0)
@MaxNumber(2048)
@Desc("The maximum amount of clumps per chunk")
private int maxPerChunk = 3;
@Required
@MinNumber(0)
@MaxNumber(2048)
@Desc("The minimum amount of clumps per chunk")
private int minPerChunk = 0;
@MinNumber(0)
@MaxNumber(1)
@Desc("The chance of the deposit spawning in a chunk")
private double spawnChance = 1;
@MinNumber(0)
@MaxNumber(1)
@Desc("The chance of each individual clump spawning in a chunk")
private double perClumpSpawnChance = 1;
@MinNumber(0)
@MaxNumber(1)
@Desc("Chance to discard a candidate ore block when it touches air. This matches vanilla ore exposure reduction.")
private double discardChanceOnAirExposure = 0;
@Required
@Desc("The palette of blocks to be used in this deposit generator. Each entry is picked uniformly; the per-entry weight field is ignored here.")
private List<BlockSpec> palette = List.of();
@MinNumber(1)
@MaxNumber(64)
@Desc("Ore varience is how many different objects clumps iris will create")
private int varience = 3;
@Desc("Optional block ids this deposit may replace. An empty list retains Iris's any-solid behavior.")
private List<String> replaceableBlocks = List.of();
@Desc("Chooses whether includedBiomes and excludedBiomes inspect the surface biome or the cave biome at the deposit origin.")
private DepositBiomeScope biomeScope = DepositBiomeScope.CAVE;
@Desc("Optional Iris biome keys or vanilla derivative ids allowed for this deposit.")
private List<String> includedBiomes = List.of();
@Desc("Optional Iris biome keys or vanilla derivative ids denied for this deposit.")
private List<String> excludedBiomes = List.of();
@Desc("If set to true, this deposit will replace bedrock")
private boolean replaceBedrock = false;
/** A generator with every option at its default, as packs get it from {@code {}}. */
public DepositGenerator() {
}
public int minHeight() {
return minHeight;
}
public int maxHeight() {
return maxHeight;
}
public DepositHeightDistribution heightDistribution() {
return heightDistribution == null ? DepositHeightDistribution.CLIPPED_UNIFORM : heightDistribution;
}
public DepositPlacementScope placementScope() {
return placementScope == null ? DepositPlacementScope.TERRAIN : placementScope;
}
public int surfaceClearance() {
return surfaceClearance;
}
public int minSize() {
return minSize;
}
public int maxSize() {
return maxSize;
}
public DepositShape shape() {
return shape == null ? DepositShape.IRIS : shape;
}
public int maxPerChunk() {
return maxPerChunk;
}
public int minPerChunk() {
return minPerChunk;
}
public double spawnChance() {
return spawnChance;
}
public double perClumpSpawnChance() {
return perClumpSpawnChance;
}
public double discardChanceOnAirExposure() {
return discardChanceOnAirExposure;
}
public List<BlockSpec> palette() {
return listOrEmpty(palette);
}
public int varience() {
return varience;
}
public List<String> replaceableBlocks() {
return listOrEmpty(replaceableBlocks);
}
public DepositBiomeScope biomeScope() {
return biomeScope == null ? DepositBiomeScope.CAVE : biomeScope;
}
public List<String> includedBiomes() {
return listOrEmpty(includedBiomes);
}
public List<String> excludedBiomes() {
return listOrEmpty(excludedBiomes);
}
public boolean replaceBedrock() {
return replaceBedrock;
}
/** The edge of the cube an {@link DepositShape#IRIS} clump of {@link #maxSize()} blocks fills, at most 11. */
public int maxDimension() {
return Math.min(MAX_CLUMP_DIMENSION, (int) Math.ceil(Math.cbrt(maxSize)));
}
/** Whether the biome filters need the cave biome at the deposit's origin. */
public boolean usesCaveBiomeFilter() {
return biomeScope() == DepositBiomeScope.CAVE && (!includedBiomes().isEmpty() || !excludedBiomes().isEmpty());
}
private static <T> List<T> listOrEmpty(List<T> list) {
return list == null ? List.of() : Collections.unmodifiableList(list);
}
}
@@ -0,0 +1,31 @@
/*
* 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.modules.deposit;
import com.volmit.config.Desc;
@Desc("Controls how a deposit chooses its origin height within the configured vertical band.")
public enum DepositHeightDistribution {
@Desc("Samples uniformly after clipping the configured band to the terrain and build-height bounds.")
CLIPPED_UNIFORM,
@Desc("Samples uniformly from the configured band, then rejects origins outside the terrain or build-height bounds.")
UNIFORM,
@Desc("Samples toward the middle of the configured band with a triangular distribution, then rejects invalid origins.")
TRIANGLE
}
@@ -0,0 +1,31 @@
/*
* 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.modules.deposit;
import com.volmit.config.Desc;
@Desc("Controls which vertical part of the world may contain a deposit origin.")
public enum DepositPlacementScope {
@Desc("Places in solid terrain below the generated surface while preserving the configured surface clearance.")
TERRAIN,
@Desc("Places only in existing solid hosts above the generated terrain surface.")
ABOVE_TERRAIN,
@Desc("Places in existing solid hosts anywhere within the dimension build height.")
FULL_HEIGHT
}
@@ -0,0 +1,49 @@
/*
* 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.modules.deposit;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.List;
/**
* The deposits one dimension, region or biome declares, written as {@code "deposits": [...]}, the list of generators. Levels stack:
* a chunk gets the deposits of its dimension, its centre column's region and that column's biome. IrisApi types only,
* like {@link DepositGenerator}.
*/
@Desc("Ores and other deposits generated in every chunk where this applies")
@Feature(id = "iris:deposit", name = "Deposits", key = "deposits", root = "generators", targets = {Level.DIMENSION, Level.REGION, Level.BIOME})
public final class DepositSettings implements IrisFeature {
@Desc("Define deposit generators that this applies to chunks")
private List<DepositGenerator> generators = List.of();
public DepositSettings() {
}
public DepositSettings(List<DepositGenerator> generators) {
this.generators = List.copyOf(generators);
}
public List<DepositGenerator> generators() {
return generators;
}
}
@@ -0,0 +1,31 @@
/*
* 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.modules.deposit;
import com.volmit.config.Desc;
@Desc("Selects the geometry used to build each deposit clump.")
public enum DepositShape {
@Desc("Builds the traditional Iris fixed-block-count cube clump.")
IRIS,
@Desc("Builds a chain of overlapping ellipsoids matching Minecraft's ordinary ore-vein geometry.")
VANILLA_ELLIPSOID,
@Desc("Builds sparse candidate offsets matching Minecraft's scattered-ore geometry.")
VANILLA_SCATTERED
}
@@ -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.modules.deposit;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Required;
import com.volmit.config.Snippet;
import java.util.Collections;
import java.util.Map;
/**
* One deposit ore remap rule, an entry of {@code depositVariants}: within a vertical band, ore blocks are rewritten to
* alternate blocks. A value of IrisApi types only; {@code ResolvedDepositVariant} resolves the blocks.
*/
@Snippet("iris/deposit/deposit-variant")
@Desc("Remaps ore block ids to alternate block ids within a vertical band. Ores declared at dimension, region, and biome scope can be rewritten at placement time (for example, iron_ore -> deepslate_iron_ore inside a deep carving band, or yourmod:iron -> yourmod:moon_iron inside a lunar biome).")
public final class DepositVariant {
@Required
@MinNumber(-2048)
@MaxNumber(8192)
@Desc("Inclusive minimum world Y this variant applies at.")
private int minHeight = 0;
@Required
@MinNumber(-2048)
@MaxNumber(8192)
@Desc("Inclusive maximum world Y this variant applies at.")
private int maxHeight = 0;
@Required
@Desc("Source block id (for example `minecraft:iron_ore`) -> replacement block id (for example `minecraft:deepslate_iron_ore`). Any block id the data loader resolves is accepted, including external/mod blocks. Source match is by material only, so block properties on the source key are ignored.")
private Map<String, String> remap = Map.of();
public DepositVariant() {
}
public int minHeight() {
return minHeight;
}
public int maxHeight() {
return maxHeight;
}
public Map<String, String> remap() {
return remap == null ? Map.of() : Collections.unmodifiableMap(remap);
}
}
@@ -0,0 +1,50 @@
/*
* 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.modules.deposit;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.Collections;
import java.util.List;
/**
* The deposit ore remap rules one dimension, region or biome declares, written as {@code "depositVariants": [...]}, the list
* of {@link DepositVariant}s. The biome's rules apply first, then the region's, then the dimension's; the first matching rule wins.
*/
@Desc("Deposit ore remap rules. Each entry declares a vertical band and a source->replacement block id map. Applied biome first, then region, then dimension; first matching rule wins.")
@Feature(id = "iris:deposit/variants", name = "Deposit variants", key = "depositVariants", root = "variants",
targets = {Level.DIMENSION, Level.REGION, Level.BIOME})
public final class DepositVariantSettings implements IrisFeature {
@Desc("Deposit ore remap rules. Each entry declares a vertical band and a source->replacement block id map. Applied biome first, then region, then dimension; first matching rule wins.")
private List<DepositVariant> variants = List.of();
public DepositVariantSettings() {
}
public DepositVariantSettings(List<DepositVariant> variants) {
this.variants = List.copyOf(variants);
}
public List<DepositVariant> variants() {
return variants == null ? List.of() : Collections.unmodifiableList(variants);
}
}
@@ -0,0 +1,49 @@
/*
* 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.modules.deposit;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
/** A biome's {@code oreDepositFrequencyMultiplier}, written as the bare number. */
@Desc("Multiplier applied to the frequency of every ore deposit whose center is inside this biome. A value of 0.4 keeps 40% of ore veins while leaving non-ore deposits unchanged.")
@Feature(id = "iris:deposit/ore-frequency", name = "Ore deposit frequency", key = "oreDepositFrequencyMultiplier", root = "multiplier", targets = Level.BIOME)
public final class OreFrequencySettings implements IrisFeature {
private static final double UNCHANGED = 1D;
@MinNumber(0)
@MaxNumber(1)
@Desc("Multiplier applied to the frequency of every ore deposit whose center is inside this biome. A value of 0.4 keeps 40% of ore veins while leaving non-ore deposits unchanged.")
private double multiplier = UNCHANGED;
public OreFrequencySettings() {
}
public OreFrequencySettings(double multiplier) {
this.multiplier = multiplier;
}
public double multiplier() {
return multiplier;
}
}
@@ -0,0 +1,49 @@
/*
* 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.modules.deposit;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
/** A biome's {@code oreDepositSizeMultiplier}, written as the bare number. */
@Desc("Multiplier applied to the block count of every ore deposit whose center is inside this biome. Non-ore deposits are unchanged.")
@Feature(id = "iris:deposit/ore-size", name = "Ore deposit size", key = "oreDepositSizeMultiplier", root = "multiplier", targets = Level.BIOME)
public final class OreSizeSettings implements IrisFeature {
private static final double UNCHANGED = 1D;
@MinNumber(0.01)
@MaxNumber(16)
@Desc("Multiplier applied to the block count of every ore deposit whose center is inside this biome. Non-ore deposits are unchanged.")
private double multiplier = UNCHANGED;
public OreSizeSettings() {
}
public OreSizeSettings(double multiplier) {
this.multiplier = multiplier;
}
public double multiplier() {
return multiplier;
}
}
@@ -0,0 +1,33 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.modules.floating;
import com.volmit.config.Desc;
@Desc("Controls how floating-child island underside blocks choose their palette.")
public enum FloatingBottomPaletteMode {
@Desc("Use the normal top-down biome layer depth for the whole island column.")
DEPTH,
@Desc("Use the target biome's top palette from both the island top and underside, meeting in the middle.")
MIRROR_TOP,
@Desc("Use bottomPalette near the underside and the target biome's normal palette near the top.")
CUSTOM
}
@@ -0,0 +1,390 @@
/*
* 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.modules.floating;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.builtin.terrain.PaletteLayer;
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;
import com.volmit.config.ResourceRef;
import com.volmit.config.Snippet;
import com.volmit.world.PackBiome;
import com.volmit.noise.NoiseStyle;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
/**
* A floating island above a biome's terrain, an entry of the biome's {@code floatingChildBiomes}: where its footprint
* is, how high it floats, how its top, underside and walls are shaped, and which objects, decorators and water it
* gets.
*/
@Snippet("iris/floating/floating-child-biome")
@Desc("Declares a floating biome layer above this biome's terrain. A 2D footprint noise decides which columns are part of the island (threshold + style control blankets, swirls, scattered blobs). The top profile is driven by the target biome's own terrain generators (so a mountains biome produces real peaks, desert produces real dunes). The bottom tail hanging below is a separately configurable noise (pick VASCULAR for drippy roots, FRACTAL_RM_SIMPLEX for crystalline spikes, PERLIN for smooth rounded bowls).")
public final class FloatingChildBiome {
public static final int DEFAULT_EDGE_TAPER_WIDTH = 10;
public static final double DEFAULT_EDGE_TAPER_EXPONENT = 1.0D;
private static final NoiseStyle DEFAULT_BOTTOM_STYLE = NoiseStyle.of("SIMPLEX");
private static final NoiseStyle DEFAULT_TOP_SHAPE_STYLE = NoiseStyle.of("SIMPLEX");
private static final NoiseStyle DEFAULT_ALTITUDE_STYLE = NoiseStyle.of("SIMPLEX");
private static final NoiseStyle DEFAULT_PICKER_STYLE = NoiseStyle.of("SIMPLEX");
private static final NoiseStyle DEFAULT_EDGE_TAPER_VARIATION_STYLE = NoiseStyle.of("SIMPLEX").withZoom(0.18D);
private static final NoiseStyle DEFAULT_FOOTPRINT_STYLE = NoiseStyle.of("SIMPLEX");
@ResourceRef(PackBiome.class)
@Desc("The target biome whose visual design (layers, palette, decorators, surface objects, derivative, and — when topShapeMode=BIOME — generator profile) drives the floating island. Leave empty to reuse the parent biome (self).")
private String biome = "";
@MinNumber(1)
@MaxNumber(512)
@Desc("Selection rarity when multiple floating child entries are defined on one parent biome. Lower is more common.")
private int rarity = 1;
@Desc("2D noise that decides which columns are part of this island. Set feature size via the style's own zoom field (e.g. {\"style\":\"CELLULAR\",\"zoom\":0.3} for ~30-block shards, {\"style\":\"SIMPLEX\",\"zoom\":1.0} for ~100-block blobs). Pick SIMPLEX for smooth blobs, CELLULAR for angular shards, VASCULAR for vein/branch strips, FRACTAL_FBM_SIMPLEX for large irregular blanket regions. Fracture (domain warp) this to get swirly silhouettes.")
private NoiseStyle footprintStyle = DEFAULT_FOOTPRINT_STYLE;
@MinNumber(0)
@MaxNumber(1)
@Desc("Coverage threshold (0..1). Roughly the fraction of the world that is NOT island: 0.0 = every column becomes island, 0.5 ≈ 50% of columns, 0.8 ≈ sparse scattered ~20% coverage, 1.0 = no islands at all. Values near 0.5 feel most natural.")
private double footprintThreshold = 0.5;
@MinNumber(2)
@MaxNumber(32)
@Desc("Width in blocks of the rounded transition from the floating island contour to its full thickness. Smaller values make a tighter edge; larger values make a broader rounded underside.")
private int edgeTaperWidth = DEFAULT_EDGE_TAPER_WIDTH;
@MinNumber(0.25)
@MaxNumber(4)
@Desc("Shape exponent for the rounded edge. Values below 1 fill into a softer, fuller curve; values above 1 keep the rim thinner before rising into the island interior.")
private double edgeTaperExponent = DEFAULT_EDGE_TAPER_EXPONENT;
@Desc("Broad 2D noise that organically varies the rounded edge without changing the island footprint. Low-frequency SIMPLEX or PERLIN styles give coherent natural contours; high-frequency or cellular styles can look speckled.")
private NoiseStyle edgeTaperVariationStyle = DEFAULT_EDGE_TAPER_VARIATION_STYLE;
@MinNumber(0)
@MaxNumber(8)
@Desc("Maximum number of blocks by which edgeTaperVariationStyle locally widens or narrows the rounded transition. 0 disables variation. Runtime keeps the resulting local width between 2 and 32 blocks so every protected rim column remains connected.")
private double edgeTaperVariationAmplitude = 0.0D;
@Desc("Picker noise used when multiple floating child entries exist. Samples once per column to deterministically choose which entry's footprint is tested there. Use a large style zoom (e.g. zoom: 4 for ~400-block regions) so each entry owns broad coherent areas.")
private NoiseStyle pickerStyle = DEFAULT_PICKER_STYLE;
@Desc("Altitude noise — varies the base platform Y across one island so it isn't a flat plane. Use a large style zoom (e.g. zoom: 2 for ~200-block altitude patches) so an island sits at roughly one altitude.")
private NoiseStyle altitudeStyle = DEFAULT_ALTITUDE_STYLE;
@MinNumber(0)
@MaxNumber(2032)
@Desc("Minimum absolute world Y where the island base can sit. Island altitude is independent of the parent biome's terrain height; altitudeStyle noise varies the base between min and max per column.")
private int minHeightAboveSurface = 160;
@MinNumber(0)
@MaxNumber(2032)
@Desc("Maximum absolute world Y where the island base can sit. Island altitude is independent of the parent biome's terrain height; altitudeStyle noise varies the base between min and max per column.")
private int maxHeightAboveSurface = 210;
@Desc("Optional absolute minimum world Y for the island base. When set, baseY is clamped upward so the tail bottom stays above this value.")
private Integer minAbsoluteY = null;
@Desc("Optional absolute maximum world Y for the island top. When set, the top is clamped downward.")
private Integer maxAbsoluteY = null;
@Desc("How the top profile of the island is shaped. BIOME = evaluate target biome's own generators (mountains biome -> real mountains). NOISE = use topShapeStyle as a user-controlled heightmap. FLAT = constant maxTopHeight slab.")
private TopShapeMode topShapeMode = TopShapeMode.BIOME;
@MinNumber(0)
@MaxNumber(512)
@Desc("Maximum top profile height in blocks above the island base. Caps how tall the biome terrain can grow on top.")
private int maxTopHeight = 40;
@Desc("Used only when topShapeMode=NOISE. 2D noise driving the top heightmap. Set feature scale via the style's zoom field (small zoom = rugged peaks, large zoom = broad rolling shapes).")
private NoiseStyle topShapeStyle = DEFAULT_TOP_SHAPE_STYLE;
@MinNumber(0)
@MaxNumber(1)
@Desc("Amplitude multiplier applied to the NOISE top profile. 0 = no top (flat at base), 1 = full maxTopHeight range.")
private double topShapeAmp = 1.0;
@Desc("2D noise driving the bottom tail hanging below the island base. VASCULAR = drippy organic roots. FRACTAL_RM_SIMPLEX = crystalline spikes. CELLULAR = jagged chunks. PERLIN = smooth rounded bowl. SIMPLEX = gentle lobes. Set feature scale via the style's zoom field.")
private NoiseStyle bottomStyle = DEFAULT_BOTTOM_STYLE;
@MinNumber(0)
@MaxNumber(512)
@Desc("Minimum blocks below the base where the tail extends.")
private int bottomDepthMin = 4;
@MinNumber(0)
@MaxNumber(512)
@Desc("Maximum blocks below the base where the tail extends.")
private int bottomDepthMax = 20;
@MinNumber(0.1)
@MaxNumber(8)
@Desc("Power curve applied to the bottom noise before mapping to depth. >1 = most columns shallow with occasional deeper spikes (sparse roots). <1 = most columns deep with occasional shallow spots (dense curtains). 1.0 = linear.")
private double bottomExponent = 1.0;
@Desc("Controls the material palette near the island underside. DEPTH keeps the old top-down depth behavior. MIRROR_TOP uses the target biome's shallow/top palette from the underside upward. CUSTOM uses bottomPalette near the underside while keeping the target biome palette near the top.")
private FloatingBottomPaletteMode bottomPaletteMode = FloatingBottomPaletteMode.DEPTH;
@Desc("Custom palette layers used near the underside when bottomPaletteMode=CUSTOM. The layer format is the same as normal biome layers.")
private List<PaletteLayer> bottomPalette = List.of();
@MinNumber(1)
@MaxNumber(512)
@Desc("Hard cap on the total Y-extent (top minus bottom) of a single island column. Safety limit.")
private int maxThickness = 96;
@Desc("Optional 3D noise that shifts the footprint's XZ sample position per Y layer — naturalizes the walls so they stop looking like a straight extrusion of the 2D footprint. Leave null to disable and keep straight vertical walls. Good defaults: {\"style\":\"SIMPLEX\",\"zoom\":0.25} for gentle undulation, {\"style\":\"FRACTAL_FBM_SIMPLEX\",\"zoom\":0.4} for craggier walls.")
private NoiseStyle wallWarpStyle;
@MinNumber(0)
@MaxNumber(64)
@Desc("Amplitude in blocks of the per-layer XZ shift applied when wallWarpStyle is set. 0 = no warp (straight walls). 4..8 = gentle naturalization. 16+ = heavily meandering walls. Ignored when wallWarpStyle is null.")
private double wallWarpAmplitude = 6.0;
@Desc("Optional 3D noise that swiss-cheeses the island interior by marking individual blocks as air when the noise exceeds carveThreshold. Leave null to keep the island solid. Good defaults: {\"style\":\"CELLULAR\",\"zoom\":0.3} for bubble pockets, {\"style\":\"VASCULAR\",\"zoom\":0.25} for wormy tunnels.")
private NoiseStyle carveStyle;
@Desc("Optional carving biome key or dimension carving entry id whose caveProfile drives floating-island internal air pockets. Dimension carving ids resolve first; biome keys such as carving/mushroom resolve second. When set, this overrides carveStyle while carveThreshold remains a final tuning bias.")
private String carving = "";
@MinNumber(0)
@MaxNumber(1)
@Desc("Threshold (0..1) above which carveStyle noise carves air pockets. 1.0 = no direct-noise carving. 0.75 = sparse pockets. 0.55 = heavy swiss-cheese. 0.4 = shredded lattice. When carving is set, lower values add a final positive threshold bias to the referenced caveProfile.")
private double carveThreshold = 1.0;
@Desc("Optional water surface height above the island base, in blocks. null = no internal water. Positive = water fills any dip in the top profile up to baseY + localFluidHeight (forms lakes/ponds in concavities of the biome-top heightmap).")
private Integer localFluidHeight = null;
@Desc("Block used for the internal water pool when localFluidHeight is positive.")
@Ref(Reference.BLOCK)
private String fluidBlock = "minecraft:water";
@Desc("When true, the target biome's decorators apply to the island's top surface.")
private boolean inheritDecorators = true;
@Desc("When true, the target biome's surface objects are placed on the island's top surface instead of the parent terrain.")
private boolean inheritObjects = true;
@MinNumber(0.01)
@MaxNumber(1)
@Desc("Uniform shrink factor applied to every object placed on this floating island (inherited, extra, and free-floating). 1.0 = native size, 0.5 = half size, 0.25 = quarter. Useful for making small floating biomes feel believable.")
private double objectShrinkFactor = 1.0;
@Desc("Additional object placements anchored to the island top.")
private List<ObjectPlacement> extraObjects = List.of();
@Desc("Additional object placements that float freely in air, independent of the island. Forced to ObjectPlaceMode.FLOATING.")
private List<ObjectPlacement> floatingObjects = List.of();
@Desc("Visualization color for this floating child in Iris Studio.")
private String color = null;
@Desc("Controls how topObjectOverrides are combined with the inherited surface objects from the target biome. INHERIT_ONLY (default) = behaves identically to before this field was added. MERGE = appends overrides after inherited objects. REPLACE = uses only overrides, ignoring all inherited objects.")
private OverrideMode topObjectMode = OverrideMode.INHERIT_ONLY;
@Desc("Controls how bottomObjectOverrides are combined. INHERIT_ONLY (default) = no bottom objects placed (there is no inherited bottom set). MERGE = same as REPLACE for bottom (no inherited source). REPLACE = uses bottomObjectOverrides list only.")
private OverrideMode bottomObjectMode = OverrideMode.INHERIT_ONLY;
@Desc("Object placements that override or supplement the inherited surface objects on the island TOP. Behaviour depends on topObjectMode. INHERIT_ONLY = this list is ignored. MERGE = appended after inherited. REPLACE = used instead of inherited.")
private List<ObjectPlacement> topObjectOverrides = List.of();
@Desc("Object placements anchored to the island BOTTOM face. Each entry is auto-inverted 180 degrees around the X axis and placed flush against the lowest solid face of the island, so objects appear to hang upside-down from the underside. WARNING: directional blocks (stairs, doors, slabs) will not render correctly when flipped — use non-directional content (logs, leaves, stone, mycelium, ice, glass) for bottom placements.")
private List<ObjectPlacement> bottomObjectOverrides = List.of();
public FloatingChildBiome() {
}
public String biome() {
return biome == null ? "" : biome;
}
public int rarity() {
return rarity;
}
public NoiseStyle footprintStyle() {
return footprintStyle == null ? DEFAULT_FOOTPRINT_STYLE : footprintStyle;
}
public double footprintThreshold() {
return footprintThreshold;
}
public int edgeTaperWidth() {
return edgeTaperWidth;
}
public double edgeTaperExponent() {
return edgeTaperExponent;
}
public NoiseStyle edgeTaperVariationStyle() {
return edgeTaperVariationStyle == null ? DEFAULT_EDGE_TAPER_VARIATION_STYLE : edgeTaperVariationStyle;
}
public double edgeTaperVariationAmplitude() {
return edgeTaperVariationAmplitude;
}
public NoiseStyle pickerStyle() {
return pickerStyle == null ? DEFAULT_PICKER_STYLE : pickerStyle;
}
public NoiseStyle altitudeStyle() {
return altitudeStyle == null ? DEFAULT_ALTITUDE_STYLE : altitudeStyle;
}
public int minHeightAboveSurface() {
return minHeightAboveSurface;
}
public int maxHeightAboveSurface() {
return maxHeightAboveSurface;
}
/** Empty where the pack sets none. */
public OptionalInt minAbsoluteY() {
return minAbsoluteY == null ? OptionalInt.empty() : OptionalInt.of(minAbsoluteY);
}
/** Empty where the pack sets none. */
public OptionalInt maxAbsoluteY() {
return maxAbsoluteY == null ? OptionalInt.empty() : OptionalInt.of(maxAbsoluteY);
}
public TopShapeMode topShapeMode() {
return topShapeMode == null ? TopShapeMode.BIOME : topShapeMode;
}
public int maxTopHeight() {
return maxTopHeight;
}
public NoiseStyle topShapeStyle() {
return topShapeStyle == null ? DEFAULT_TOP_SHAPE_STYLE : topShapeStyle;
}
public double topShapeAmp() {
return topShapeAmp;
}
public NoiseStyle bottomStyle() {
return bottomStyle == null ? DEFAULT_BOTTOM_STYLE : bottomStyle;
}
public int bottomDepthMin() {
return bottomDepthMin;
}
public int bottomDepthMax() {
return bottomDepthMax;
}
public double bottomExponent() {
return bottomExponent;
}
public FloatingBottomPaletteMode bottomPaletteMode() {
return bottomPaletteMode == null ? FloatingBottomPaletteMode.DEPTH : bottomPaletteMode;
}
public List<PaletteLayer> bottomPalette() {
return bottomPalette == null ? List.of() : Collections.unmodifiableList(bottomPalette);
}
public int maxThickness() {
return maxThickness;
}
/** Empty where the pack sets none. */
public Optional<NoiseStyle> wallWarpStyle() {
return Optional.ofNullable(wallWarpStyle);
}
public double wallWarpAmplitude() {
return wallWarpAmplitude;
}
/** Empty where the pack sets none. */
public Optional<NoiseStyle> carveStyle() {
return Optional.ofNullable(carveStyle);
}
public String carving() {
return carving == null ? "" : carving;
}
public double carveThreshold() {
return carveThreshold;
}
/** Empty where the pack sets none. */
public OptionalInt localFluidHeight() {
return localFluidHeight == null ? OptionalInt.empty() : OptionalInt.of(localFluidHeight);
}
public String fluidBlock() {
return fluidBlock == null ? "" : fluidBlock;
}
public boolean inheritDecorators() {
return inheritDecorators;
}
public boolean inheritObjects() {
return inheritObjects;
}
public double objectShrinkFactor() {
return objectShrinkFactor;
}
public List<ObjectPlacement> extraObjects() {
return extraObjects == null ? List.of() : Collections.unmodifiableList(extraObjects);
}
public List<ObjectPlacement> floatingObjects() {
return floatingObjects == null ? List.of() : Collections.unmodifiableList(floatingObjects);
}
public String color() {
return color == null ? "" : color;
}
public OverrideMode topObjectMode() {
return topObjectMode == null ? OverrideMode.INHERIT_ONLY : topObjectMode;
}
public OverrideMode bottomObjectMode() {
return bottomObjectMode == null ? OverrideMode.INHERIT_ONLY : bottomObjectMode;
}
public List<ObjectPlacement> topObjectOverrides() {
return topObjectOverrides == null ? List.of() : Collections.unmodifiableList(topObjectOverrides);
}
public List<ObjectPlacement> bottomObjectOverrides() {
return bottomObjectOverrides == null ? List.of() : Collections.unmodifiableList(bottomObjectOverrides);
}
}
@@ -0,0 +1,76 @@
/*
* 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.modules.floating;
import art.arcane.iris.modules.carve.CarvingSettings;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.PackSettings;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.world.LinkedBiomes;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
/**
* The floating child biomes one biome declares, written as {@code "floatingChildBiomes": [...]}, the list of
* {@link FloatingChildBiome}s. The target biome of every child, and the biome its {@code carving} names, take part in the
* pack's layout like any biome a dimension reaches.
*/
@Desc("Floating child biomes that procedurally generate above this biome's terrain. Each entry references a target biome whose layers, decorators, and objects drive the floating island's visual design, while the config here drives size, shape, altitude, rarity, and water level. Multiple entries are supported and selected by rarity per column unless mergeFloatingChildBiomes is enabled.")
@Feature(id = "iris:floating/children", name = "Floating child biomes", key = "floatingChildBiomes", root = "children", targets = Level.BIOME)
public final class FloatingChildSettings implements IrisFeature, LinkedBiomes {
@Desc("Floating child biomes that procedurally generate above this biome's terrain. Each entry references a target biome whose layers, decorators, and objects drive the floating island's visual design, while the config here drives size, shape, altitude, rarity, and water level. Multiple entries are supported and selected by rarity per column unless mergeFloatingChildBiomes is enabled.")
private List<FloatingChildBiome> children = List.of();
public FloatingChildSettings() {
}
public FloatingChildSettings(List<FloatingChildBiome> children) {
this.children = List.copyOf(children);
}
public List<FloatingChildBiome> children() {
return children == null ? List.of() : Collections.unmodifiableList(children);
}
@Override
public Set<ResourceId> usedBiomes(PackResources pack, PackSettings dimension) {
CarvingSettings carving = dimension.declared(CarvingSettings.class).dimension().orElse(null);
Set<ResourceId> biomes = new LinkedHashSet<>();
for (FloatingChildBiome child : children()) {
if (child != null) {
addBiome(pack, biomes, child.biome());
addBiome(pack, biomes, carving == null ? child.carving() : carving.biomeOf(child.carving()));
}
}
return biomes;
}
private static void addBiome(PackResources pack, Set<ResourceId> biomes, String key) {
if (key != null && !key.isBlank()) {
biomes.add(pack.idOf(key));
}
}
}
@@ -0,0 +1,37 @@
/*
* 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.modules.floating;
/**
* The face of one island an object is placed against, as {@code iris:floating} samples it: how high the face is, which
* blocks of the island are solid, and where the object may write without hanging in the air beside the island.
*/
public interface IslandAnchor {
/** The height of the face at the column; the anchor's own height where the island does not reach. */
int faceY(int worldX, int worldZ);
/** Whether an island lies in the column; where none does, the world's blocks say what is solid. */
boolean hasIsland(int worldX, int worldZ);
/** Whether the island of the column fills the block. */
boolean islandSolid(int worldX, int y, int worldZ);
/** Whether the object may write the block. */
boolean writes(int worldX, int y, int worldZ);
}
@@ -0,0 +1,38 @@
/*
* 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.modules.floating;
/**
* Where an object stands, in its own block positions: the columns holding a solid block ({@link #column} packs each), the
* tallest of them (most solid blocks, the lowest bottom on a tie) and the lowest solid block of that column.
*/
public record IslandFootprint(int tallestX, int tallestZ, int lowestSolidY, long[] columns) {
/** The column {@code x}, {@code z} packed as {@link #columns} holds it. */
public static long column(int x, int z) {
return ((long) x << 32) | (z & 0xFFFFFFFFL);
}
public static int columnX(long column) {
return (int) (column >> 32);
}
public static int columnZ(long column) {
return (int) (column & 0xFFFFFFFFL);
}
}
@@ -0,0 +1,43 @@
/*
* 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.modules.floating;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** A biome's {@code mergeFloatingChildBiomes}, written as the bare boolean. */
@Desc("When true, every floating child entry is sampled independently and their solid masks are unioned, so multiple floating islands can stack, overlap, and collide instead of the picker choosing only one child per column.")
@Feature(id = "iris:floating/merge", name = "Merge floating child biomes", key = "mergeFloatingChildBiomes", root = "merge", targets = Level.BIOME)
public final class MergeFloatingChildrenSettings implements IrisFeature {
@Desc("When true, every floating child entry is sampled independently and their solid masks are unioned, so multiple floating islands can stack, overlap, and collide instead of the picker choosing only one child per column.")
private boolean merge = false;
public MergeFloatingChildrenSettings() {
}
public MergeFloatingChildrenSettings(boolean merge) {
this.merge = merge;
}
public boolean merge() {
return merge;
}
}
@@ -0,0 +1,33 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.modules.floating;
import com.volmit.config.Desc;
@Desc("Controls how an override list is combined with the inherited object set from the target biome.")
public enum OverrideMode {
@Desc("Ignore the override list entirely. Use only the inherited objects from the target biome (subject to inheritObjects).")
INHERIT_ONLY,
@Desc("Append override list entries after the inherited objects from the target biome. Both sets are placed.")
MERGE,
@Desc("Use only the override list. The inherited objects from the target biome are discarded regardless of inheritObjects.")
REPLACE
}
@@ -0,0 +1,33 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.modules.floating;
import com.volmit.config.Desc;
@Desc("How the top profile of a floating-child island is shaped.")
public enum TopShapeMode {
@Desc("Evaluate the target biome's own terrain generators to build the island top. Mountains biome produces real peaks, desert produces dunes, plains is flat. Recommended default.")
BIOME,
@Desc("Drive the top profile from topShapeStyle noise, independent of the target biome's generators. Amplitude controlled by topShapeAmp.")
NOISE,
@Desc("Flat slab on top, topHeight blocks above the base. Ignores noise and biome generators.")
FLAT
}
@@ -0,0 +1,71 @@
/*
* 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.modules.loot;
import art.arcane.iris.builtin.loot.LootEntry;
import com.volmit.block.BlockSpec;
import com.volmit.config.Desc;
import com.volmit.config.Required;
import com.volmit.config.Snippet;
import java.util.Collections;
import java.util.List;
@Snippet("iris/loot/block-drops")
@Desc("Represents a block drop list")
public final class BlockDrop {
@Required
@Desc("The blocks that drop loot")
private List<BlockSpec> blocks = List.of();
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
private boolean exactBlocks = false;
@Desc("Add in specific items to drop")
private List<LootEntry> drops = List.of();
@Desc("If this is in a biome, setting skipParents to true will ignore the drops in the region and dimension for this block type. The default (false) will allow all three nodes to fire and add to a list of drops.")
private boolean skipParents = false;
@Desc("Removes the default vanilla block drops and only drops the given items & any parent loot tables specified for this block type.")
private boolean replaceVanillaDrops = false;
public BlockDrop() {
}
public List<BlockSpec> blocks() {
return blocks == null ? List.of() : Collections.unmodifiableList(blocks);
}
public boolean exactBlocks() {
return exactBlocks;
}
public List<LootEntry> drops() {
return drops == null ? List.of() : Collections.unmodifiableList(drops);
}
public boolean skipParents() {
return skipParents;
}
public boolean replaceVanillaDrops() {
return replaceVanillaDrops;
}
}
@@ -0,0 +1,46 @@
/*
* 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.modules.loot;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.Collections;
import java.util.List;
/**
* The block drops one dimension, region or biome declares, written as {@code "blockDrops": [...]}, the list of
* {@link BlockDrop}s. A broken block drops those of its biome, then, unless one of them skips its parents, those of its
* region and dimension.
*/
@Desc("Define custom block drops for this area")
@Feature(id = "iris:loot/drops", name = "Block drops", key = "blockDrops", root = "drops", targets = {Level.DIMENSION, Level.REGION, Level.BIOME})
public final class BlockDropSettings implements IrisFeature {
@Desc("Define custom block drops for this area")
private List<BlockDrop> drops = List.of();
public BlockDropSettings() {
}
public List<BlockDrop> drops() {
return drops == null ? List.of() : Collections.unmodifiableList(drops);
}
}
@@ -0,0 +1,64 @@
/*
* 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.modules.objects;
import com.volmit.geometry.BlockBox;
import com.volmit.mantle.CarvedVoid;
import com.volmit.mantle.MantleLayer;
import java.util.Optional;
/**
* The voids the cave carver planned in the mantle around the chunk being placed, which cave objects anchor in. Heights
* are above the dimension's bottom; outside the mantle the invocation reaches nothing is carved.
*/
public final class CarvedSpace {
private final MantleLayer<CarvedVoid> voids;
private final BlockBox reach;
public CarvedSpace(MantleLayer<CarvedVoid> voids, BlockBox reach) {
this.voids = voids;
this.reach = reach;
}
/** Whether the position is carved. */
public boolean isCarved(int x, int y, int z) {
return voidAt(x, y, z).isPresent();
}
/** Whether each height from 0 up to {@code height} is carved at the column, 1 for carved and 0 for not. */
public byte[] column(int x, int z, int height) {
int cappedHeight = Math.min(Math.max(height, 0), reach.maxY());
byte[] carvedColumn = new byte[cappedHeight];
for (int y = 0; y < cappedHeight; y++) {
if (reach.contains(x, y, z) && voids.get(x, y, z) != null) {
carvedColumn[y] = 1;
}
}
return carvedColumn;
}
/** The void at the position; empty where nothing was carved. */
public Optional<CarvedVoid> voidAt(int x, int y, int z) {
if (!reach.contains(x, y, z)) {
return Optional.empty();
}
return Optional.ofNullable(voids.get(x, y, z));
}
}
@@ -0,0 +1,32 @@
/*
* 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.modules.objects;
/**
* The outcome of placing an object in a cave.
*
* @param resultY the height the object was placed at, negative when the placement rejected it
* @param commit what became of the blocks the object wrote; {@link TerrainTransaction.Commit#EMPTY} for a rejected
* placement, {@link TerrainTransaction.Commit#REJECTED} when some block lay outside the cave
*/
public record CavePlacement(int resultY, TerrainTransaction.Commit commit) {
public boolean wroteBlocks() {
return commit == TerrainTransaction.Commit.COMMITTED;
}
}
@@ -0,0 +1,86 @@
/*
* 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.modules.objects;
import art.arcane.volmlib.util.cache.CacheKey;
import com.volmit.placement.PlacementTerrain;
import java.util.HashMap;
import java.util.Map;
/**
* Holds back what a cave object writes until all of it is known to lie inside the cave: in the world, no shallower than
* the burial depth under the surface and under the cave's ceiling at its column.
*/
public final class CaveTransaction extends TerrainTransaction {
private final int worldHeight;
private final int anchorY;
private final int minDepthBelowSurface;
private final Map<Long, Integer> surfaceHeights = new HashMap<>();
private final Map<Long, Integer> caveCeilings = new HashMap<>();
/** @param worldHeight the dimension's height in blocks */
public CaveTransaction(PlacementTerrain delegate, int worldHeight, int anchorY, int minDepthBelowSurface) {
super(delegate);
this.worldHeight = worldHeight;
this.anchorY = anchorY;
this.minDepthBelowSurface = Math.max(0, minDepthBelowSurface);
}
/** The first height above the anchor that the cave does not reach at the column. */
public int caveCeiling(int x, int z) {
return caveCeilings.computeIfAbsent(CacheKey.key(x, z), ignored -> findCaveCeiling(x, z));
}
/** The highest height an object buried {@code minDepthBelowSurface} under {@code surfaceY} may reach. */
public static int maxBuriedY(int worldHeight, int surfaceY, int minDepthBelowSurface) {
return Math.min(worldHeight - 1, surfaceY - Math.max(0, minDepthBelowSurface));
}
@Override
protected boolean accepts(int x, int y, int z) {
if (y < 0 || y >= worldHeight) {
return false;
}
if (y > maxBuriedY(worldHeight, surfaceHeight(x, z), minDepthBelowSurface)) {
return false;
}
return y < caveCeiling(x, z);
}
private int surfaceHeight(int x, int z) {
return surfaceHeights.computeIfAbsent(CacheKey.key(x, z), ignored -> delegate().highest(x, z, true));
}
private int findCaveCeiling(int x, int z) {
if (worldHeight <= 0 || anchorY < 0 || anchorY >= worldHeight) {
return 0;
}
if (!delegate().isCarved(x, anchorY, z)) {
return Math.min(worldHeight, anchorY + 1);
}
int scanLimit = Math.min(worldHeight - 1, Math.max(anchorY, surfaceHeight(x, z)));
for (int y = anchorY + 1; y <= scanLimit; y++) {
if (!delegate().isCarved(x, y, z)) {
return y;
}
}
return Math.min(worldHeight, scanLimit + 1);
}
}
@@ -0,0 +1,53 @@
/*
* 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.modules.objects;
import com.volmit.IrisFeature;
import com.volmit.config.FeatureSettings.Entry;
import com.volmit.config.Level;
import com.volmit.resource.ResourceId;
import com.volmit.world.PackWorld;
import java.util.ArrayList;
import java.util.List;
/**
* One region's or biome's declaration of settings, named by the id a {@link com.volmit.world.BiomeSample} gives the
* region or biome ({@code overworld:desert/dunes}) rather than the source id of its settings entry
* ({@code overworld:biome/desert/dunes}).
*/
public record Declaration<F extends IrisFeature>(Level level, ResourceId id, F settings) {
private static final char KIND_SEPARATOR = '/';
/** Every region and every reachable biome of {@code world}'s dimension that declares the settings, regions first. */
public static <F extends IrisFeature> List<Declaration<F>> allOf(PackWorld world, Class<F> type) {
List<Declaration<F>> found = new ArrayList<>();
for (Entry<F> entry : world.settings().declared(type)) {
if (entry.level() == Level.REGION || entry.level() == Level.BIOME) {
found.add(new Declaration<>(entry.level(), sampleId(entry.source()), entry.value()));
}
}
return found;
}
private static ResourceId sampleId(ResourceId source) {
String path = source.path();
return new ResourceId(source.namespace(), path.substring(path.indexOf(KIND_SEPARATOR) + 1));
}
}
@@ -0,0 +1,69 @@
/*
* 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.modules.objects;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.builtin.prepare.AxisRotationClamp;
import art.arcane.iris.builtin.prepare.ObjectRotation;
/** The object placement settings a placement is made with: its own, with the changes {@code iris:objects} makes for where it places them. */
public final class EffectiveSettings {
private static final double UPSIDE_DOWN_TURN_DEGREES = 180D;
private static final double QUARTER_TURN_DEGREES = 90D;
private EffectiveSettings() {
}
/** {@code base} with {@code changes} made to a copy of it; {@code base} itself when there are none. */
public static ObjectPlacement withChanges(ObjectPlacement base, PlacementChanges changes) {
if (changes.isNone()) {
return base;
}
ObjectPlacement.Builder changed = base.toBuilder();
if (changes.place() != null) {
changed.place(changes.place());
}
if (changes.mode() != null) {
changed.mode(changes.mode());
}
if (changes.upsideDown() != null && changes.upsideDown()) {
changed.rotation(upsideDownRotation());
}
if (changes.carvingSupport() != null) {
changed.carvingSupport(changes.carvingSupport());
}
if (changes.requireSurfaceSupport() != null) {
changed.requireSurfaceSupport(changes.requireSurfaceSupport());
}
if (changes.surfaceSupportBuffer() != null) {
changed.surfaceSupportBuffer(changes.surfaceSupportBuffer());
}
if (changes.forcePlace() != null) {
changed.forcePlace(changes.forcePlace());
}
return changed.build();
}
private static ObjectRotation upsideDownRotation() {
return ObjectRotation.of(true,
AxisRotationClamp.of(true, true, UPSIDE_DOWN_TURN_DEGREES, UPSIDE_DOWN_TURN_DEGREES, QUARTER_TURN_DEGREES),
AxisRotationClamp.of(true, false, 0D, 0D, QUARTER_TURN_DEGREES),
new AxisRotationClamp());
}
}
@@ -0,0 +1,107 @@
/*
* 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.modules.objects;
import com.volmit.block.BlockState;
import com.volmit.object.BlockEntityData;
import com.volmit.placement.PlacedMarker;
import com.volmit.placement.PlacementRecord;
import com.volmit.placement.PlacementTerrain;
import com.volmit.placement.StructureVolumes;
import java.util.Objects;
import java.util.Optional;
/** A terrain that answers everything as another does; subclasses change what they need. */
public abstract class ForwardingTerrain implements PlacementTerrain {
private final PlacementTerrain delegate;
protected ForwardingTerrain(PlacementTerrain delegate) {
this.delegate = Objects.requireNonNull(delegate, "delegate");
}
protected final PlacementTerrain delegate() {
return delegate;
}
@Override
public int highest(int x, int z, boolean ignoreFluid) {
return delegate.highest(x, z, ignoreFluid);
}
@Override
public BlockState get(int x, int y, int z) {
return delegate.get(x, y, z);
}
@Override
public void set(int x, int y, int z, BlockState state) {
delegate.set(x, y, z, state);
}
@Override
public void set(int x, int y, int z, BlockState state, BlockEntityData blockEntity) {
delegate.set(x, y, z, state, blockEntity);
}
@Override
public boolean isCarved(int x, int y, int z) {
return delegate.isCarved(x, y, z);
}
@Override
public boolean isSurfaceSolid(int x, int y, int z) {
return delegate.isSurfaceSolid(x, y, z);
}
@Override
public boolean isUnderwater(int x, int z) {
return delegate.isUnderwater(x, z);
}
@Override
public int fluidHeight() {
return delegate.fluidHeight();
}
@Override
public boolean preventsDecay() {
return delegate.preventsDecay();
}
@Override
public void recordPlacement(int x, int y, int z, PlacementRecord placement) {
delegate.recordPlacement(x, y, z, placement);
}
@Override
public Optional<PlacementRecord> placementAt(int x, int y, int z) {
return delegate.placementAt(x, y, z);
}
@Override
public StructureVolumes structureVolumes(int minX, int minZ, int maxX, int maxZ) {
return delegate.structureVolumes(minX, minZ, maxX, maxZ);
}
@Override
public void mark(PlacedMarker marker) {
delegate.mark(marker);
}
}
@@ -0,0 +1,69 @@
/*
* 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.modules.objects;
import com.volmit.block.BlockRegistry;
import com.volmit.block.BlockState;
import com.volmit.block.BlockTrait;
import com.volmit.block.PaletteSpec;
import com.volmit.object.ObjectBlock;
import com.volmit.object.PackObjects;
import com.volmit.object.PlaceableObject;
import com.volmit.resource.PackResources;
import java.util.List;
/**
* Builds objects block by block for the procedural objects, with blocks as the platform has them: the registry keeps a
* content plugin's block itself when a property is set on it or the object is built ({@link BlockRegistry}).
*/
public final class ObjectBuilder {
private final BlockRegistry blocks;
private final PackObjects objects;
public ObjectBuilder(PackResources resources) {
this.blocks = resources.blocks();
this.objects = resources.objects();
}
/** The platform's state for {@code key}; null when the platform has no such block. */
public BlockState block(String key) {
return blocks.find(key).orElse(null);
}
/** The block {@code palette} gives at the position when its noise is seeded with {@code seed}. */
public BlockState pick(PaletteSpec palette, long seed, int x, int y, int z) {
return blocks.palette(palette, seed).at(x, y, z);
}
/** Whether the platform gives {@code state} the trait, such as a log or air. */
public boolean has(BlockState state, BlockTrait trait) {
return blocks.hasTrait(state, trait);
}
/** {@code state} with the property set, as the platform sets it; {@code state} itself when the block does not accept it. */
public BlockState withPropertyIfAccepted(BlockState state, String name, String value) {
return blocks.withPropertyIfAccepted(state, name, value);
}
/** The object of {@code blocks}, put in their order, {@code width} by {@code height} by {@code depth}, placeable like the pack's objects. */
public PlaceableObject build(String name, int width, int height, int depth, List<ObjectBlock> blocks) {
return objects.build(name, width, height, depth, blocks);
}
}
@@ -0,0 +1,153 @@
/*
* 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.modules.objects;
import art.arcane.iris.builtin.IrisSeedPurposes;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.builtin.objects.ObjectScale;
import art.arcane.iris.builtin.objects.ScaleInterpolation;
import art.arcane.iris.engine.procedural.ProceduralObjectCatalog;
import art.arcane.volmlib.util.cache.CacheKey;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.noise.StyledRange;
import com.volmit.object.PackObjects;
import com.volmit.object.PlaceableObject;
import com.volmit.object.ScaleMethod;
import com.volmit.random.WorldRandom;
import com.volmit.resource.PackResources;
import com.volmit.world.PackWorld;
import java.util.List;
import java.util.Optional;
/**
* The pack's objects as object placements pick them: by key, scaled the way a placement scales them, and as many at a
* column as its density says, drawn from random streams and noise seeded by the world.
*/
public final class ObjectPool {
private static final double NO_SCALE = 1D;
private static final int MAX_SCALE_VARIANTS = 32;
private final PackResources resources;
private final long chunkSeed;
private final long densitySeed;
private final ProceduralObjectCatalog procedural;
private ObjectPool(PackResources resources, long chunkSeed, long densitySeed, ProceduralObjectCatalog procedural) {
this.resources = resources;
this.chunkSeed = chunkSeed;
this.densitySeed = densitySeed;
this.procedural = procedural;
}
/** The objects of {@code world}'s pack, its procedural objects among them. */
public static ObjectPool of(PackWorld world) {
return new ObjectPool(world.resources(), world.seed(IrisSeedPurposes.OBJECT_CHUNK),
world.seed(IrisSeedPurposes.OBJECT_DENSITY), ProceduralObjectCatalog.of(world));
}
/** The random a chunk's objects are placed with: the same for the same chunk of the same world. */
public RNG chunkRandom(int chunkX, int chunkZ) {
return new RNG(new WorldRandom(chunkSeed + CacheKey.key(chunkX, chunkZ)).nextLong());
}
/** The pack object {@code key} names; for a procedural pool, the variant {@code rng} picks. */
public Optional<PlaceableObject> object(String key, RNG rng) {
if (ProceduralObjectCatalog.isProceduralKey(key)) {
return procedural.object(key, rng);
}
return objects().object(resources.idOf(key));
}
/** An object of the placement, picked with {@code rng} and scaled the way the placement scales it; empty when it has none. */
public Optional<PlaceableObject> pickScaled(ObjectPlacement placement, RNG rng) {
List<String> keys = placement.place();
if (keys.isEmpty()) {
return Optional.empty();
}
return object(keys.get(rng.nextInt(keys.size())), rng).map(origin -> scaled(origin, placement.scale(), rng));
}
/** {@code origin} shrunk or grown by exactly {@code factor}, without filling between its blocks. */
public PlaceableObject resized(PlaceableObject origin, double factor) {
return factor == NO_SCALE ? origin : objects().scaled(origin, factor, ScaleMethod.NONE);
}
/** How many objects the placement places at the column, when its chance check passes: its fixed density, or what its density style gives there. */
public int density(ObjectPlacement placement, double x, double z) {
Optional<StyledRange> densityStyle = placement.densityStyle();
if (densityStyle.isEmpty()) {
return placement.density();
}
return (int) Math.round(densityStyle.get().at(resources.noise(), densitySeed, x, z));
}
/** Builds the noise the placement draws its density from and bakes its procedural objects, so the first chunk to place it does not wait. */
public void warm(ObjectPlacement placement) {
density(placement, 0, 0);
placement.place().stream().filter(ProceduralObjectCatalog::isProceduralKey).forEach(procedural::placeable);
}
private PlaceableObject scaled(PlaceableObject origin, ObjectScale scale, RNG rng) {
if (!shouldScale(scale)) {
return origin;
}
int variants = variantCount(scale);
int variant = variants == 1 ? 0 : rng.nextInt(variants);
return objects().scaled(origin, scaleAt(scale, variant, variants), methodOf(scale.interpolation()));
}
private PackObjects objects() {
return resources.objects();
}
private static boolean shouldScale(ObjectScale scale) {
if (scale.size() != NO_SCALE) {
return true;
}
return scale.variations() > 0 && (scale.minimumScale() != NO_SCALE || scale.maximumScale() != NO_SCALE);
}
/** How many evenly spread factors the scale picks from. */
private static int variantCount(ObjectScale scale) {
if (scale.size() != NO_SCALE || scale.minimumScale() == scale.maximumScale()) {
return 1;
}
return Math.max(1, Math.min(scale.variations(), MAX_SCALE_VARIANTS));
}
private static double scaleAt(ObjectScale scale, int variant, int variants) {
if (scale.size() != NO_SCALE) {
return scale.size();
}
if (scale.minimumScale() == scale.maximumScale()) {
return scale.minimumScale();
}
return scale.minimumScale() + (((scale.maximumScale() - scale.minimumScale()) / variants) * variant);
}
private static ScaleMethod methodOf(ScaleInterpolation interpolation) {
return switch (interpolation) {
case NONE -> ScaleMethod.NONE;
case TRILINEAR -> ScaleMethod.TRILINEAR;
case TRICUBIC -> ScaleMethod.TRICUBIC;
case TRIHERMITE -> ScaleMethod.TRIHERMITE;
};
}
}
@@ -0,0 +1,140 @@
package art.arcane.iris.modules.objects;
import art.arcane.iris.builtin.IrisSeedPurposes;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.builtin.objects.ObjectSettings;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.config.FeatureSettings;
import com.volmit.config.Level;
import com.volmit.config.SettingsStack;
import com.volmit.noise.NoiseSampler;
import com.volmit.noise.NoiseStyle;
import com.volmit.world.PackWorld;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
/**
* The chance and spacing of surface object placements in a world.
*
* <p>A separated placement rolls one candidate spot per chunk. The candidate stands only when no candidate of a lower rank,
* from a placement with the same objects, lies closer than the separation. Spots and ranks come from the world seed, the
* chunk and the objects alone, so every chunk agrees on them across chunk, biome and region borders, and objects never
* stand closer than the separation, whatever order chunks generate in.
*/
public final class ObjectSeparation {
private static final int CHUNK_WIDTH_BLOCKS = 16;
private static final int CHUNK_SHIFT = 4;
/** Placements read a chunk's settings at local 8, 8, as Iris always did. */
private static final int SETTINGS_COLUMN_OFFSET_BLOCKS = 8;
/** A chunk places the biome's objects before the region's, so the biome's placement speaks for the chunk. */
private static final List<Level> PLACING_LEVELS = List.of(Level.BIOME, Level.REGION);
private final PackWorld world;
private final long seed;
private final Map<NoiseStyle, NoiseSampler> chanceNoises = new ConcurrentHashMap<>();
private ObjectSeparation(PackWorld world) {
this.world = world;
this.seed = world.seed(IrisSeedPurposes.OBJECT_SEPARATION);
}
/** The separation of {@code world}. */
public static ObjectSeparation of(PackWorld world) {
return world.state(ObjectSeparation.class, ObjectSeparation::new);
}
/** The chance to place at the block column: the placement's chance, multiplied by its chance noise when it has one. */
public double chanceAt(ObjectPlacement placement, double x, double z) {
Optional<NoiseStyle> style = placement.chanceStyle();
if (style.isEmpty()) {
return placement.chance();
}
double noise = chanceNoises.computeIfAbsent(style.get(), declared -> world.resources().noise().sampler(declared, seed)).sample(x, z);
return placement.chance() * Math.max(0D, Math.min(1D, noise));
}
/**
* The candidate the chunk places for the separated placement; empty when it rolled none or a lower ranked one is too
* close. {@code settings} tells which placements the neighbouring chunks declare.
*/
public Optional<Candidate> keptCandidate(int chunkX, int chunkZ, ObjectPlacement placement, FeatureSettings settings) {
Optional<Candidate> own = candidateOf(chunkX, chunkZ, placement);
if (own.isEmpty() || isOutranked(own.get(), chunkX, chunkZ, placement, settings)) {
return Optional.empty();
}
return own;
}
private boolean isOutranked(Candidate own, int chunkX, int chunkZ, ObjectPlacement placement, FeatureSettings settings) {
int reach = placement.separation();
for (int x = Math.floorDiv(own.x() - reach, CHUNK_WIDTH_BLOCKS); x <= Math.floorDiv(own.x() + reach, CHUNK_WIDTH_BLOCKS); x++) {
for (int z = Math.floorDiv(own.z() - reach, CHUNK_WIDTH_BLOCKS); z <= Math.floorDiv(own.z() + reach, CHUNK_WIDTH_BLOCKS); z++) {
if (x == chunkX && z == chunkZ) {
continue;
}
int rivalX = x;
int rivalZ = z;
Optional<Candidate> rival = placementOfSameObjectsAt(rivalX, rivalZ, placement.place(), settings)
.flatMap(other -> candidateOf(rivalX, rivalZ, other));
if (rival.isPresent() && rival.get().rank() < own.rank() && rival.get().isCloserThan(own, reach)) {
return true;
}
}
}
return false;
}
private static Optional<ObjectPlacement> placementOfSameObjectsAt(int chunkX, int chunkZ, List<String> objects, FeatureSettings settings) {
int x = (chunkX << CHUNK_SHIFT) + SETTINGS_COLUMN_OFFSET_BLOCKS;
int z = (chunkZ << CHUNK_SHIFT) + SETTINGS_COLUMN_OFFSET_BLOCKS;
SettingsStack<ObjectSettings> declared = settings.at(ObjectSettings.class, x, z);
for (Level level : PLACING_LEVELS) {
Optional<ObjectPlacement> placing = declared.level(level).flatMap(placements -> separatedPlacing(placements, objects));
if (placing.isPresent()) {
return placing;
}
}
return Optional.empty();
}
private static Optional<ObjectPlacement> separatedPlacing(ObjectSettings settings, List<String> objects) {
return settings.objects().stream()
.filter(placement -> placement.isSeparated() && placement.carvingSupport().supportsSurface() && placement.place().equals(objects))
.findFirst();
}
private Optional<Candidate> candidateOf(int chunkX, int chunkZ, ObjectPlacement placement) {
RNG rng = new RNG(chunkSeed(chunkX, chunkZ, placement.place().hashCode()));
int x = (chunkX << CHUNK_SHIFT) + rng.nextInt(CHUNK_WIDTH_BLOCKS);
int z = (chunkZ << CHUNK_SHIFT) + rng.nextInt(CHUNK_WIDTH_BLOCKS);
if (!rng.chance(chanceAt(placement, x, z))) {
return Optional.empty();
}
return Optional.of(new Candidate(x, z, rng.nextLong(), rng));
}
// Each input is mixed in after the previous one: XORing scaled coordinates gave chunk x,z and -x,-z the same seed
// whenever both were odd.
private long chunkSeed(int chunkX, int chunkZ, int objectsHash) {
return splitMix(splitMix(splitMix(seed + objectsHash) + chunkX) + chunkZ);
}
private static long splitMix(long value) {
long mixed = value + 0x9E3779B97F4A7C15L;
mixed = (mixed ^ (mixed >>> 30)) * 0xBF58476D1CE4E5B9L;
mixed = (mixed ^ (mixed >>> 27)) * 0x94D049BB133111EBL;
return mixed ^ (mixed >>> 31);
}
/** Where a chunk would place, in block coordinates, with the random that picks and places the object there. */
public record Candidate(int x, int z, long rank, RNG rng) {
boolean isCloserThan(Candidate other, int blocks) {
long dx = x - other.x;
long dz = z - other.z;
return dx * dx + dz * dz < (long) blocks * blocks;
}
}
}
@@ -0,0 +1,23 @@
/*
* 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.modules.objects;
/** The size of an object, in blocks. */
public record ObjectSize(int width, int height, int depth) {
}
@@ -0,0 +1,73 @@
/*
* 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.modules.objects;
import com.volmit.object.GeneratedObject;
import com.volmit.object.PlaceableObject;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.tooling.SceneEntry;
import com.volmit.tooling.SceneView;
import com.volmit.world.PackWorld;
import java.util.List;
import java.util.Optional;
/** The studio's Objects view: every object in the pack, one scene each, listed under the folders of its file. */
public final class PackObjectScenes implements SceneView {
private static final ResourceId ID = ResourceId.parse("iris:objects");
private static final char FOLDER_SEPARATOR = '/';
@Override
public ResourceId id() {
return ID;
}
@Override
public String label() {
return "Objects";
}
@Override
public String description() {
return "Every object in the pack in 3D, with the blocks it is made of";
}
@Override
public List<SceneEntry> entries(PackWorld world) {
return world.resources().ids(PackResources.OBJECTS).stream()
.map(id -> entryOf(id.path()))
.toList();
}
@Override
public Optional<GeneratedObject> scene(PackWorld world, String key, int variant) {
if (variant != 0) {
return Optional.empty();
}
PackResources resources = world.resources();
return resources.objects().object(resources.idOf(key)).map(PlaceableObject::geometry);
}
private static SceneEntry entryOf(String key) {
int lastSeparator = key.lastIndexOf(FOLDER_SEPARATOR);
Optional<String> folder = lastSeparator < 0 ? Optional.empty() : Optional.of(key.substring(0, lastSeparator));
return new SceneEntry(key, key.substring(lastSeparator + 1), folder, 1);
}
}
@@ -0,0 +1,69 @@
/*
* 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.modules.objects;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.carve.CarvingMode;
import java.util.List;
/**
* How a placement differs from the settings it was read from, when {@code iris:objects} places it: a field that is
* null is left as the settings have it.
*
* @param place the objects the placement names, replacing the settings'
* @param mode the place mode
* @param upsideDown whether the object is turned over, for the objects hung from the terrain stacked above
* @param carvingSupport where the placement may place
* @param requireSurfaceSupport whether a surface placement needs solid ground under it
* @param surfaceSupportBuffer the buffer of solid ground around the object's base
* @param forcePlace whether the placement ignores the placement restrictions
*/
public record PlacementChanges(List<String> place, ObjectPlaceMode mode, Boolean upsideDown, CarvingMode carvingSupport,
Boolean requireSurfaceSupport, Integer surfaceSupportBuffer, Boolean forcePlace) {
public static final PlacementChanges NONE = new PlacementChanges(null, null, null, null, null, null, null);
public boolean isNone() {
return this.equals(NONE);
}
public PlacementChanges withPlace(List<String> place) {
return new PlacementChanges(place, mode, upsideDown, carvingSupport, requireSurfaceSupport, surfaceSupportBuffer, forcePlace);
}
public PlacementChanges withMode(ObjectPlaceMode mode) {
return new PlacementChanges(place, mode, upsideDown, carvingSupport, requireSurfaceSupport, surfaceSupportBuffer, forcePlace);
}
public PlacementChanges withUpsideDown(boolean upsideDown) {
return new PlacementChanges(place, mode, upsideDown, carvingSupport, requireSurfaceSupport, surfaceSupportBuffer, forcePlace);
}
public PlacementChanges withCarvingSupport(CarvingMode carvingSupport) {
return new PlacementChanges(place, mode, upsideDown, carvingSupport, requireSurfaceSupport, surfaceSupportBuffer, forcePlace);
}
public PlacementChanges withSurfaceSupport(boolean required, int buffer) {
return new PlacementChanges(place, mode, upsideDown, carvingSupport, required, buffer, forcePlace);
}
public PlacementChanges withForcePlace(boolean forcePlace) {
return new PlacementChanges(place, mode, upsideDown, carvingSupport, requireSurfaceSupport, surfaceSupportBuffer, forcePlace);
}
}
@@ -0,0 +1,31 @@
/*
* 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.modules.objects;
import com.volmit.placement.PlacementRecord;
/**
* What a placement writes into the mantle besides the blocks, beside each block of the object.
*
* @param marker the placement to record beside every block the object places, or null for none
* @param treeMaterial whether the block is also written as the tree material the mantle keeps for felling and growth
* @param buriedTreasure whether storage chests among the blocks are marked as buried treasure
*/
public record PlacementTags(PlacementRecord marker, boolean treeMaterial, boolean buriedTreasure) {
}
@@ -0,0 +1,252 @@
/*
* 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.modules.objects;
import art.arcane.iris.engine.procedural.part.PartBlob;
import art.arcane.iris.engine.procedural.part.PartBranches;
import art.arcane.iris.engine.procedural.part.PartCluster;
import art.arcane.iris.engine.procedural.part.PartOutline;
import art.arcane.iris.engine.procedural.part.PartStem;
import art.arcane.iris.engine.procedural.part.ProceduralDecoration;
import art.arcane.iris.engine.procedural.part.ProceduralMaterial;
import art.arcane.iris.engine.procedural.part.ProceduralObject;
import art.arcane.iris.engine.procedural.part.ProceduralPart;
import com.volmit.tooling.GraphNode;
import com.volmit.tooling.GraphNode.Addition;
import com.volmit.tooling.GraphNode.Edits;
import com.volmit.tooling.GraphNode.Link;
import com.volmit.tooling.GraphNode.NodeSettings;
import com.volmit.tooling.JsonPath;
import com.volmit.tooling.JsonText;
import com.volmit.tooling.NodeGraph;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.Set;
import java.util.stream.Stream;
/**
* A procedural object's file as nodes: the object, the parts growing from it, its materials and its decorations (v3e's
* node editor). Each part node is the part of the baked object it draws, so the studio can pick one from the other.
*/
final class ProceduralObjectGraph {
private static final String PARTS = "parts";
private static final String CHILDREN = "children";
private static final String COPIED_PART = "part";
private static final String MATERIALS = "materials";
private static final String DECORATIONS = "decorations";
private static final String ROLE = "role";
private static final String DECORATED_ROLES = "on";
private static final String DEFAULT_MATERIAL_ROLE = "main";
private static final String EACH_COPY = "each copy";
private static final String GROWS = "";
private static final Set<String> OBJECT_NODES = Set.of(MATERIALS, PARTS, DECORATIONS);
private static final Set<String> PART_NODES = Set.of(Shape.STEM.key, Shape.BLOB.key, Shape.BRANCHES.key, Shape.CLUSTER.key, CHILDREN);
private static final Set<String> COPY_NODES = Set.of(COPIED_PART);
private static final Set<String> NO_NODES = Set.of();
private final JsonText source;
private final PartOutline outline;
private ProceduralObjectGraph(JsonText source, PartOutline outline) {
this.source = source;
this.outline = outline;
}
/**
* @param read what the pack read from the file, so its parts line up with the file's; it may be older than
* {@code source}, and parts past what it read get no part id
* @throws IllegalArgumentException when the file does not hold an object
*/
static NodeGraph of(String name, JsonText source, ProceduralObject read) {
if (!(source.root() instanceof JsonText.Obj root)) {
throw new IllegalArgumentException("The file does not hold an object");
}
return new ProceduralObjectGraph(source, PartOutline.of(read)).graph(name, root, read);
}
private NodeGraph graph(String name, JsonText.Obj root, ProceduralObject read) {
JsonPath parts = JsonPath.ROOT.member(PARTS);
GraphNode object = new GraphNode("Object", name, JsonPath.ROOT, OptionalInt.empty(), List.of(),
List.of(new NodeSettings("Object", JsonPath.ROOT, ProceduralObject.class, OBJECT_NODES)),
parts(parts, root.get(PARTS), read.parts(), read.defaultRole()),
new Edits(Optional.of(parts), false, objectAdditions(parts)));
List<GraphNode> roots = new ArrayList<>();
roots.add(object);
roots.addAll(listed(MATERIALS, root.get(MATERIALS), NodeKind.MATERIAL, ProceduralMaterial.class));
roots.addAll(listed(DECORATIONS, root.get(DECORATIONS), NodeKind.DECORATION, ProceduralDecoration.class));
return new NodeGraph(roots);
}
// The pack read the file's arrays element for element, so the definition's lists line up with them.
private List<Link> parts(JsonPath arrayPath, Optional<JsonText.Value> array, List<ProceduralPart> read, String parentRole) {
if (!(array.orElse(null) instanceof JsonText.Arr elements)) {
return List.of();
}
List<Link> links = new ArrayList<>();
for (int index = 0; index < elements.elements().size(); index++) {
ProceduralPart part = index < read.size() ? read.get(index) : null;
links.add(new Link(GROWS, part(arrayPath.element(index), elements.elements().get(index), part, parentRole, true)));
}
return links;
}
private GraphNode part(JsonPath path, JsonText.Value json, ProceduralPart read, String parentRole, boolean movable) {
OptionalInt drawnPart = drawnPartOf(read);
if (!(json instanceof JsonText.Obj object)) {
return sharedPart(path, json, drawnPart, parentRole, movable);
}
String role = stringAt(object, ROLE).filter(written -> !written.isBlank()).orElse(parentRole);
List<NodeSettings> settings = new ArrayList<>();
settings.add(new NodeSettings("Part", path, ProceduralPart.class, PART_NODES));
List<Link> children = new ArrayList<>();
NodeKind kind = NodeKind.GROUP;
for (Shape shape : Shape.values()) {
if (!(object.get(shape.key).orElse(null) instanceof JsonText.Obj shapeObject)) {
continue;
}
kind = kind == NodeKind.GROUP || shape.copiesAPart() ? shape.kind : kind;
JsonPath shapePath = path.member(shape.key);
settings.add(new NodeSettings(shape.kind.label, shapePath, shape.settings, shape.copiesAPart() ? COPY_NODES : NO_NODES));
Optional<JsonText.Value> copied = shapeObject.get(COPIED_PART);
if (shape.copiesAPart() && copied.isPresent()) {
children.add(new Link(EACH_COPY, part(shapePath.member(COPIED_PART), copied.get(), copiedPartOf(read, shape), role, false)));
}
}
JsonPath childList = path.member(CHILDREN);
children.addAll(parts(childList, object.get(CHILDREN), read == null ? List.of() : read.children(), role));
return new GraphNode(kind.label, kind.label, path, drawnPart, List.of(role), settings, children,
new Edits(Optional.of(childList), movable, partAdditions(childList)));
}
// A part written as the name of a snippet file, which is edited there.
private GraphNode sharedPart(JsonPath path, JsonText.Value json, OptionalInt drawnPart, String parentRole, boolean movable) {
String title = json instanceof JsonText.Literal literal && literal.string().isPresent() ? literal.string().get() : source.textOf(json);
return new GraphNode(NodeKind.SHARED_PART.label, title, path, drawnPart, List.of(parentRole), List.of(), List.of(),
new Edits(Optional.empty(), movable, List.of()));
}
private OptionalInt drawnPartOf(ProceduralPart read) {
if (read == null) {
return OptionalInt.empty();
}
int id = outline.idOf(read);
return id == PartOutline.NO_PART ? OptionalInt.empty() : OptionalInt.of(id);
}
private static ProceduralPart copiedPartOf(ProceduralPart part, Shape shape) {
if (part == null) {
return null;
}
if (shape == Shape.BRANCHES) {
return part.branches() == null ? null : part.branches().part();
}
return part.cluster() == null ? null : part.cluster().part();
}
private static List<GraphNode> listed(String key, Optional<JsonText.Value> array, NodeKind kind, Class<?> settings) {
if (!(array.orElse(null) instanceof JsonText.Arr elements)) {
return List.of();
}
List<GraphNode> nodes = new ArrayList<>();
for (int index = 0; index < elements.elements().size(); index++) {
if (!(elements.elements().get(index) instanceof JsonText.Obj element)) {
continue;
}
JsonPath path = JsonPath.ROOT.member(key).element(index);
nodes.add(new GraphNode(kind.label, kind.label, path, OptionalInt.empty(), rolesOf(kind, element),
List.of(new NodeSettings(kind.label, path, settings, NO_NODES)), List.of(), Edits.NONE));
}
return nodes;
}
private static List<String> rolesOf(NodeKind kind, JsonText.Obj element) {
if (kind == NodeKind.MATERIAL) {
return List.of(stringAt(element, ROLE).orElse(DEFAULT_MATERIAL_ROLE));
}
if (!(element.get(DECORATED_ROLES).orElse(null) instanceof JsonText.Arr roles)) {
return List.of();
}
return roles.elements().stream()
.flatMap(role -> role instanceof JsonText.Literal literal ? literal.string().stream() : Stream.empty())
.toList();
}
private static Optional<String> stringAt(JsonText.Obj object, String key) {
return object.get(key).flatMap(value -> value instanceof JsonText.Literal literal ? literal.string() : Optional.empty());
}
/** What a new part starts as, so it bakes into something visible at once. */
private static List<Addition> partAdditions(JsonPath list) {
return List.of(
new Addition("Stem", list, "{\"stem\": {\"length\": 6}}"),
new Addition("Blob", list, "{\"blob\": {\"radius\": 2}}"),
new Addition("Branches", list, "{\"branches\": {\"count\": 4, \"part\": {\"stem\": {\"length\": 4}}}}"),
new Addition("Cluster", list, "{\"cluster\": {\"count\": 5, \"part\": {\"stem\": {\"length\": 3}}}}"),
new Addition("Group", list, "{}"));
}
private static List<Addition> objectAdditions(JsonPath parts) {
List<Addition> additions = new ArrayList<>(partAdditions(parts));
additions.add(new Addition("Material", JsonPath.ROOT.member(MATERIALS), "{\"role\": \"main\", \"block\": \"minecraft:stone\"}"));
additions.add(new Addition("Decoration", JsonPath.ROOT.member(DECORATIONS), "{\"block\": \"minecraft:vine\"}"));
return additions;
}
private enum NodeKind {
STEM("Stem"),
BLOB("Blob"),
BRANCHES("Branches"),
CLUSTER("Cluster"),
GROUP("Group"),
SHARED_PART("Shared part"),
MATERIAL("Material"),
DECORATION("Decoration");
private final String label;
NodeKind(String label) {
this.label = label;
}
}
/** The shapes a part can take, each written as a member of the part holding its settings. */
private enum Shape {
STEM("stem", NodeKind.STEM, PartStem.class),
BLOB("blob", NodeKind.BLOB, PartBlob.class),
BRANCHES("branches", NodeKind.BRANCHES, PartBranches.class),
CLUSTER("cluster", NodeKind.CLUSTER, PartCluster.class);
private final String key;
private final NodeKind kind;
private final Class<?> settings;
Shape(String key, NodeKind kind, Class<?> settings) {
this.key = key;
this.kind = kind;
this.settings = settings;
}
boolean copiesAPart() {
return this == BRANCHES || this == CLUSTER;
}
}
}
@@ -0,0 +1,98 @@
/*
* 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.modules.objects;
import art.arcane.iris.engine.procedural.ProceduralObjectCatalog;
import art.arcane.iris.engine.procedural.ProceduralVariants;
import art.arcane.iris.engine.procedural.part.ProceduralObject;
import com.volmit.object.GeneratedObject;
import com.volmit.object.PlaceableObject;
import com.volmit.resource.ResourceId;
import com.volmit.tooling.EditableSceneView;
import com.volmit.tooling.JsonText;
import com.volmit.tooling.NodeGraph;
import com.volmit.tooling.SceneEntry;
import com.volmit.tooling.SceneFile;
import com.volmit.world.PackWorld;
import java.util.List;
import java.util.Optional;
/**
* The studio's Procedural view: every procedural object of the pack with each of its variants, baked as the world
* bakes them, so what the studio shows is what generation places. Each object's file can be edited as nodes.
*/
public final class ProceduralObjectScenes implements EditableSceneView {
private static final ResourceId ID = ResourceId.parse("iris:objects/procedural");
private static final char FOLDER_SEPARATOR = '/';
@Override
public ResourceId id() {
return ID;
}
@Override
public String label() {
return "Procedural";
}
@Override
public String description() {
return "Trees, rock formations and more that Iris generates from settings, every variant in 3D";
}
@Override
public List<SceneEntry> entries(PackWorld world) {
ProceduralObjectCatalog catalog = ProceduralObjectCatalog.of(world);
return world.resources().ids(ProceduralObjectCatalog.DEFINITIONS).stream()
.flatMap(id -> catalog.variants(ProceduralObjectCatalog.KEY_PREFIX + id.path()).stream())
.map(ProceduralObjectScenes::entryOf)
.toList();
}
@Override
public Optional<GeneratedObject> scene(PackWorld world, String key, int variant) {
return ProceduralObjectCatalog.of(world).variants(ProceduralObjectCatalog.KEY_PREFIX + key)
.flatMap(variants -> variants.variant(variant))
.map(PlaceableObject::geometry);
}
@Override
public Optional<SceneFile> fileOf(PackWorld world, String key) {
ResourceId id = world.resources().idOf(key);
return world.resources().ids(ProceduralObjectCatalog.DEFINITIONS).contains(id)
? Optional.of(new SceneFile(ProceduralObjectCatalog.DEFINITIONS, id))
: Optional.empty();
}
// A file the pack could not read has no parts baked from it, so its nodes are drawn without part ids.
@Override
public NodeGraph graph(PackWorld world, String key, JsonText text) {
ProceduralObject read = world.resources().find(ProceduralObjectCatalog.DEFINITIONS, world.resources().idOf(key))
.orElseGet(ProceduralObject::new);
return ProceduralObjectGraph.of(key.substring(key.lastIndexOf(FOLDER_SEPARATOR) + 1), text, read);
}
private static SceneEntry entryOf(ProceduralVariants variants) {
String path = variants.path();
int lastSeparator = path.lastIndexOf(FOLDER_SEPARATOR);
Optional<String> folder = lastSeparator < 0 ? Optional.empty() : Optional.of(path.substring(0, lastSeparator));
return new SceneEntry(path, path.substring(lastSeparator + 1), folder, variants.variantCount());
}
}
@@ -0,0 +1,162 @@
/*
* 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.modules.objects;
import com.volmit.block.BlockState;
import com.volmit.geometry.BlockPosition;
import com.volmit.object.BlockEntityData;
import com.volmit.placement.PlacedMarker;
import com.volmit.placement.PlacementRecord;
import com.volmit.placement.PlacementTerrain;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* Holds back what an object writes until all of it is known to be acceptable, then writes everything in the order it was
* written, or nothing. Reads see the held writes. Subclasses say which blocks are acceptable.
*/
public abstract class TerrainTransaction extends ForwardingTerrain {
private final List<Write> writes = new ArrayList<>();
private final Map<BlockPosition, BlockState> heldBlocks = new HashMap<>();
private int blockWrites;
public enum Commit {
/** Everything was written. */
COMMITTED,
/** No block was written, so nothing was. */
EMPTY,
/** Some write was not acceptable, so nothing was written. */
REJECTED
}
protected TerrainTransaction(PlacementTerrain delegate) {
super(delegate);
}
/** Whether the transaction may write the block. */
protected abstract boolean accepts(int x, int y, int z);
public final Commit commit() {
if (blockWrites == 0) {
discard();
return Commit.EMPTY;
}
for (Write write : writes) {
BlockPosition position = write.position();
if (!accepts(position.x(), position.y(), position.z())) {
discard();
return Commit.REJECTED;
}
}
for (Write write : writes) {
write.applyTo(delegate());
}
discard();
return Commit.COMMITTED;
}
public final void discard() {
writes.clear();
heldBlocks.clear();
blockWrites = 0;
}
@Override
public BlockState get(int x, int y, int z) {
BlockState held = heldBlocks.get(new BlockPosition(x, y, z));
return held == null ? delegate().get(x, y, z) : held;
}
@Override
public void set(int x, int y, int z, BlockState state) {
holdBlock(new BlockWrite(new BlockPosition(x, y, z), state, null));
}
@Override
public void set(int x, int y, int z, BlockState state, BlockEntityData blockEntity) {
holdBlock(new BlockWrite(new BlockPosition(x, y, z), state, blockEntity));
}
@Override
public void recordPlacement(int x, int y, int z, PlacementRecord placement) {
writes.add(new PlacementWrite(new BlockPosition(x, y, z), placement));
}
@Override
public Optional<PlacementRecord> placementAt(int x, int y, int z) {
BlockPosition position = new BlockPosition(x, y, z);
for (int index = writes.size() - 1; index >= 0; index--) {
if (writes.get(index) instanceof PlacementWrite write && write.position().equals(position)) {
return Optional.of(write.placement());
}
}
return delegate().placementAt(x, y, z);
}
@Override
public void mark(PlacedMarker marker) {
writes.add(new MarkerWrite(marker));
}
private void holdBlock(BlockWrite write) {
writes.add(write);
heldBlocks.put(write.position(), write.state());
blockWrites++;
}
private sealed interface Write permits BlockWrite, PlacementWrite, MarkerWrite {
BlockPosition position();
void applyTo(PlacementTerrain terrain);
}
private record BlockWrite(BlockPosition position, BlockState state, BlockEntityData blockEntity) implements Write {
@Override
public void applyTo(PlacementTerrain terrain) {
if (blockEntity == null) {
terrain.set(position.x(), position.y(), position.z(), state);
} else {
terrain.set(position.x(), position.y(), position.z(), state, blockEntity);
}
}
}
private record PlacementWrite(BlockPosition position, PlacementRecord placement) implements Write {
@Override
public void applyTo(PlacementTerrain terrain) {
terrain.recordPlacement(position.x(), position.y(), position.z(), placement);
}
}
private record MarkerWrite(PlacedMarker marker) implements Write {
@Override
public BlockPosition position() {
return marker.position();
}
@Override
public void applyTo(PlacementTerrain terrain) {
terrain.mark(marker);
}
}
}
@@ -0,0 +1,50 @@
/*
* 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.modules.objects;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.Required;
import com.volmit.config.Snippet;
/** Whether a dimension's saplings grow the trees of its object placements, written as {@code "treeSettings": {...}}. */
@Snippet("iris/objects/tree-settings")
@Desc("Tree growth override settings")
@Feature(id = "iris:objects/trees", name = "Tree growth", key = "treeSettings", targets = Level.DIMENSION)
public final class TreeGrowthSettings implements IrisFeature {
@Required
@Desc("Turn replacing on and off")
private boolean enabled = false;
@Desc("Object picking modes")
private TreeMode mode = TreeMode.FIRST;
public TreeGrowthSettings() {
}
public boolean enabled() {
return enabled;
}
public TreeMode mode() {
return mode == null ? TreeMode.FIRST : mode;
}
}
@@ -0,0 +1,30 @@
/*
* 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.modules.objects;
import com.volmit.config.Desc;
@Desc("Sapling override object picking options")
public enum TreeMode {
@Desc("Check biome, then region, pick the first one that has options. Dimension placements are not consulted.")
FIRST,
@Desc("Check biome, regions, and dimensions, and pick any option from the total list")
ALL
}
@@ -0,0 +1,60 @@
/*
* 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.modules.placement;
import com.volmit.block.BlockRegistry;
import com.volmit.block.BlockState;
import com.volmit.block.BlockTrait;
import java.util.IdentityHashMap;
import java.util.Map;
/**
* The traits of the block states one placement handles, asked of the block registry once per state instance. A placement
* reads the same few states over and over and the platform looks every state up by its value, so the answers are kept by
* identity. For one placement on one thread.
*/
public final class BlockTraits {
private final BlockRegistry blocks;
private final Map<BlockState, TraitAnswers> answers = new IdentityHashMap<>();
public BlockTraits(BlockRegistry blocks) {
this.blocks = blocks;
}
public boolean has(BlockState state, BlockTrait trait) {
return answers.computeIfAbsent(state, ignored -> new TraitAnswers()).has(blocks, state, trait);
}
private static final class TraitAnswers {
private int asked;
private int held;
boolean has(BlockRegistry blocks, BlockState state, BlockTrait trait) {
int flag = 1 << trait.ordinal();
if ((asked & flag) == 0) {
if (blocks.hasTrait(state, trait)) {
held |= flag;
}
asked |= flag;
}
return (held & flag) != 0;
}
}
}
@@ -0,0 +1,86 @@
/*
* 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.modules.placement;
import art.arcane.volmlib.util.math.RNG;
/**
* Single-octave simplex noise over a plane that swings between -1 and 1, the rolling wave of a terrain bend's edge. It
* is a copy of the two-dimensional simplex of Iris's {@code SimplexNoise} and draws exactly what that draws for the same
* seed, so worlds bent before keep their edges; Iris pins the two against each other in a test.
*/
public final class EdgeSimplex {
private static final double FREQUENCY = 0.01;
private static final double F2 = 0.5 * (Math.sqrt(3.0) - 1.0);
private static final double G2 = (3.0 - Math.sqrt(3.0)) / 6.0;
private static final long X_PRIME = 1619;
private static final long Y_PRIME = 31337;
private static final long HASH_MULTIPLIER = 60493;
private static final double SCALE = 50;
private static final double[] GRADIENTS = {-1D, -1D, 1D, -1D, -1D, 1D, 1D, 1D, 0D, -1D, -1D, 0D, 0D, 1D, 1D, 0D};
private final long seed;
public EdgeSimplex(long seed) {
this.seed = new RNG(seed).lmax();
}
public double signed(double x, double z) {
return simplex(x * FREQUENCY, z * FREQUENCY);
}
private double simplex(double x, double y) {
double skew = (x + y) * F2;
long i = floor(x + skew);
long j = floor(y + skew);
double unskew = (i + j) * G2;
double x0 = x - (i - unskew);
double y0 = y - (j - unskew);
long i1 = x0 > y0 ? 1 : 0;
long j1 = x0 > y0 ? 0 : 1;
double x1 = x0 - i1 + G2;
double y1 = y0 - j1 + G2;
double x2 = x0 - 1 + (2 * G2);
double y2 = y0 - 1 + (2 * G2);
return SCALE * (corner(i, j, x0, y0) + corner(i + i1, j + j1, x1, y1) + corner(i + 1, j + 1, x2, y2));
}
private double corner(long cellX, long cellY, double x, double y) {
double falloff = 0.5 - x * x - y * y;
if (falloff < 0) {
return 0;
}
falloff *= falloff;
return falloff * falloff * gradient(cellX, cellY, x, y);
}
private double gradient(long cellX, long cellY, double x, double y) {
long hash = seed;
hash ^= X_PRIME * cellX;
hash ^= Y_PRIME * cellY;
hash = hash * hash * hash * HASH_MULTIPLIER;
hash = (hash >> 13) ^ hash;
int index = ((int) hash & 7) << 1;
return (x * GRADIENTS[index]) + (y * GRADIENTS[index + 1]);
}
private static long floor(double value) {
return value >= 0 ? (long) value : (long) value - 1;
}
}
@@ -0,0 +1,37 @@
/*
* 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.modules.placement;
import com.volmit.block.BlockState;
import java.util.List;
/**
* One marker of a placement, an entry of its {@code markers}, with its blocks resolved in the pack.
*
* @param marker the pack's marker to add
* @param targets the blocks to mark
* @param exact whether a block must match a target exactly; otherwise its material is enough
* @param maximum how many blocks to mark at most
*/
public record MarkerRule(String marker, List<BlockState> targets, boolean exact, int maximum) {
public MarkerRule {
targets = List.copyOf(targets);
}
}
@@ -0,0 +1,73 @@
/*
* 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.modules.placement;
import art.arcane.volmlib.util.math.IrisBlockVector;
import com.volmit.object.PlaceableObject;
import com.volmit.resource.ResourceId;
import com.volmit.world.PackWorld;
import java.util.List;
import java.util.Optional;
/** The object being placed as the placement stages see it: its declared size, the block its offsets count from, and where it must stand on solid ground. */
public final class ObjectShape {
private final PlaceableObject object;
private final PackWorld world;
ObjectShape(PlaceableObject object, PackWorld world) {
this.object = object;
this.world = world;
}
public int width() {
return object.width();
}
public int height() {
return object.height();
}
public int depth() {
return object.depth();
}
/** The block the object's offsets count from, relative to its corner. */
public int centerX() {
return object.center().x();
}
public int centerY() {
return object.center().y();
}
public int centerZ() {
return object.center().z();
}
/** The pack object this is, by the id the pack gives its name. */
public Optional<ResourceId> id() {
return Optional.of(world.resources().idOf(object.name()));
}
/** The columns of the object's lowest solid layer, as offsets from its anchor before any transform; empty for the origin only. */
public List<IrisBlockVector> surfaceSupportOffsets() {
return SurfaceSupportOffsets.of(world).of(object, world.resources().blocks());
}
}
@@ -0,0 +1,169 @@
/*
* 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.modules.placement;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.blocks.ObjectReplace;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.prepare.ObjectTranslate;
import art.arcane.iris.builtin.prepare.SlopeClip;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.validate.ObjectLimit;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
/** The settings of one object placement as the placement stages read them, its markers and collisions resolved in the pack. */
public final class PlacementSettings {
private final ObjectPlacement config;
private final PackResources resources;
public PlacementSettings(ObjectPlacement config, PackResources resources) {
this.config = config;
this.resources = resources;
}
public boolean forcePlace() {
return config.forcePlace();
}
public SlopeClip slopeCondition() {
return config.slopeCondition();
}
public boolean rotateTowardsSlope() {
return config.rotateTowardsSlope();
}
public ObjectRotation rotation() {
return config.rotation();
}
public ObjectTranslate translate() {
return config.translate();
}
public ObjectPlaceMode mode() {
return config.mode();
}
public boolean fromBottom() {
return config.fromBottom();
}
/** Whether the object places from the ground up instead of by height checks. */
public boolean bottom() {
return config.bottom();
}
public CarvingMode carvingSupport() {
return config.carvingSupport();
}
public boolean underwater() {
return config.underwater();
}
public boolean onwater() {
return config.onwater();
}
public boolean requireSurfaceSupport() {
return config.requireSurfaceSupport();
}
public int surfaceSupportBuffer() {
return config.surfaceSupportBuffer();
}
public int surfaceSupportDepth() {
return config.surfaceSupportDepth();
}
public ObjectLimit clamp() {
return config.clamp();
}
/** Whether air is placed before the object. */
public boolean bore() {
return config.bore();
}
public int boreExtendMinY() {
return config.boreExtendMinY();
}
public int boreExtendMaxY() {
return config.boreExtendMaxY();
}
public List<ObjectReplace> edit() {
return config.edit();
}
public boolean waterloggable() {
return config.waterloggable();
}
public boolean meld() {
return config.meld();
}
public List<MarkerRule> markers() {
return config.markers().stream()
.map(marker -> new MarkerRule(marker.marker(), marker.mark().stream().map(spec -> resources.blocks().resolve(spec)).toList(),
marker.exact(), marker.maximumMarkers()))
.toList();
}
public Optional<StiltSettings> stilt() {
return config.stiltSettings();
}
public Optional<VacuumSettings> vacuum() {
return config.vacuumSettings();
}
/** The snow filter's depth, 0 for none. */
public double snow() {
return config.snow();
}
/** The pack objects the placement may overlap even when {@link #forbiddenCollisions()} names them. */
public Set<ResourceId> allowedCollisions() {
return objectIds(config.allowedCollisions());
}
/** The pack objects the placement may not overlap. */
public Set<ResourceId> forbiddenCollisions() {
return objectIds(config.forbiddenCollisions());
}
private Set<ResourceId> objectIds(List<String> keys) {
return keys.stream().filter(Objects::nonNull).map(resources::idOf).collect(Collectors.toUnmodifiableSet());
}
}
@@ -0,0 +1,121 @@
/*
* 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.modules.placement;
import art.arcane.iris.builtin.anchor.AnchorHeight;
import art.arcane.iris.builtin.blocks.WrittenBlocks;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.stilt.StiltLayers;
import com.volmit.stage.BlockStage;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/**
* The stages of Iris's built-in object placement modules, one nested class per module, in the order a placement runs
* them. The stage graph decides the actual order.
*/
public final class PlacementStages {
private PlacementStages() {
}
/** Module {@code iris:prepare}: what a placement decides before it looks for its height. */
public static final class Prepare {
/** The rotation the placement uses: the requested one, turned downhill when the settings ask to face the slope. Rejects {@code slope}. */
public static final PlacementStage<ObjectRotation> SLOPE = Stage.placement("iris:prepare/slope", ObjectRotation.class);
/** The random rotation, translation and height offset, chosen once per placement. */
public static final PlacementStage<PreparedPlacement> TRANSFORMS = Stage.placement("iris:prepare/transforms", PreparedPlacement.class);
private Prepare() {
}
}
/** Module {@code iris:anchor}: the height an object is placed at. */
public static final class Anchor {
/** The requested or sampled height the checks judge. Rejects {@code carving-anchor}. */
public static final PlacementStage<AnchorHeight> HEIGHT = Stage.placement("iris:anchor/height", AnchorHeight.class);
/** The height the object's blocks are written at: the checked height plus the random offset. */
public static final PlacementStage<AnchorHeight> FINAL = Stage.placement("iris:anchor/final", AnchorHeight.class);
private Anchor() {
}
}
/** Module {@code iris:validate}: the checks that reject a placement before anything is written, in this order. */
public static final class Validate {
/** Rejects {@code bedrock-anchor} and {@code surface-support}. */
public static final PlacementStage<Void> SURFACE = Stage.placement("iris:validate/surface");
/** Rejects {@code underwater-anchor}, {@code cave-clearance}, {@code fluid-height} and {@code height-clamp}. */
public static final PlacementStage<Void> LIMITS = Stage.placement("iris:validate/limits");
/** Rejects {@code native-structure}, even for placements that force their way past the other checks. */
public static final PlacementStage<Void> STRUCTURES = Stage.placement("iris:validate/structures");
/** Rejects {@code object-collision}. */
public static final PlacementStage<Void> COLLISIONS = Stage.placement("iris:validate/collisions");
private Validate() {
}
}
/** Module {@code iris:bore}: clearing the object's volume before its blocks are written. */
public static final class Bore {
public static final PlacementStage<Void> CLEAR = Stage.placement("iris:bore/clear");
private Bore() {
}
}
/** Module {@code iris:blocks}: writing the object's blocks. */
public static final class Blocks {
/** Writes each object block where the placement puts it. */
public static final BlockStage<WrittenBlocks> WRITE = Stage.placementBlock("iris:blocks/write", WrittenBlocks.class);
/** Marks some written blocks with the placement's markers. */
public static final PlacementStage<Void> MARKERS = Stage.placement("iris:blocks/markers");
/** Milestone: stages requiring it run after the object and its markers are written. */
public static final PlacementStage<Void> COMPLETE = Stage.placement("iris:blocks/complete");
private Blocks() {
}
}
/** Module {@code iris:stilt}: the stilts of the stilt and ceiling placement modes. */
public static final class Stilt {
/** Finds the layers to repeat. */
public static final BlockStage<StiltLayers> LAYERS = Stage.placementBlock("iris:stilt/layers", StiltLayers.class);
/** Grows the stilt once the object is written. */
public static final PlacementStage<Void> FILL = Stage.placement("iris:stilt/fill");
private Stilt() {
}
}
/** Module {@code iris:vacuum}: bending the terrain to meet objects of the vacuum placement modes. */
public static final class Vacuum {
public static final PlacementStage<Void> TERRAIN = Stage.placement("iris:vacuum/terrain");
private Vacuum() {
}
}
/** Module {@code iris:snow}: snow on the object, after its stilt or terrain bend. */
public static final class Snow {
public static final PlacementStage<Void> COVER = Stage.placement("iris:snow/cover");
private Snow() {
}
}
}
@@ -0,0 +1,174 @@
/*
* 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.modules.placement;
import art.arcane.iris.builtin.anchor.PlaceMode;
import art.arcane.iris.builtin.anchor.PlaceTrait;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.prepare.ObjectSpinKernel;
import art.arcane.iris.builtin.prepare.TransformedBounds;
import art.arcane.volmlib.util.math.IrisBlockVector;
import com.volmit.block.BlockState;
import com.volmit.geometry.BlockPosition;
/**
* What one placement chose before it is anchored: the placement it belongs to, the settings it uses, the rotation it
* ended up with, the terrain that answers its height, water and carving questions, its random spin and height offsets,
* and the bounds of the transformed object around its anchor. Object blocks are transformed by rotating them, flipping
* them for a ceiling hang and translating them.
*/
public final class PreparedPlacement {
private final RunningPlacement placement;
private final PlacementSettings settings;
private final PlaceMode mode;
private final ObjectRotation rotation;
private final BlockTraits traits;
private final StageTerrain terrain;
private final ObjectSpinKernel spin;
private final int spinX;
private final int spinY;
private final int spinZ;
private final IrisBlockVector translation;
private final int rotatedCenterY;
private final int translatedCenterY;
private final int randomY;
private final int warpMargin;
private final TransformedBounds bounds;
private final SurfaceWarp surfaceWarp;
/** Everything the preparation worked out; {@code translation} and {@code surfaceWarp} are null when the placement has none. */
public PreparedPlacement(RunningPlacement placement, ObjectRotation rotation, BlockTraits traits, StageTerrain terrain,
ObjectSpinKernel spin, int spinX, int spinY, int spinZ, IrisBlockVector translation, int rotatedCenterY,
int translatedCenterY, int randomY, int warpMargin, TransformedBounds bounds, SurfaceWarp surfaceWarp) {
this.placement = placement;
this.settings = placement.settings();
this.mode = settings.mode().placeMode();
this.rotation = rotation;
this.traits = traits;
this.terrain = terrain;
this.spin = spin;
this.spinX = spinX;
this.spinY = spinY;
this.spinZ = spinZ;
this.translation = translation;
this.rotatedCenterY = rotatedCenterY;
this.translatedCenterY = translatedCenterY;
this.randomY = randomY;
this.warpMargin = warpMargin;
this.bounds = bounds;
this.surfaceWarp = surfaceWarp;
}
/** The placement being run. */
public RunningPlacement placement() {
return placement;
}
/** The settings the placement was asked for; the rotation may differ, see {@link #rotation()}. */
public PlacementSettings settings() {
return settings;
}
/** The rotation the placement uses, which may differ from the requested one. */
public ObjectRotation rotation() {
return rotation;
}
/** The traits of the block states this placement handles. */
public BlockTraits traits() {
return traits;
}
/** Answers height, water and carving questions; a heightmap placement answers heights from its noise. */
public StageTerrain terrain() {
return terrain;
}
public PlaceMode mode() {
return mode;
}
public int spinX() {
return spinX;
}
public int spinY() {
return spinY;
}
public int spinZ() {
return spinZ;
}
/** The rotated translation, or null when the placement does not translate. */
public IrisBlockVector translation() {
return translation;
}
/** The height of the object's center after rotation. */
public int rotatedCenterY() {
return rotatedCenterY;
}
/** The height of the object's center after translation. */
public int translatedCenterY() {
return translatedCenterY;
}
/** The random height offset added once the anchor is final. */
public int randomY() {
return randomY;
}
public int warpMargin() {
return warpMargin;
}
public TransformedBounds bounds() {
return bounds;
}
public boolean isWarped() {
return surfaceWarp != null;
}
/** Moves a world column by the surface warp, along X for {@code x} and along Z for the swapped call. */
public int warpOffset(double along, double y, double across) {
double half = surfaceWarp.multiplier() / 2D;
return (int) surfaceWarp.fit(-half, half, along, y, across);
}
/** An object block's offset from the anchor after this placement's transforms. */
public BlockPosition transform(BlockPosition local) {
IrisBlockVector offset = new IrisBlockVector(local.x(), local.y(), local.z());
spin.rotate(offset);
if (mode().has(PlaceTrait.UPSIDE_DOWN)) {
offset.setY(-offset.getBlockY());
}
if (translation != null) {
offset.add(translation);
}
return new BlockPosition((int) Math.round(offset.getX()), (int) Math.round(offset.getY()), (int) Math.round(offset.getZ()));
}
/** A block state turned with the object, so stairs and logs face the way the object does. */
public BlockState rotate(BlockState state) {
return placement.rotate(state, rotation, spinX, spinY, spinZ);
}
}
@@ -0,0 +1,185 @@
/*
* 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.modules.placement;
import art.arcane.iris.builtin.IrisSeedPurposes;
import art.arcane.iris.builtin.objects.HeightmapNoise;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.builtin.objects.ObjectRun;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.volmlib.util.math.IrisBlockVector;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.block.BlockRegistry;
import com.volmit.block.BlockState;
import com.volmit.block.BlockTrait;
import com.volmit.block.BlockTurn;
import com.volmit.geometry.BlockPosition;
import com.volmit.placement.PlacementContext;
import com.volmit.resource.PackResources;
import com.volmit.world.PackWorld;
import java.util.Optional;
/**
* The object placement being run, as Iris's built-in placement stages see it: what is placed and with which settings
* ({@link ObjectRun}, the run's input), the terrain it is placed on, and the block operations of the pack's registry.
* Heights are above the dimension's bottom.
*/
public final class RunningPlacement {
private static final double QUARTER_TURN_DEGREES = 90D;
private static final double FULL_TURN_DEGREES = 360D;
private final PlacementContext context;
private final ObjectRun run;
private final ObjectShape object;
private final PlacementSettings settings;
private final StageTerrain terrain;
private RunningPlacement(PlacementContext context, ObjectRun run) {
this.context = context;
this.run = run;
this.object = new ObjectShape(run.object(), context.world());
this.settings = new PlacementSettings(run.settings(), context.world().resources());
this.terrain = StageTerrain.of(context);
}
/** The placement {@code context} runs. */
public static RunningPlacement of(PlacementContext context) {
ObjectRun run = context.input(ObjectRun.class).orElseThrow(() -> new IllegalStateException(
"Iris's object placement stages place an object run, and this placement was started without one"));
return new RunningPlacement(context, run);
}
public ObjectShape object() {
return object;
}
/** The settings as the caller passed them; the stages derive what they change (the rotation) themselves. */
public PlacementSettings settings() {
return settings;
}
public int x() {
return run.x();
}
/** The height the caller asked for, negative when the placement samples it. */
public int requestedY() {
return run.requestedY();
}
public int z() {
return run.z();
}
/** The cave the object is placed in; empty outside caves. */
public Optional<ObjectRun.Cave> cave() {
return run.cave();
}
/** Answers the questions of the terrain the placement was asked to place on. */
public StageTerrain terrain() {
return terrain;
}
/**
* The terrain the placement anchors against: {@link #terrain()}, or, when the settings place on a heightmap, the same
* terrain with its heights from the heightmap's noise, seeded from {@code rng}.
*/
public StageTerrain terrainFor(RNG rng) {
Optional<HeightmapNoise> heightmapSettings = run.settings().heightmap();
if (heightmapSettings.isEmpty()) {
return terrain;
}
long heightmapSeed = rng.nextLong() + run.requestedY() + run.z() - run.x();
VirtualHeightmap heightmap = VirtualHeightmap.of(heightmapSettings.get(), world().resources().noise(), heightmapSeed);
return terrain.withHeights(heightmap::surface);
}
/**
* The noise that warps the placement's columns; empty when the settings do not warp. A generated world seeds it from
* the world, so every placement of the world warps alike; a placement without one seeds it from {@code rng}.
*/
public Optional<SurfaceWarp> surfaceWarp(RNG rng) {
ObjectPlacement config = run.settings();
if (!ObjectRun.warps(config.warp())) {
return Optional.empty();
}
PackWorld world = world();
long seed = world.running().isPresent() ? world.seed(IrisSeedPurposes.OBJECT_WARP) : rng.getSeed();
return Optional.of(new SurfaceWarp(world.resources().noise().sampler(config.warp(), seed), config.warp().multiplier()));
}
/** {@code state} turned with the object by {@code rotation}, as the platform turns stairs, logs and other facing blocks. */
public BlockState rotate(BlockState state, ObjectRotation rotation, int spinX, int spinY, int spinZ) {
if (!rotation.canRotate()) {
return state;
}
int turnsX = wholeQuarterTurns(spinX);
int turnsY = wholeQuarterTurns(spinY);
int turnsZ = wholeQuarterTurns(spinZ);
BlockTurn turn = (x, y, z) -> {
IrisBlockVector turned = rotation.rotate(new IrisBlockVector(x, y, z), turnsX, turnsY, turnsZ);
return new BlockTurn.Direction(turned.getX(), turned.getY(), turned.getZ());
};
return blocks().rotate(state, turn);
}
/** {@code update} laid over {@code base}: the platform's merge of two states of one block, else {@code update}. */
public BlockState merge(BlockState base, BlockState update) {
return blocks().merge(base, update);
}
/** Whether {@code state} matches {@code other} as the platform compares them. */
public boolean matches(BlockState state, BlockState other) {
return blocks().matches(state, other);
}
public boolean hasTrait(BlockState state, BlockTrait trait) {
return blocks().hasTrait(state, trait);
}
/** The resources of the object's pack, where the placement's markers are found. */
public PackResources resources() {
return world().resources();
}
/** Reports a buffered write as one of the object's own blocks, which the placing module reads once the object is placed. */
public void objectBlockWritten(BlockPosition position) {
run.objectBlockWritten(position);
}
/** Reports the height the object was anchored at, which the placement returns to its caller. */
public void anchoredAt(int y) {
run.anchoredAt(y);
}
private BlockRegistry blocks() {
return world().resources().blocks();
}
private PackWorld world() {
return context.world();
}
/** The spin in whole quarter turns, as the platform turns blocks: any part of a quarter turn counts as one. */
private static int wholeQuarterTurns(int degrees) {
return (int) (QUARTER_TURN_DEGREES * Math.ceil(Math.abs((degrees % FULL_TURN_DEGREES) / QUARTER_TURN_DEGREES)));
}
}
@@ -0,0 +1,126 @@
/*
* 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.modules.placement;
import art.arcane.iris.modules.blocks.SmartBoreDebugSettings;
import com.volmit.placement.PlacementContext;
import com.volmit.placement.PlacementRecord;
import com.volmit.placement.PlacementTerrain;
import com.volmit.placement.StructureVolumes;
import com.volmit.resource.ResourceId;
import com.volmit.world.TerrainSampler;
import java.util.Optional;
import java.util.function.IntBinaryOperator;
/**
* What a placement stage asks of the terrain and the world around it: heights, carving and water at a column, the
* terrain's shape, and the world's own facts. A placement made without a world ({@link #hasWorld()} is false) answers
* its terrain questions from the placement's terrain alone.
*/
public final class StageTerrain {
private static final String PROCEDURAL_PREFIX = "procedural/";
private final PlacementTerrain terrain;
private final PlacementContext context;
private final IntBinaryOperator heightmap;
private StageTerrain(PlacementTerrain terrain, PlacementContext context, IntBinaryOperator heightmap) {
this.terrain = terrain;
this.context = context;
this.heightmap = heightmap;
}
static StageTerrain of(PlacementContext context) {
return new StageTerrain(context.placementTerrain(), context, null);
}
/** This terrain with its heights from {@code heightmap}, for a placement that sits on a virtual heightmap. */
StageTerrain withHeights(IntBinaryOperator heightmap) {
return new StageTerrain(terrain, context, heightmap);
}
/** The surface height of the column, counting fluid unless {@code ignoreFluid}. */
public int highest(int x, int z, boolean ignoreFluid) {
return heightmap != null ? heightmap.applyAsInt(x, z) : terrain.highest(x, z, ignoreFluid);
}
public boolean isCarved(int x, int y, int z) {
return terrain.isCarved(x, y, z);
}
/** Whether the block is real, solid ground; the height field alone cannot say at mantle time. */
public boolean isSurfaceSolid(int x, int y, int z) {
return terrain.isSurfaceSolid(x, y, z);
}
public boolean isUnderwater(int x, int z) {
return terrain.isUnderwater(x, z);
}
/** The height up to which the dimension is filled with fluid. */
public int fluidHeight() {
return terrain.fluidHeight();
}
/** Whether leaves the placement writes never decay. */
public boolean preventsDecay() {
return terrain.preventsDecay();
}
/** Whether bored air is written as a visible block, to see where smart boring bored. */
public boolean debugsSmartBore(int x, int z) {
return context.settings().at(SmartBoreDebugSettings.class, x, z).dimension().map(SmartBoreDebugSettings::show).orElse(false);
}
/** Whether the placement is made in a world the host generates, rather than a tool's world. */
public boolean hasWorld() {
return context.world().running().isPresent();
}
/** The terrain's slope at the column, as the dimension's slope field gives it. */
public double slopeAt(int x, int z) {
return sampler().column(x, z).slope();
}
/** The terrain height at a position between columns: the height of the column the position lies in, counted toward zero. */
public double heightAt(double x, double z) {
return sampler().surfaceY((int) x, (int) z);
}
/** The dimension's height in blocks. */
public int worldHeight() {
return sampler().bounds().maxY();
}
public StructureVolumes structureVolumes(int minX, int minZ, int maxX, int maxZ) {
return terrain.structureVolumes(minX, minZ, maxX, maxZ);
}
/** The pack object placed at the block; empty when none was, or when a procedural object was. */
public Optional<ResourceId> objectAt(int x, int y, int z) {
return terrain.placementAt(x, y, z)
.map(PlacementRecord::object)
.filter(object -> !object.path().startsWith(PROCEDURAL_PREFIX));
}
private TerrainSampler sampler() {
return context.terrain();
}
}
@@ -0,0 +1,113 @@
/*
* 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.modules.placement;
import art.arcane.volmlib.util.math.IrisBlockVector;
import com.volmit.block.BlockRegistry;
import com.volmit.block.BlockState;
import com.volmit.block.BlockTrait;
import com.volmit.geometry.BlockPosition;
import com.volmit.object.ObjectBlock;
import com.volmit.object.PlaceableObject;
import com.volmit.world.PackWorld;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* The columns of each object's lowest solid layer, worked out once per object of a world and kept while the object is: an
* object stands on these when its placement needs surface support. Foliage does not count as solid.
*/
final class SurfaceSupportOffsets {
private final ReferenceQueue<PlaceableObject> collected = new ReferenceQueue<>();
private final Map<ObjectKey, List<IrisBlockVector>> offsets = new ConcurrentHashMap<>();
static SurfaceSupportOffsets of(PackWorld world) {
return world.state(SurfaceSupportOffsets.class, ignored -> new SurfaceSupportOffsets());
}
/** {@code blocks} tells which of the object's blocks are solid. */
List<IrisBlockVector> of(PlaceableObject object, BlockRegistry blocks) {
forgetCollected();
return offsets.computeIfAbsent(new ObjectKey(object, collected), ignored -> lowestSolidLayer(object, blocks));
}
private static List<IrisBlockVector> lowestSolidLayer(PlaceableObject object, BlockRegistry blocks) {
Map<BlockState, Boolean> supporting = new HashMap<>();
int lowestY = Integer.MAX_VALUE;
List<IrisBlockVector> layer = new ArrayList<>();
for (ObjectBlock block : object.geometry().blocks()) {
if (!supporting.computeIfAbsent(block.state(), state -> supports(state, blocks))) {
continue;
}
BlockPosition position = block.position();
if (position.y() < lowestY) {
lowestY = position.y();
layer.clear();
}
if (position.y() == lowestY) {
layer.add(new IrisBlockVector(position.x(), position.y(), position.z()));
}
}
return List.copyOf(layer);
}
private static boolean supports(BlockState state, BlockRegistry blocks) {
return blocks.hasTrait(state, BlockTrait.SOLID) && !blocks.hasTrait(state, BlockTrait.FOLIAGE);
}
private void forgetCollected() {
Object gone;
while ((gone = collected.poll()) != null) {
offsets.remove((ObjectKey) gone);
}
}
/** An object by identity, held weakly so its entry goes once the object is collected. */
private static final class ObjectKey extends WeakReference<PlaceableObject> {
private final int hash;
private ObjectKey(PlaceableObject object, ReferenceQueue<PlaceableObject> queue) {
super(object, queue);
this.hash = System.identityHashCode(object);
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof ObjectKey key)) {
return false;
}
PlaceableObject object = get();
return object != null && object == key.get();
}
@Override
public int hashCode() {
return hash;
}
}
}
@@ -0,0 +1,33 @@
/*
* 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.modules.placement;
import com.volmit.noise.NoiseSampler;
/**
* Noise that moves the columns of a placement sideways, so a square object warps like a flag.
*
* @param multiplier how far, in blocks, the warp may move a column in total
*/
public record SurfaceWarp(NoiseSampler noise, double multiplier) {
/** The noise at the position, fitted to the range from {@code min} to {@code max}. */
public double fit(double min, double max, double x, double y, double z) {
return min + noise.sample(x, y, z) * (max - min);
}
}
@@ -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.modules.placement;
import art.arcane.iris.builtin.objects.HeightmapNoise;
import com.volmit.noise.NoiseFactory;
import com.volmit.noise.NoiseSampler;
import java.util.ArrayList;
import java.util.List;
/**
* The heights of an object placement's virtual heightmap: the noise of a {@link HeightmapNoise} and of the
* generators that fracture its coordinates, built once from API noise and seeded from one number. The setting
* {@code octaves} never changed Iris's values, so it is not read.
*/
public final class VirtualHeightmap {
private static final long GENERATOR_SEED_SALT = 33_955_677L;
private static final long FIRST_FRACTURE_SEED_OFFSET = 33L;
private static final long FRACTURE_SEED_STEP = 819L;
private final HeightmapNoise settings;
private final NoiseSampler sampler;
private final List<VirtualHeightmap> fractures;
private VirtualHeightmap(HeightmapNoise settings, NoiseFactory noise, long seed) {
this.settings = settings;
this.sampler = settings.enabled() ? noise.sampler(settings.style(), seed + GENERATOR_SEED_SALT - settings.seed()) : null;
this.fractures = fracturesOf(settings, noise, seed);
}
/** The heightmap {@code settings} describe, its noise seeded with {@code seed}. */
public static VirtualHeightmap of(HeightmapNoise settings, NoiseFactory noise, long seed) {
return new VirtualHeightmap(settings, noise, seed);
}
/** The height at the column, rounded to a whole block. */
public int surface(int x, int z) {
return (int) Math.round(valueAt(x, z));
}
private static List<VirtualHeightmap> fracturesOf(HeightmapNoise settings, NoiseFactory noise, long seed) {
List<VirtualHeightmap> built = new ArrayList<>();
long fractureOffset = FIRST_FRACTURE_SEED_OFFSET;
for (HeightmapNoise fracture : settings.fracture()) {
if (fracture.enabled()) {
built.add(new VirtualHeightmap(fracture, noise, seed + settings.seed() + fractureOffset));
}
fractureOffset += FRACTURE_SEED_STEP;
}
return List.copyOf(built);
}
private double valueAt(double columnX, double columnZ) {
if (!settings.enabled()) {
return settings.offsetY();
}
double x = columnX;
double z = columnZ;
for (VirtualHeightmap fracture : fractures) {
double centre = fracture.settings.opacity() / 2D;
x += fracture.valueAt(columnX, columnZ) - centre;
z += fracture.valueAt(columnZ, columnX) - centre;
}
double sampleX = (x / settings.zoom()) + settings.offsetX();
double sampleZ = (z / settings.zoom()) + settings.offsetZ();
return shaped(sampler.sample(sampleX, sampleZ) * settings.opacity());
}
private double shaped(double sampled) {
double value = settings.negative() ? (-sampled + settings.opacity()) : sampled;
value = raised(value) + settings.offsetY();
if (settings.parametric()) {
value = parametric(value);
}
if (settings.bezier()) {
value = value * value * (3D - 2D * value);
}
return settings.sinCentered() ? Math.sin(value * Math.PI) : value;
}
private double raised(double value) {
double exponent = settings.exponent();
if (exponent == 1D) {
return value;
}
return value < 0 ? -Math.pow(-value, exponent) : Math.pow(value, exponent);
}
/** The parametric curve of alpha 1, which is what the setting has always applied. */
private static double parametric(double value) {
double raised = Math.pow(value, 1D);
return raised / ((raised - Math.pow(value, 0D)) + 1D);
}
}
@@ -0,0 +1,44 @@
/*
* 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.modules.post;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/**
* Whether a dimension is post processed, written as {@code "postProcessing": true}. Iris has never read this flag: surface smoothing runs
* whatever it says, so it is declared to keep the key valid in packs.
*/
@Desc("Use post processing or not")
@Feature(id = "iris:post/enabled", name = "Post processing", key = "postProcessing", root = "enabled", targets = Level.DIMENSION)
public final class PostProcessingSettings implements IrisFeature {
public static final boolean DEFAULT_ENABLED = true;
@Desc("Use post processing or not")
private boolean enabled = DEFAULT_ENABLED;
public PostProcessingSettings() {
}
public boolean enabled() {
return enabled;
}
}
@@ -0,0 +1,43 @@
/*
* 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.modules.post;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/**
* Whether post processing adds slabs on steps in a dimension, written as {@code "postProcessingSlabs": false}. A dimension without the key adds them.
*/
@Desc("Add slabs in post processing")
@Feature(id = "iris:post/slabs", name = "Post processing slabs", key = "postProcessingSlabs", root = "enabled", targets = Level.DIMENSION)
public final class PostProcessingSlabsSettings implements IrisFeature {
public static final boolean DEFAULT_ENABLED = true;
@Desc("Add slabs in post processing")
private boolean enabled = DEFAULT_ENABLED;
public PostProcessingSlabsSettings() {
}
public boolean enabled() {
return enabled;
}
}
@@ -0,0 +1,43 @@
/*
* 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.modules.post;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/**
* Whether post processing paints walls on steep faces in a dimension, written as {@code "postProcessingWalls": false}. A dimension without the key paints them.
*/
@Desc("Add painted walls in post processing")
@Feature(id = "iris:post/walls", name = "Post processing walls", key = "postProcessingWalls", root = "enabled", targets = Level.DIMENSION)
public final class PostProcessingWallsSettings implements IrisFeature {
public static final boolean DEFAULT_ENABLED = true;
@Desc("Add painted walls in post processing")
private boolean enabled = DEFAULT_ENABLED;
public PostProcessingWallsSettings() {
}
public boolean enabled() {
return enabled;
}
}
@@ -0,0 +1,46 @@
/*
* 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.modules.spawn;
import art.arcane.iris.builtin.spawn.AmbientEffect;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.Collections;
import java.util.List;
/**
* The ambient effects one region or biome declares, written as {@code "effects": [...]}, the list of
* {@link AmbientEffect}s. They play around every player in the area.
*/
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play arround the player even if where the effect was played is no longer in the biome the player is in.")
@Feature(id = "iris:spawn/effects", name = "Effects", key = "effects", root = "effects", targets = {Level.REGION, Level.BIOME})
public final class EffectSettings implements IrisFeature {
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player.")
private List<AmbientEffect> effects = List.of();
public EffectSettings() {
}
public List<AmbientEffect> effects() {
return effects == null ? List.of() : Collections.unmodifiableList(effects);
}
}
@@ -0,0 +1,48 @@
/*
* 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.modules.spawn;
import art.arcane.iris.builtin.spawn.Spawner;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.ResourceRef;
import java.util.Collections;
import java.util.List;
/**
* The spawners one dimension, region or biome lists, written as {@code "entitySpawners": [...]}, the keys of the
* {@link Spawner}s. A chunk may fire the spawners of its dimension, region and biome.
*/
@Desc("Entity spawners that fire in this area")
@Feature(id = "iris:spawn", name = "Entity spawners", key = "entitySpawners", root = "spawners", targets = {Level.DIMENSION, Level.REGION, Level.BIOME})
public final class SpawnerSettings implements IrisFeature {
@ResourceRef(Spawner.class)
@Desc("Entity spawners to add to this area")
private List<String> spawners = List.of();
public SpawnerSettings() {
}
public List<String> spawners() {
return spawners == null ? List.of() : Collections.unmodifiableList(spawners);
}
}
@@ -0,0 +1,375 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.prepare.SlopeClip;
import art.arcane.iris.builtin.terrain.LayersSettings;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import art.arcane.volmlib.util.cache.AtomicCache;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.ModuleLog;
import com.volmit.block.BlockState;
import com.volmit.config.FeatureSettings;
import com.volmit.noise.NoiseFactory;
import com.volmit.resource.ResourceId;
import com.volmit.world.PackWorld;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
/**
* What the terrain module keeps for one world about the layers of its biomes: each layer made ready ({@link ResolvedLayer})
* and the noise that sets the thickness of a biome's layers, and the blocks the layers of a biome stack up to at a column.
* A biome's layers are its {@link LayersSettings}, {@link SeaLayersSettings} and {@link CaveCeilingLayersSettings}; a biome
* that declares no layers has the one layer of grass the settings default to.
*
* <p>The noise of a biome's layers is built once, from the random of the first column asked for, as it always was.
*/
public final class BiomeLayers {
private static final int SURFACE_HEIGHT_SEED = 7235;
private static final int SEA_HEIGHT_SEED = 7735;
private static final int LOCKED_LAYERS_REFERENCE_HEIGHT = 512;
private static final LayersSettings DEFAULT_LAYERS = new LayersSettings();
private static final PaletteLayer NO_LAYER = PaletteLayer.withoutBlocks();
private static final BlockState BARRIER = new BlockState("minecraft:barrier");
private final Supplier<LayerBlocks> layerBlocks;
private final Supplier<NoiseFactory> noise;
private final ModuleLog log;
private final Map<PaletteLayer, ResolvedLayer> resolved = new ConcurrentHashMap<>();
private final Map<LayersSettings, AtomicCache<KList<LayerNoise>>> surfaceHeights = new ConcurrentHashMap<>();
private final Map<SeaLayersSettings, AtomicCache<KList<LayerNoise>>> seaHeights = new ConcurrentHashMap<>();
private final Map<ResourceId, LayeredBiome> biomes = new ConcurrentHashMap<>();
/** The layers of {@code world}. */
public static BiomeLayers of(PackWorld world) {
return world.state(BiomeLayers.class, generating -> new BiomeLayers(() -> LayerBlocks.of(generating), () -> generating.resources().noise(), generating.log()));
}
/** The layers of a world whose layer blocks {@code layerBlocks} and noise {@code noise} give, asked for when a layer first needs them. */
public BiomeLayers(Supplier<LayerBlocks> layerBlocks, Supplier<NoiseFactory> noise, ModuleLog log) {
this.layerBlocks = layerBlocks;
this.noise = noise;
this.log = log;
}
/** {@code layer} ready for this world; its block picks are the world's {@link LayerBlocks}. */
public ResolvedLayer resolve(PaletteLayer layer) {
return resolved.computeIfAbsent(layer, declared -> ResolvedLayer.of(declared, layerBlocks, noise));
}
/** What the biome {@code id} declares about its layers, read once from {@code settings}. */
public LayeredBiome biome(ResourceId id, FeatureSettings settings) {
LayeredBiome known = biomes.get(id);
if (known != null) {
return known;
}
return biomes.computeIfAbsent(id, ignored -> new LayeredBiome(
settings.declaredBy(id, LayersSettings.class).orElse(null),
settings.declaredBy(id, SeaLayersSettings.class).orElse(null),
settings.declaredBy(id, CaveCeilingLayersSettings.class).orElse(null),
settings.declaredBy(id, LockLayersSettings.class).orElse(null),
settings.declaredBy(id, LockLayersMaxSettings.class).orElse(null),
settings.declaredBy(id, WallSettings.class).orElse(null)));
}
/** The biome's wall, which places no block when the biome declares none. */
public ResolvedLayer wall(LayeredBiome biome) {
PaletteLayer layer = biome.wall() == null ? NO_LAYER : biome.wall().layer();
return resolve(layer);
}
/** The blocks the biome's layers stack up to at the column, top first, at most {@code maxDepth} of them. */
public KList<BlockState> generateLayers(LayeredBiome biome, PaletteExplosion explosion, double wx, double wz, RNG random, int maxDepth, int height,
ColumnSlope slope) {
if (isLocked(biome)) {
return generateLockedLayers(biome, wx, wz, random, maxDepth, height, slope);
}
KList<BlockState> blocks = new KList<>();
if (maxDepth <= 0) {
return blocks;
}
LayersSettings settings = surfaceSettings(biome);
List<PaletteLayer> layers = settings.layers();
if (layers.isEmpty()) {
return blocks;
}
KList<LayerNoise> heightNoises = surfaceHeightNoises(settings, random);
for (int i = 0; i < layers.size(); i++) {
ResolvedLayer layer = resolve(layers.get(i));
double depth = layerDepth(layer, heightNoises.get(i), wx, wz, slope);
if (depth <= 0) {
continue;
}
stackLayer(blocks, layer, i, depth, wx, wz, random, maxDepth);
if (blocks.size() >= maxDepth) {
break;
}
separateLayers(blocks, explosion, maxDepth);
}
return blocks;
}
/** The blocks the biome's cave ceiling layers stack up to at the column, nearest the ceiling first, at most {@code maxDepth} of them. */
public KList<BlockState> generateCeilingLayers(LayeredBiome biome, PaletteExplosion explosion, double wx, double wz, RNG random, int maxDepth) {
KList<BlockState> blocks = new KList<>();
if (maxDepth <= 0) {
return blocks;
}
List<PaletteLayer> ceilingLayers = biome.ceilingLayers() == null ? List.of() : biome.ceilingLayers().layers();
if (ceilingLayers.isEmpty()) {
return blocks;
}
KList<LayerNoise> heightNoises = surfaceHeightNoises(surfaceSettings(biome), random);
// Ceiling layers reuse the surface-layer height noise, so entries beyond the surface layers have none; skip them.
int usableLayers = Math.min(ceilingLayers.size(), heightNoises.size());
for (int i = 0; i < usableLayers; i++) {
ResolvedLayer layer = resolve(ceilingLayers.get(i));
double depth = layerThickness(layer, heightNoises.get(i), wx, wz);
if (depth <= 0) {
continue;
}
stackLayer(blocks, layer, i, depth, wx, wz, random, maxDepth);
if (blocks.size() >= maxDepth) {
break;
}
separateLayers(blocks, explosion, maxDepth);
}
return blocks;
}
/** The blocks of the biome's sea layers at the column, from the water surface down, at most {@code maxDepth} of them. */
public KList<BlockState> generateSeaLayers(LayeredBiome biome, double wx, double wz, RNG random, int maxDepth) {
KList<BlockState> blocks = new KList<>();
SeaLayersSettings settings = biome.seaLayers();
if (settings == null || settings.layers().isEmpty()) {
return blocks;
}
List<PaletteLayer> layers = settings.layers();
KList<LayerNoise> heightNoises = seaHeightNoises(settings, random);
for (int i = 0; i < layers.size(); i++) {
ResolvedLayer layer = resolve(layers.get(i));
int depth = heightNoises.get(i).fit(layer.minHeight(), layer.maxHeight(), wx / layer.zoom(), wz / layer.zoom());
if (depth < 0) {
continue;
}
stackLayer(blocks, layer, i, depth, wx, wz, random, maxDepth);
if (blocks.size() >= maxDepth) {
break;
}
}
return blocks;
}
/** The biome's surface layers, the one default layer when it declares none. */
public List<PaletteLayer> surfaceLayers(LayeredBiome biome) {
return surfaceSettings(biome).layers();
}
public List<PaletteLayer> seaLayers(LayeredBiome biome) {
return biome.seaLayers() == null ? List.of() : biome.seaLayers().layers();
}
/** The biome's cave ceiling layers that place blocks: those with a surface layer at their place to borrow its thickness from. */
public List<PaletteLayer> ceilingLayers(LayeredBiome biome) {
List<PaletteLayer> declared = biome.ceilingLayers() == null ? List.of() : biome.ceilingLayers().layers();
return declared.subList(0, Math.min(declared.size(), surfaceLayers(biome).size()));
}
/**
* Surface layer {@code index}'s block {@code depth} blocks below its top at the column, as {@link #generateLayers} picks
* it, leaving its slope condition aside; null where the layer is thinner there.
*/
public BlockState surfaceLayerBlock(LayeredBiome biome, int index, int depth, double wx, double wz, RNG random) {
LayersSettings settings = surfaceSettings(biome);
ResolvedLayer layer = resolve(settings.layers().get(index));
double thickness = layerThickness(layer, surfaceHeightNoises(settings, random).get(index), wx, wz);
return blockAtDepth(layer, index, depth, thickness, wx, wz, random);
}
/** Sea layer {@code index}'s block {@code depth} blocks below the water surface, as {@link #generateSeaLayers} picks it. */
public BlockState seaLayerBlock(LayeredBiome biome, int index, int depth, double wx, double wz, RNG random) {
ResolvedLayer layer = resolve(seaLayers(biome).get(index));
LayerNoise heightNoise = seaHeightNoises(biome.seaLayers(), random).get(index);
int thickness = heightNoise.fit(layer.minHeight(), layer.maxHeight(), wx / layer.zoom(), wz / layer.zoom());
return blockAtDepth(layer, index, depth, thickness, wx, wz, random);
}
/** Cave ceiling layer {@code index}'s block {@code depth} blocks below the ceiling, as {@link #generateCeilingLayers} picks it. */
public BlockState ceilingLayerBlock(LayeredBiome biome, int index, int depth, double wx, double wz, RNG random) {
ResolvedLayer layer = resolve(ceilingLayers(biome).get(index));
double thickness = layerThickness(layer, surfaceHeightNoises(surfaceSettings(biome), random).get(index), wx, wz);
return blockAtDepth(layer, index, depth, thickness, wx, wz, random);
}
// The layer's blocks are stacked from its top, as generation stacks them, so the first pick seeds its noise as the world's did.
private BlockState blockAtDepth(ResolvedLayer layer, int index, int depth, double thickness, double wx, double wz, RNG random) {
if (depth >= thickness) {
return null;
}
KList<BlockState> stacked = new KList<>();
stackLayer(stacked, layer, index, depth + 1, wx, wz, random, depth + 1);
return stacked.size() > depth ? stacked.get(depth) : null;
}
private KList<BlockState> generateLockedLayers(LayeredBiome biome, double wx, double wz, RNG random, int maxDepthLimit, int height, ColumnSlope slope) {
KList<BlockState> stacked = new KList<>();
KList<BlockState> locked = new KList<>();
int maxDepth = Math.min(maxDepthLimit, lockedLayersMax(biome));
if (maxDepth <= 0) {
return stacked;
}
LayersSettings settings = surfaceSettings(biome);
List<PaletteLayer> layers = settings.layers();
if (!layers.isEmpty()) {
KList<LayerNoise> heightNoises = surfaceHeightNoises(settings, random);
for (int i = 0; i < layers.size(); i++) {
ResolvedLayer layer = resolve(layers.get(i));
double depth = layerDepth(layer, heightNoises.get(i), wx, wz, slope);
if (depth <= 0) {
continue;
}
stackLayerUnlimited(stacked, layer, i, depth, wx, wz, random);
}
}
if (stacked.isEmpty()) {
return locked;
}
for (int i = 0; i < maxDepth; i++) {
int offset = (LOCKED_LAYERS_REFERENCE_HEIGHT - height) - i;
locked.add(stacked.get(Math.max(offset % stacked.size(), 0)));
}
return locked;
}
private void stackLayer(KList<BlockState> blocks, ResolvedLayer layer, int index, double depth, double wx, double wz, RNG random, int maxDepth) {
for (int j = 0; j < depth; j++) {
if (blocks.size() >= maxDepth) {
break;
}
addBlock(blocks, layer, index, j, wx, wz, random);
}
}
private void stackLayerUnlimited(KList<BlockState> blocks, ResolvedLayer layer, int index, double depth, double wx, double wz, RNG random) {
for (int j = 0; j < depth; j++) {
addBlock(blocks, layer, index, j, wx, wz, random);
}
}
/** Adds the layer's block {@code j} blocks down; a layer that fails to pick adds nothing. */
private void addBlock(KList<BlockState> blocks, ResolvedLayer layer, int index, int j, double wx, double wz, RNG random) {
double blocksPerSample = layer.blocksPerSample();
try {
blocks.add(layer.get(random, index + j, (wx + j) / blocksPerSample, j, (wz - j) / blocksPerSample));
} catch (Throwable e) {
log.error("A biome layer failed to pick a block", e);
}
}
/** The barrier blocks a dimension puts between layers to show them apart. */
private void separateLayers(KList<BlockState> blocks, PaletteExplosion explosion, int maxDepth) {
if (!explosion.exploded()) {
return;
}
for (int j = 0; j < explosion.size(); j++) {
blocks.add(BARRIER);
if (blocks.size() >= maxDepth) {
break;
}
}
}
/** How thick the layer is at the column: nothing where the slope is outside the layer's limits. */
private double layerDepth(ResolvedLayer layer, LayerNoise heightNoise, double wx, double wz, ColumnSlope slope) {
double depth = layerThickness(layer, heightNoise, wx, wz);
SlopeClip clip = layer.slopeCondition();
if (!clip.isDefault() && !clip.isValid(slope.at(wx, wz))) {
return 0;
}
return depth;
}
private double layerThickness(ResolvedLayer layer, LayerNoise heightNoise, double wx, double wz) {
double zoom = layer.zoom();
return heightNoise.fit(layer.minHeight(), layer.maxHeight(), wx / zoom, wz / zoom);
}
private KList<LayerNoise> surfaceHeightNoises(LayersSettings settings, RNG rng) {
AtomicCache<KList<LayerNoise>> cache = surfaceHeights.computeIfAbsent(settings, declared -> new AtomicCache<>());
return heightNoises(cache, settings.layers(), SURFACE_HEIGHT_SEED, rng);
}
private KList<LayerNoise> seaHeightNoises(SeaLayersSettings settings, RNG rng) {
AtomicCache<KList<LayerNoise>> cache = seaHeights.computeIfAbsent(settings, declared -> new AtomicCache<>());
return heightNoises(cache, settings.layers(), SEA_HEIGHT_SEED, rng);
}
private KList<LayerNoise> heightNoises(AtomicCache<KList<LayerNoise>> cache, List<PaletteLayer> layers, int firstSeed, RNG rng) {
KList<LayerNoise> cached = cache.getIfPresent();
if (cached != null) {
return cached;
}
return cache.aquire(() -> {
KList<LayerNoise> noises = new KList<>();
int seed = firstSeed;
for (PaletteLayer layer : layers) {
noises.add(resolve(layer).heightNoise(rng.nextParallelRNG((seed++) * seed * seed * seed)));
}
return noises;
});
}
private static LayersSettings surfaceSettings(LayeredBiome biome) {
return biome.layers() == null ? DEFAULT_LAYERS : biome.layers();
}
private static boolean isLocked(LayeredBiome biome) {
return biome.lock() != null && biome.lock().locked();
}
private static int lockedLayersMax(LayeredBiome biome) {
return biome.lockMax() == null ? LockLayersMaxSettings.DEFAULT_LAYERS : biome.lockMax().layers();
}
}
@@ -0,0 +1,280 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.IrisSeedPurposes;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.block.BlockSpec;
import com.volmit.block.BlockState;
import com.volmit.config.FeatureSettings;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.tooling.BlockPattern;
import com.volmit.tooling.PatternArea;
import com.volmit.tooling.PatternEntry;
import com.volmit.tooling.PatternView;
import com.volmit.world.PackBiome;
import com.volmit.world.PackWorld;
import com.volmit.world.RunningWorld;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* The studio's Palettes view (v3e's palette explorer): each biome's layers, sea layers, cave ceiling layers, wall and
* slab, from above, the blocks each places at a depth as the world places them. Picks go through the world's own
* {@link BiomeLayers} with the random each stage uses, so asking first seeds a layer's noise as generation would.
*/
public final class BiomePalettes implements PatternView {
private static final ResourceId ID = ResourceId.parse("iris:terrain/palettes");
private static final char KIND_SEPARATOR = '#';
private static final char INDEX_SEPARATOR = '/';
private static final String MINECRAFT_PREFIX = "minecraft:";
// Walls and slabs are picked one block at a time with noise that changes with height.
private static final int SINGLE_BLOCK_DEPTHS = 1;
private static final int SINGLE_BLOCK_SIGNATURE = 0;
@Override
public ResourceId id() {
return ID;
}
@Override
public String label() {
return "Palettes";
}
@Override
public String description() {
return "Each biome's layers, wall and slab from above, the blocks they place at each depth";
}
@Override
public List<PatternEntry> entries(PackWorld world) {
Optional<RunningWorld> running = world.running();
if (running.isEmpty()) {
return List.of();
}
BiomeLayers layers = BiomeLayers.of(world);
FeatureSettings settings = running.get().settings();
List<PackBiome> biomes = biomesByName(world.resources());
Map<String, Long> biomesByShownName = biomes.stream().collect(Collectors.groupingBy(PackBiome::name, Collectors.counting()));
List<PatternEntry> entries = new ArrayList<>();
for (PackBiome biome : biomes) {
String group = biomesByShownName.get(biome.name()) > 1 ? biome.name() + " (" + biome.id().path() + ")" : biome.name();
LayeredBiome layered = layers.biome(biome.id(), settings);
for (Kind kind : Kind.values()) {
List<PaletteLayer> palettes = kind.palettesOf(layers, layered, settings, biome.id());
for (int index = 0; index < palettes.size(); index++) {
entries.add(entryOf(biome, layered, kind, index, palettes.get(index), group));
}
}
}
return entries;
}
@Override
public Optional<BlockPattern> pattern(PackWorld world, String key, int depth, PatternArea area) {
Optional<RunningWorld> running = world.running();
Optional<PaletteRef> ref = PaletteRef.parse(key, world.resources());
if (running.isEmpty() || ref.isEmpty()) {
return Optional.empty();
}
BiomeLayers layers = BiomeLayers.of(world);
FeatureSettings settings = running.get().settings();
PaletteRef palette = ref.get();
LayeredBiome biome = layers.biome(palette.biome(), settings);
List<PaletteLayer> palettes = palette.kind().palettesOf(layers, biome, settings, palette.biome());
if (palette.index() >= palettes.size() || depth < 0) {
return Optional.empty();
}
ColumnPick pick = palette.kind().picker(world, layers, biome, palettes.get(palette.index()), palette.index(),
running.get().layout().fluidHeight());
BlockState[] blocks = new BlockState[area.columns() * area.columns()];
for (int row = 0; row < area.columns(); row++) {
for (int column = 0; column < area.columns(); column++) {
blocks[row * area.columns() + column] = pick.at(area.blockX(column), area.blockZ(row), depth);
}
}
return Optional.of(BlockPattern.of(area.columns(), blocks));
}
private static List<PackBiome> biomesByName(PackResources resources) {
return resources.ids(PackResources.BIOMES).stream()
.map(id -> resources.find(PackResources.BIOMES, id))
.flatMap(Optional::stream)
.sorted(Comparator.comparing(PackBiome::name).thenComparing(biome -> biome.id().toString()))
.toList();
}
private static PatternEntry entryOf(PackBiome biome, LayeredBiome layered, Kind kind, int index, PaletteLayer palette, String group) {
String key = biome.id() + String.valueOf(KIND_SEPARATOR) + kind.keyName + INDEX_SEPARATOR + index;
String name = kind.numbered ? kind.label + " " + (index + 1) : kind.label;
return new PatternEntry(key, name, Optional.of(group).filter(shown -> !shown.isBlank()), kind.depthsOf(palette),
kind.factsOf(palette, layered));
}
private static String blocksOf(PaletteLayer palette) {
Map<String, Integer> weights = palette.palette().stream()
.collect(Collectors.groupingBy(spec -> shortName(spec.block()), LinkedHashMap::new, Collectors.summingInt(BlockSpec::weight)));
return weights.entrySet().stream()
.map(entry -> entry.getValue() > 1 ? entry.getKey() + " ×" + entry.getValue() : entry.getKey())
.collect(Collectors.joining(", "));
}
private static String shortName(String block) {
return block.startsWith(MINECRAFT_PREFIX) ? block.substring(MINECRAFT_PREFIX.length()) : block;
}
private static String thicknessOf(PaletteLayer palette) {
if (palette.minHeight() == palette.maxHeight()) {
return palette.maxHeight() + (palette.maxHeight() == 1 ? " block thick" : " blocks thick");
}
return palette.minHeight() + " to " + palette.maxHeight() + " blocks thick";
}
/** The block a palette places at a column, {@code depth} blocks below its top, or null for none. */
@FunctionalInterface
private interface ColumnPick {
BlockState at(int x, int z, int depth);
}
private enum Kind {
LAYER("layer", "Layer", true),
SEA_LAYER("sea-layer", "Sea layer", true),
CEILING_LAYER("ceiling-layer", "Cave ceiling layer", true),
WALL("wall", "Wall", false),
SLAB("slab", "Slab", false);
private final String keyName;
private final String label;
private final boolean numbered;
Kind(String keyName, String label, boolean numbered) {
this.keyName = keyName;
this.label = label;
this.numbered = numbered;
}
static Optional<Kind> byKeyName(String keyName) {
for (Kind kind : values()) {
if (kind.keyName.equals(keyName)) {
return Optional.of(kind);
}
}
return Optional.empty();
}
// A biome without a wall or slab block has those palettes, just empty, so they aren't listed.
List<PaletteLayer> palettesOf(BiomeLayers layers, LayeredBiome biome, FeatureSettings settings, ResourceId id) {
return switch (this) {
case LAYER -> layers.surfaceLayers(biome);
case SEA_LAYER -> layers.seaLayers(biome);
case CEILING_LAYER -> layers.ceilingLayers(biome);
case WALL -> placing(biome.wall() == null ? null : biome.wall().layer());
case SLAB -> placing(settings.declaredBy(id, SlabSettings.class).map(SlabSettings::layer).orElse(null));
};
}
private static List<PaletteLayer> placing(PaletteLayer layer) {
return layer == null || layer.palette().isEmpty() ? List.of() : List.of(layer);
}
int depthsOf(PaletteLayer palette) {
return numbered ? Math.max(1, palette.maxHeight()) : SINGLE_BLOCK_DEPTHS;
}
List<String> factsOf(PaletteLayer palette, LayeredBiome biome) {
List<String> facts = new ArrayList<>();
facts.add(blocksOf(palette));
facts.add(numbered ? thicknessOf(palette) : "Picked at the fluid height; changes with height");
facts.add(palette.style().style().toLowerCase(Locale.ROOT).replace('_', ' ') + " noise, zoom " + palette.zoom());
if (!palette.slopeCondition().isDefault()) {
facts.add("Only on slopes from " + palette.slopeCondition().minimumSlope() + " to " + palette.slopeCondition().maximumSlope()
+ "; shown everywhere here");
}
if (this == LAYER && biome.layers() == null) {
facts.add("The biome declares no layers, so it gets this default one");
}
if (this == LAYER && biome.lock() != null && biome.lock().locked()) {
facts.add("The biome locks its layers, which repeats them by height");
}
return facts;
}
// Each stage picks with its own random: the terrain's for surface and sea layers, the caves' for ceilings and
// walls, post processing's for slabs. The studio asks with the same one, so it seeds noise as generation does.
ColumnPick picker(PackWorld world, BiomeLayers layers, LayeredBiome biome, PaletteLayer palette, int index, int fluidHeight) {
return switch (this) {
case LAYER -> {
RNG terrain = new RNG(world.seed(IrisSeedPurposes.TERRAIN));
yield (x, z, depth) -> layers.surfaceLayerBlock(biome, index, depth, x, z, terrain);
}
case SEA_LAYER -> {
RNG terrain = new RNG(world.seed(IrisSeedPurposes.TERRAIN));
yield (x, z, depth) -> layers.seaLayerBlock(biome, index, depth, x, z, terrain);
}
case CEILING_LAYER -> {
RNG carve = new RNG(world.seed(IrisSeedPurposes.CARVE));
yield (x, z, depth) -> layers.ceilingLayerBlock(biome, index, depth, x, z, carve);
}
case WALL -> singleBlocks(layers.resolve(palette), new RNG(world.seed(IrisSeedPurposes.CARVE)), fluidHeight);
case SLAB -> singleBlocks(layers.resolve(palette), new RNG(world.seed(IrisSeedPurposes.POST)), fluidHeight);
};
}
private static ColumnPick singleBlocks(ResolvedLayer layer, RNG random, int height) {
return (x, z, depth) -> depth == 0 ? layer.get(random, SINGLE_BLOCK_SIGNATURE, x, height, z) : null;
}
}
private record PaletteRef(ResourceId biome, Kind kind, int index) {
static Optional<PaletteRef> parse(String key, PackResources resources) {
int kindStart = key.lastIndexOf(KIND_SEPARATOR);
int indexStart = key.lastIndexOf(INDEX_SEPARATOR);
if (kindStart < 1 || indexStart < kindStart) {
return Optional.empty();
}
Optional<Kind> kind = Kind.byKeyName(key.substring(kindStart + 1, indexStart));
Optional<Integer> index = wholeNumber(key.substring(indexStart + 1));
Optional<ResourceId> biome = resources.ids(PackResources.BIOMES).stream()
.filter(id -> id.toString().equals(key.substring(0, kindStart)))
.findFirst();
if (kind.isEmpty() || index.isEmpty() || biome.isEmpty()) {
return Optional.empty();
}
return Optional.of(new PaletteRef(biome.get(), kind.get(), index.get()));
}
private static Optional<Integer> wholeNumber(String text) {
try {
return Optional.of(Integer.parseInt(text)).filter(number -> number >= 0);
} catch (NumberFormatException notANumber) {
return Optional.empty();
}
}
}
}
@@ -0,0 +1,44 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.List;
/**
* The layers of material on the ceilings of caves in a biome, written as {@code "caveCeilingLayers": [...]}, the list of layers.
*/
@Desc("Layers of materials placed on cave ceilings in this biome, indexed upward from the ceiling surface. Must not have more entries than layers, whose height generators it reuses. Omitting this leaves cave ceilings unchanged.")
@Feature(id = "iris:terrain/cave-ceiling-layers", name = "Cave ceiling layers", key = "caveCeilingLayers", root = "layers", targets = Level.BIOME)
public final class CaveCeilingLayersSettings implements IrisFeature {
@Desc("Layers of materials placed on cave ceilings in this biome, indexed upward from the ceiling surface. Must not have more entries than layers, whose height generators it reuses. Omitting this leaves cave ceilings unchanged.")
private List<PaletteLayer> layers = List.of();
public CaveCeilingLayersSettings() {
}
public List<PaletteLayer> layers() {
return layers == null ? List.of() : layers;
}
}
@@ -0,0 +1,24 @@
/*
* 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.modules.terrain;
/** The slope of the terrain at a column, asked only when a layer limits where it shows by slope. */
@FunctionalInterface
public interface ColumnSlope {
double at(double worldX, double worldZ);
}
@@ -0,0 +1,44 @@
/*
* 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.modules.terrain;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
/** How many barrier blocks a dimension puts between layers when it explodes its biome palettes, written as {@code "explodeBiomePaletteSize": 3}. */
@Desc("Customize the palette height explosion")
@Feature(id = "iris:terrain/explode-palette-size", name = "Explode biome palette size", key = "explodeBiomePaletteSize", root = "size", targets = Level.DIMENSION)
public final class ExplodeBiomePaletteSizeSettings implements IrisFeature {
public static final int DEFAULT_SIZE = 3;
@MinNumber(1)
@MaxNumber(16)
@Desc("Customize the palette height explosion")
private int size = DEFAULT_SIZE;
public ExplodeBiomePaletteSizeSettings() {
}
public int size() {
return size;
}
}
@@ -0,0 +1,38 @@
/*
* 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.modules.terrain;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** Whether a dimension puts barrier blocks between the layers of its biomes to show them apart, written as {@code "explodeBiomePalettes": true}. */
@Desc("Vertically split up the biome palettes with barrier blocks in between to visualize them. The gap size comes from explodeBiomePaletteSize.")
@Feature(id = "iris:terrain/explode-palettes", name = "Explode biome palettes", key = "explodeBiomePalettes", root = "explode", targets = Level.DIMENSION)
public final class ExplodeBiomePalettesSettings implements IrisFeature {
@Desc("Vertically split up the biome palettes with barrier blocks in between to visualize them. The gap size comes from explodeBiomePaletteSize.")
private boolean explode = false;
public ExplodeBiomePalettesSettings() {
}
public boolean explode() {
return explode;
}
}
@@ -0,0 +1,47 @@
/*
* 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.modules.terrain;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.block.BlockSpec;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.List;
/**
* The blocks that fill ocean columns and cave aquifers of a dimension, written as {@code "fluidPalette": {...}}, a palette. A dimension without the key is water.
*/
@Desc("The dimension fluid block palette used for ocean columns and cave aquifers.")
@Feature(id = "iris:terrain/fluid-palette", name = "Fluid palette", key = "fluidPalette", root = "palette", targets = Level.DIMENSION)
public final class FluidPaletteSettings implements IrisFeature {
private static final String DEFAULT_BLOCK = "water";
@Desc("The dimension fluid block palette used for ocean columns and cave aquifers.")
private PaletteSpec palette = PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK)));
public FluidPaletteSettings() {
}
public PaletteSpec palette() {
return palette == null ? PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK))) : palette;
}
}
@@ -0,0 +1,46 @@
/*
* 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.modules.terrain;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/**
* A dimension's {@code hideOresForHiddenOre}: whether every ore block the generator would place is replaced with its base
* material. Written as the bare boolean.
*/
@Desc("When true, every ore block the generator would place (terrain ores, deposits, ores inside objects) is replaced with its base material such as stone, deepslate or netherrack, so drop-control plugins like HiddenOre can manage ore rewards themselves")
@Feature(id = "iris:terrain/hide-ores", name = "Hide ores", key = "hideOresForHiddenOre", root = "hide", targets = Level.DIMENSION)
public final class HideOresSettings implements IrisFeature {
@Desc("When true, every ore block the generator would place (terrain ores, deposits, ores inside objects) is replaced with its base material such as stone, deepslate or netherrack, so drop-control plugins like HiddenOre can manage ore rewards themselves")
private boolean hide = false;
public HideOresSettings() {
}
public HideOresSettings(boolean hide) {
this.hide = hide;
}
public boolean hide() {
return hide;
}
}
@@ -0,0 +1,130 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.block.BlockRegistry;
import com.volmit.block.BlockSpec;
import com.volmit.block.BlockState;
import com.volmit.noise.NoiseSampler;
import com.volmit.resource.PackResources;
import com.volmit.world.PackWorld;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* What the blocks of the biomes' palette layers ({@link PaletteLayer}) are in one world, and which of them a layer picks
* where. Terrain, caves and post processing all pick from the same layers (a biome's wall is painted in caves and on
* cliffs), and a layer's block noise is built once per world, from the random of whichever of them asks first, as layers
* always were. So the picks live here, in the world's state under this class, which the compiled-in built-ins and the
* built-ins jar both see: one place, one noise per layer, whichever module asks.
*/
public final class LayerBlocks {
/** A layer without blocks picks none. */
public static final int NONE = -1;
private final PackResources resources;
private final Map<PaletteLayer, Picks> picks = new ConcurrentHashMap<>();
private LayerBlocks(PackResources resources) {
this.resources = resources;
}
/** The layer blocks of {@code world}. */
public static LayerBlocks of(PackWorld world) {
return world.state(LayerBlocks.class, created -> new LayerBlocks(created.resources()));
}
/** The layer's blocks resolved for the world's pack, each repeated by its weight: what an index from {@link #pick} names. */
public List<BlockState> blocks(PaletteLayer layer) {
return picksOf(layer).blocks();
}
/**
* The index into {@link #blocks(PaletteLayer)} the layer picks at the position, or {@link #NONE} when it has no block.
* The noise is seeded from {@code parent} and {@code signature} the first time anyone asks about this layer; a pick
* outside the palette falls back to its first block.
*/
public int pick(PaletteLayer layer, RNG parent, int signature, double x, double y, double z) {
Picks layerPicks = picksOf(layer);
int size = layerPicks.blocks().size();
if (size <= 1) {
return size - 1;
}
NoiseSampler sampler = layerPicks.noise(parent, signature);
double noise = layer.style().isSeeded() ? sampler.sample(x, z) : sampler.sample(x / layer.zoom(), y / layer.zoom(), z / layer.zoom());
int index = (int) Math.round(noise * (size - 1));
return index < 0 || index >= size ? 0 : index;
}
private Picks picksOf(PaletteLayer layer) {
Picks known = picks.get(layer);
if (known != null) {
return known;
}
return picks.computeIfAbsent(layer, declared -> new Picks(declared, weighted(resources.blocks(), declared.palette()), resources));
}
private static List<BlockState> weighted(BlockRegistry registry, List<BlockSpec> palette) {
List<BlockState> weighted = new ArrayList<>();
for (BlockSpec spec : palette) {
BlockState block = registry.resolve(spec);
for (int n = 0; n < spec.weight(); n++) {
weighted.add(block);
}
}
return List.copyOf(weighted);
}
/** One layer's blocks and its block noise, built by the first caller. */
private static final class Picks {
private final PaletteLayer layer;
private final List<BlockState> blocks;
private final PackResources resources;
private volatile NoiseSampler noise;
Picks(PaletteLayer layer, List<BlockState> blocks, PackResources resources) {
this.layer = layer;
this.blocks = blocks;
this.resources = resources;
}
List<BlockState> blocks() {
return blocks;
}
NoiseSampler noise(RNG parent, int signature) {
NoiseSampler built = noise;
if (built != null) {
return built;
}
synchronized (this) {
if (noise == null) {
long seed = parent.nextParallelRNG(signature).nextParallelRNG(layer.minHeight() + layer.maxHeight() + blocks.size()).getSeed();
noise = resources.noise().sampler(layer.style(), seed);
}
return noise;
}
}
}
}
@@ -0,0 +1,37 @@
/*
* 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.modules.terrain;
import com.volmit.noise.NoiseSampler;
/** The noise that sets how thick a layer is: a number between a layer's limits at every column. */
public final class LayerNoise {
private final NoiseSampler noise;
LayerNoise(NoiseSampler noise) {
this.noise = noise;
}
/** The whole number between {@code min} and {@code max} the noise gives at the column. */
public int fit(int min, int max, double x, double z) {
if (min == max) {
return min;
}
return (int) Math.round(min + noise.sample(x, z) * (max - min));
}
}
@@ -0,0 +1,31 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.terrain.LayersSettings;
/**
* What a biome declares about the layers of its ground: the layers of its surface, of its sea floor and of its cave ceilings, whether
* they are locked to the highest height the biome reaches, and its wall. A setting the biome does not declare is null.
*/
public record LayeredBiome(LayersSettings layers, SeaLayersSettings seaLayers, CaveCeilingLayersSettings ceilingLayers,
LockLayersSettings lock, LockLayersMaxSettings lockMax, WallSettings wall) {
/** A biome that declares nothing about its layers: the one layer of grass the settings default to. */
public static final LayeredBiome UNDECLARED = new LayeredBiome(null, null, null, null, null, null);
}
@@ -0,0 +1,41 @@
/*
* 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.modules.terrain;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** How many layers a locked biome iterates below the surface, written as {@code "lockLayersMax": 7}. A biome without the key iterates seven. */
@Desc("The max layers to iterate below the surface for locked layer biomes (mesa).")
@Feature(id = "iris:terrain/lock-layers-max", name = "Lock layers max", key = "lockLayersMax", root = "layers", targets = Level.BIOME)
public final class LockLayersMaxSettings implements IrisFeature {
public static final int DEFAULT_LAYERS = 7;
@Desc("The max layers to iterate below the surface for locked layer biomes (mesa).")
private int layers = DEFAULT_LAYERS;
public LockLayersMaxSettings() {
}
public int layers() {
return layers;
}
}
@@ -0,0 +1,39 @@
/*
* 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.modules.terrain;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** Whether a biome's layers are locked to its highest possible height, written as {@code "lockLayers": true}. A biome without the key is not locked. */
@Desc("Layers no longer descend from the surface block, they descend from the max possible height the biome can produce (constant) creating mesa like layers.")
@Feature(id = "iris:terrain/lock-layers", name = "Lock layers", key = "lockLayers", root = "locked", targets = Level.BIOME)
public final class LockLayersSettings implements IrisFeature {
@Desc("Layers no longer descend from the surface block, they descend from the max possible height the biome can produce (constant) creating mesa like layers.")
private boolean locked = false;
public LockLayersSettings() {
}
public boolean locked() {
return locked;
}
}
@@ -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.modules.terrain;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Range;
import com.volmit.noise.NoiseStyle;
import java.util.List;
/**
* One ore generator of a dimension, region or biome, an entry of its {@code ores} list: single ore blocks scattered
* through the terrain by a noise field, in a vertical band. A value of IrisApi types only; the terrain module resolves
* its blocks and builds its noise ({@code ResolvedOre}).
*/
@Desc("Scatters single ore blocks through terrain by sampling a noise field at every block in a vertical band. Defined on dimensions, regions, or biomes; the most specific level wins.")
public final class OreGenerator {
private static final double DEFAULT_THRESHOLD = 0.5;
private static final double DEFAULT_RANGE_MIN = 30;
private static final double DEFAULT_RANGE_MAX = 80;
@Desc("The ore blocks to place. An empty palette generates nothing, so this must be set for the generator to have any effect.")
private PaletteSpec palette = PaletteSpec.of(List.of());
@Desc("The noise style sampled per block to decide where ore appears. STATIC gives independent random speckle; smoother styles give veiny clusters.")
private NoiseStyle chanceStyle = NoiseStyle.of("STATIC");
@Desc("When true this generator also replaces surface-layer blocks (it runs before layers and fluid); when false it only replaces underground rock.")
private boolean generateSurface = false;
@MinNumber(0)
@MaxNumber(1)
@Desc("Noise cutoff: a block becomes ore when the sampled noise is at or below this value, so higher means more ore. 0 disables, 1 replaces everything in range.")
private double threshold = DEFAULT_THRESHOLD;
@Desc("Vertical band (min, max) this ore can generate in, in engine-local Y where 0 is the bottom of the dimension, not world Y.")
private Range range = Range.of(DEFAULT_RANGE_MIN, DEFAULT_RANGE_MAX);
public OreGenerator() {
}
public PaletteSpec palette() {
return palette;
}
public NoiseStyle chanceStyle() {
return chanceStyle;
}
public boolean generateSurface() {
return generateSurface;
}
public double threshold() {
return threshold;
}
public Range range() {
return range;
}
}
@@ -0,0 +1,50 @@
/*
* 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.modules.terrain;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.Collections;
import java.util.List;
/**
* The ore generators one dimension, region or biome declares, written as {@code "ores": [...]}, the list of generators.
* Levels stack: a column's ores come from its biome first, then its region, then the dimension. IrisApi types only,
* like {@link OreGenerator}.
*/
@Desc("Collection of ores to be generated")
@Feature(id = "iris:terrain/ores", name = "Ores", key = "ores", root = "generators", targets = {Level.DIMENSION, Level.REGION, Level.BIOME})
public final class OreSettings implements IrisFeature {
@Desc("Collection of ores to be generated")
private List<OreGenerator> generators = List.of();
public OreSettings() {
}
public OreSettings(List<OreGenerator> generators) {
this.generators = List.copyOf(generators);
}
public List<OreGenerator> generators() {
return generators == null ? List.of() : Collections.unmodifiableList(generators);
}
}
@@ -0,0 +1,43 @@
/*
* 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.modules.terrain;
import com.volmit.block.BlockRegistry;
import com.volmit.block.BlockSpec;
import com.volmit.block.BlockState;
import java.util.ArrayList;
import java.util.List;
/** A palette's blocks, the way terrain layers and palettes always picked from them. */
final class PaletteBlocks {
private PaletteBlocks() {
}
/** The block of each spec, each repeated by its weight. */
static List<BlockState> weighted(BlockRegistry registry, List<BlockSpec> palette) {
List<BlockState> weighted = new ArrayList<>();
for (BlockSpec spec : palette) {
BlockState state = registry.resolve(spec);
for (int n = 0; n < spec.weight(); n++) {
weighted.add(state);
}
}
return List.copyOf(weighted);
}
}
@@ -0,0 +1,34 @@
/*
* 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.modules.terrain;
import com.volmit.config.FeatureSettings;
/** Whether a dimension separates the layers of its biomes with barrier blocks to show them apart, and how many barriers it puts between them. */
public record PaletteExplosion(boolean exploded, int size) {
public static final PaletteExplosion NONE = new PaletteExplosion(false, ExplodeBiomePaletteSizeSettings.DEFAULT_SIZE);
/** What the dimension at the column of {@code settings} declares. */
public static PaletteExplosion of(FeatureSettings settings, int worldX, int worldZ) {
boolean exploded = settings.at(ExplodeBiomePalettesSettings.class, worldX, worldZ).dimension()
.map(ExplodeBiomePalettesSettings::explode).orElse(false);
int size = settings.at(ExplodeBiomePaletteSizeSettings.class, worldX, worldZ).dimension()
.map(ExplodeBiomePaletteSizeSettings::size).orElse(ExplodeBiomePaletteSizeSettings.DEFAULT_SIZE);
return new PaletteExplosion(exploded, size);
}
}
@@ -0,0 +1,118 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.prepare.SlopeClip;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import art.arcane.volmlib.util.cache.AtomicCache;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.block.BlockState;
import com.volmit.noise.NoiseFactory;
import com.volmit.noise.NoiseStyle;
import java.util.List;
import java.util.function.Supplier;
/**
* One {@link PaletteLayer} made ready for one world: its blocks, and the noise that decides how thick it is here, built when first
* asked for. Which block it picks where is the world's {@link LayerBlocks}, shared with every other module that picks from the layer.
*
* <p>The thickness noise is built once, from the random of whoever asks first, as the layers of a biome always were.
*/
public final class ResolvedLayer {
/** The style of the noise that sets a layer's thickness: Iris's signature noise. */
private static final NoiseStyle THICKNESS_STYLE = NoiseStyle.of("IRIS");
private final PaletteLayer settings;
private final Supplier<LayerBlocks> layerBlocks;
private final Supplier<NoiseFactory> noise;
private final AtomicCache<List<BlockState>> blocks = new AtomicCache<>();
private final AtomicCache<LayerNoise> heightNoise = new AtomicCache<>();
private ResolvedLayer(PaletteLayer settings, Supplier<LayerBlocks> layerBlocks, Supplier<NoiseFactory> noise) {
this.settings = settings;
this.layerBlocks = layerBlocks;
this.noise = noise;
}
/** {@code settings} ready for the world whose layer blocks {@code layerBlocks} gives, asked for when first needed. */
static ResolvedLayer of(PaletteLayer settings, Supplier<LayerBlocks> layerBlocks, Supplier<NoiseFactory> noise) {
return new ResolvedLayer(settings, layerBlocks, noise);
}
public PaletteLayer settings() {
return settings;
}
public int minHeight() {
return settings.minHeight();
}
public int maxHeight() {
return settings.maxHeight();
}
public double zoom() {
return settings.zoom();
}
/** How many blocks one step of the layer's block noise spans: its zoom, or 1 for a seeded style, which is read flat. */
public double blocksPerSample() {
return settings.style().isSeeded() ? 1 : settings.zoom();
}
public SlopeClip slopeCondition() {
return settings.slopeCondition();
}
/** Whether the layer lists any block, which is not the same as picking one: a listed block may have no weight. */
public boolean hasPalette() {
return !settings.palette().isEmpty();
}
/** The noise that sets the layer's thickness, built from {@code rng} unless an earlier caller's is already kept. */
public LayerNoise heightNoise(RNG rng) {
LayerNoise cached = heightNoise.getIfPresent();
if (cached != null) {
return cached;
}
return heightNoise.aquire(() -> new LayerNoise(noise.get().sampler(THICKNESS_STYLE,
rng.nextParallelRNG(settings.minHeight() * settings.maxHeight() + blocks().size()).getSeed())));
}
/** The layer's block at the position, picked as {@link LayerBlocks#pick} says, or null when the palette has no block. */
public BlockState get(RNG parent, int signature, double x, double y, double z) {
int index = layerBlocks.get().pick(settings, parent, signature, x, y, z);
return index == LayerBlocks.NONE ? null : blocks().get(index);
}
/** {@link #get(RNG, int, double, double, double)} for a layer asked once per column, such as a slab or a wall. */
public BlockState get(RNG rng, double x, double y, double z) {
return get(rng, 0, x, y, z);
}
private List<BlockState> blocks() {
List<BlockState> cached = blocks.getIfPresent();
if (cached != null) {
return cached;
}
return blocks.aquire(() -> layerBlocks.get().blocks(settings));
}
}
@@ -0,0 +1,47 @@
/*
* 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.modules.terrain;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.block.BlockSpec;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.List;
/**
* The blocks that fill terrain below the layers of a dimension, written as {@code "rockPalette": {...}}, a palette. A dimension without the key is stone.
*/
@Desc("The palette of blocks for 'stone'")
@Feature(id = "iris:terrain/rock-palette", name = "Rock palette", key = "rockPalette", root = "palette", targets = Level.DIMENSION)
public final class RockPaletteSettings implements IrisFeature {
private static final String DEFAULT_BLOCK = "stone";
@Desc("The palette of blocks for 'stone'")
private PaletteSpec palette = PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK)));
public RockPaletteSettings() {
}
public PaletteSpec palette() {
return palette == null ? PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK))) : palette;
}
}
@@ -0,0 +1,44 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import java.util.List;
/**
* The layers of material filling the water column of a sea biome, written as {@code "seaLayers": [...]}, the list of layers.
*/
@Desc("Layers of materials filling the water column of sea biomes, indexed downward from the water surface. Anything below the last layer is filled with the dimension fluid palette, not stone.")
@Feature(id = "iris:terrain/sea-layers", name = "Sea layers", key = "seaLayers", root = "layers", targets = Level.BIOME)
public final class SeaLayersSettings implements IrisFeature {
@Desc("Layers of materials filling the water column of sea biomes, indexed downward from the water surface. Anything below the last layer is filled with the dimension fluid palette, not stone.")
private List<PaletteLayer> layers = List.of();
public SeaLayersSettings() {
}
public List<PaletteLayer> layers() {
return layers == null ? List.of() : layers;
}
}
@@ -0,0 +1,42 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/**
* The slab post processing places on steps in a biome, written as {@code "slab": {...}}, one layer. A biome without the key has no slab.
*/
@Desc("The default slab if iris decides to place a slab in this biome. Default is no slab.")
@Feature(id = "iris:terrain/slab", name = "Slab", key = "slab", root = "layer", targets = Level.BIOME)
public final class SlabSettings implements IrisFeature {
@Desc("The default slab if iris decides to place a slab in this biome. Default is no slab.")
private PaletteLayer layer = PaletteLayer.withoutBlocks();
public SlabSettings() {
}
public PaletteLayer layer() {
return layer == null ? PaletteLayer.withoutBlocks() : layer;
}
}
@@ -0,0 +1,140 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.IrisSeedPurposes;
import art.arcane.volmlib.util.cache.AtomicCache;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.block.BlockState;
import com.volmit.block.PaletteSpec;
import com.volmit.config.SettingsStack;
import com.volmit.noise.NoiseSampler;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.world.PackWorld;
import com.volmit.world.UpperDimension;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* What the terrain module keeps for one world about the palettes that fill its terrain: the rock below the biomes' layers
* and the fluid of its oceans and aquifers, as a block for every column, and the rock of an upper dimension. They are the
* dimension's {@link RockPaletteSettings} and {@link FluidPaletteSettings}.
*
* <p>The noise of a palette is seeded from the world's complex seed and a signature of its own, as the complex always did, so
* a column's rock and fluid do not depend on who asks first.
*/
public final class TerrainPalettes {
private static final int ROCK_SIGNATURE = 45;
private static final int FLUID_SIGNATURE = 78;
/** The salt Iris's material palettes always added to the seed of the noise that picks their blocks. */
private static final int PALETTE_NOISE_SALT = -23_498_896;
/** A block for every column. */
@FunctionalInterface
public interface ColumnBlocks {
/** The block at the column, or null when the palette has no block. */
BlockState at(double x, double z);
}
private final PackWorld world;
private final long complexSeed;
private final AtomicCache<ColumnBlocks> rock = new AtomicCache<>();
private final AtomicCache<ColumnBlocks> fluid = new AtomicCache<>();
private final Map<ResourceId, ColumnBlocks> upperRocks = new ConcurrentHashMap<>();
TerrainPalettes(PackWorld world) {
this.world = world;
this.complexSeed = world.seed(IrisSeedPurposes.COMPLEX);
}
/** The palettes of {@code world}. */
public static TerrainPalettes of(PackWorld world) {
return world.state(TerrainPalettes.class, TerrainPalettes::new);
}
/** Builds the rock and fluid noise now instead of when first asked for. */
public void warm() {
rock();
fluid();
}
/** The rock at the column, below the biome's layers. */
public BlockState rockAt(double x, double z) {
return rock().at(x, z);
}
/** The fluid at the column, above the terrain up to the fluid height. */
public BlockState fluidAt(double x, double z) {
return fluid().at(x, z);
}
/** The rock at the column of the upper dimension: the world's own when the upper dimension is the dimension itself. */
public BlockState upperRockAt(UpperDimension upper, double x, double z) {
return upperRocks.computeIfAbsent(upper.id(), id -> upperRock(upper, x, z)).at(x, z);
}
private ColumnBlocks rock() {
return rock.aquireOrThrow(() -> columns(rockPalette(world.settings().declared(RockPaletteSettings.class)), complexRng().nextParallelRNG(ROCK_SIGNATURE),
world.resources()));
}
private ColumnBlocks fluid() {
return fluid.aquireOrThrow(() -> columns(fluidPalette(world.settings().declared(FluidPaletteSettings.class)), complexRng().nextParallelRNG(FLUID_SIGNATURE),
world.resources()));
}
private RNG complexRng() {
return new RNG(complexSeed);
}
private ColumnBlocks upperRock(UpperDimension upper, double x, double z) {
if (upper.isThisDimension()) {
return rock();
}
// Iris seeded this from the dimension's key; the id's path is that key for every key an id can hold unchanged.
long seedOffset = upper.id().path().hashCode();
RNG rng = new RNG(complexSeed ^ seedOffset);
SettingsStack<RockPaletteSettings> declared = upper.settings().at(RockPaletteSettings.class, (int) x, (int) z);
return columns(rockPalette(declared), rng.nextParallelRNG(ROCK_SIGNATURE), upper.resources());
}
private static PaletteSpec rockPalette(SettingsStack<RockPaletteSettings> declared) {
return declared.dimension().orElseGet(RockPaletteSettings::new).palette();
}
private static PaletteSpec fluidPalette(SettingsStack<FluidPaletteSettings> declared) {
return declared.dimension().orElseGet(FluidPaletteSettings::new).palette();
}
/** The palette's blocks over the columns, picked by its noise: the noise at a column, from 0 to 1, is how far down the weighted list the block is. */
private static ColumnBlocks columns(PaletteSpec palette, RNG rng, PackResources resources) {
List<BlockState> blocks = PaletteBlocks.weighted(resources.blocks(), palette.palette());
if (blocks.isEmpty()) {
return (x, z) -> null;
}
long seed = rng.getSeed() + (PALETTE_NOISE_SALT + blocks.size());
NoiseSampler noise = resources.noise().sampler(palette.style(), seed);
int last = blocks.size() - 1;
return (x, z) -> blocks.get((int) Math.round(noise.sample(x, z) * last));
}
}
@@ -0,0 +1,43 @@
/*
* 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.modules.terrain;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/**
* The wall post processing paints on steep faces, and caves paint on their walls, in a biome, written as {@code "wall": {...}}, one layer.
* A biome without the key has no wall.
*/
@Desc("The default wall if iris decides to place a wall higher than 2 blocks (steep hills or possibly cliffs)")
@Feature(id = "iris:terrain/wall", name = "Wall", key = "wall", root = "layer", targets = Level.BIOME)
public final class WallSettings implements IrisFeature {
@Desc("The default wall if iris decides to place a wall higher than 2 blocks (steep hills or possibly cliffs)")
private PaletteLayer layer = PaletteLayer.withoutBlocks();
public WallSettings() {
}
public PaletteLayer layer() {
return layer == null ? PaletteLayer.withoutBlocks() : layer;
}
}
@@ -0,0 +1,76 @@
/*
* 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.modules.vanillafeatures;
import com.volmit.config.Level;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
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 = Level.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;
@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();
@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();
@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);
}
}