Merge branch 'wave2/e2'

# Conflicts:
#	src/main/java/art/arcane/iris/engine/framework/IrisStructureLocator.java
#	src/main/java/art/arcane/iris/engine/mantle/components/ObjectModule.java
#	src/main/java/art/arcane/iris/engine/object/placement/BlocksModule.java
#	src/main/java/art/arcane/iris/engine/object/placement/IrisObjectPlacement.java
#	src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimension.java
This commit is contained in:
piexel committed 2026-10-09 22:33:42 +02:00
commit cd7584b2ab
126 files changed
+4291 -2047

No files matched your search

@@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.placement;
package art.arcane.iris.builtin.anchor;
/** How a placement mode finds the height of an object placed without a requested height. */
enum AnchorSampling {
public enum AnchorSampling {
/** The surface at the object's center, or the floor of the cave it is placed in. */
CENTER,
/** The highest surface under any column of the object. */
@@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.placement;
package art.arcane.iris.builtin.anchor;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Object Place modes are useful for positioning objects just right. The default value is CENTER_HEIGHT.")
@@ -115,16 +115,16 @@ public enum ObjectPlaceMode {
}
/** How a placement without a requested height finds one. */
AnchorSampling anchor() {
public AnchorSampling anchor() {
return anchor;
}
/** The stilt this mode grows under or above the object. */
StiltShape stilt() {
public StiltShape stilt() {
return stilt;
}
boolean isVacuum() {
return IrisObjectVacuum.isVacuumMode(this);
public boolean isVacuum() {
return this == VACUUM || this == VACUUM_HIGH || this == VACUUM_FAST || this == VACUUM_ORGANIC || this == VACUUM_WAVY;
}
}
@@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.placement;
package art.arcane.iris.builtin.anchor;
/** What a placement mode grows between the object and the ground or ceiling. */
enum StiltShape {
public enum StiltShape {
NONE,
/** Repeats the bottom layer straight down to the surface. */
STRAIGHT,
@@ -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.builtin.blocks;
import com.volmit.block.BlockSpec;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinItems;
import com.volmit.config.MinNumber;
import com.volmit.config.Required;
import com.volmit.config.Snippet;
import java.util.Collections;
import java.util.List;
/** One find-and-replace of an object placement's blocks, an entry of the placement's {@code edit}. */
@Snippet("object-block-replacer")
@Desc("Find and replace object materials")
public final class ObjectReplace {
@MinItems(1)
@Required
@Desc("Find this block")
private List<BlockSpec> find = List.of();
@Required
@Desc("Replace it with this block palette")
private PaletteSpec replace = PaletteSpec.of(List.of(BlockSpec.of("stone")));
@Desc("Exactly match the block data or not")
private boolean exact = false;
@MinNumber(0)
@MaxNumber(1)
@Desc("Modifies the chance the block is replaced")
private float chance = 1;
public ObjectReplace() {
}
public List<BlockSpec> find() {
return find == null ? List.of() : Collections.unmodifiableList(find);
}
public PaletteSpec replace() {
return replace == null ? PaletteSpec.of(List.of(BlockSpec.of("stone"))) : replace;
}
public boolean exact() {
return exact;
}
public float chance() {
return chance;
}
}
@@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.terrain.carving;
package art.arcane.iris.builtin.carve;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Defines if an object is allowed to place in carvings, surfaces or both.")
public enum CarvingMode {
@@ -1,9 +1,9 @@
package art.arcane.iris.engine.object.terrain.carving;
package art.arcane.iris.builtin.carve;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Defines which carved-space anchor to target for cave object placement.")
public enum IrisCaveAnchorMode {
public enum CaveAnchorMode {
@Desc("Use the active cave profile default anchor mode.")
PROFILE_DEFAULT,
@@ -0,0 +1,66 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.carve;
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;
/** One more layer of noise a cave profile blends into its density, an entry of the profile's {@code modules}. */
@Desc("Represents a modular cave-density layer.")
public final class CaveFieldModule {
@Desc("Density style used by this module.")
private NoiseStyle style = NoiseStyle.of("CELLULAR_IRIS_DOUBLE");
@MinNumber(0)
@Desc("Layer contribution multiplier.")
private double weight = 1;
@MinNumber(-1)
@MaxNumber(1)
@Desc("Threshold offset applied to this layer before blending.")
private double threshold = 0;
@Desc("Vertical bounds where this module can contribute, in engine-local Y where 0 is the bottom of the dimension, not world Y.")
private Range verticalRange = Range.of(0, 384);
@Desc("Invert this module before weighting.")
private boolean invert = false;
public CaveFieldModule() {
}
public NoiseStyle style() {
return style;
}
public double weight() {
return weight;
}
public double threshold() {
return threshold;
}
public Range verticalRange() {
return verticalRange;
}
public boolean invert() {
return invert;
}
}
@@ -0,0 +1,303 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.carve;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinItems;
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/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. IrisApi types only; the carving module builds the noise.
*/
@Snippet("cave-profile")
@Desc("Represents a configurable 3D cave profile.")
public final class CaveProfile {
@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;
@MinItems(1)
@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;
}
}
@@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.terrain.floating;
package art.arcane.iris.builtin.floating;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Controls how floating-child island underside blocks choose their palette.")
public enum FloatingBottomPaletteMode {
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,148 +16,44 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.terrain.floating;
package art.arcane.iris.builtin.floating;
import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
import art.arcane.iris.engine.object.noise.NoiseStyle;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.engine.object.prefab.IrisObjectScale;
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveProfileSampler;
import art.arcane.iris.engine.object.value.IRare;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingEntry;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.annotations.ArrayType;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.RegistryListResource;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.iris.util.project.noise.CNG;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinItems;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Snippet;
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. Noise and options are IrisApi types; the object placements and palette layers the island hosts are
* Iris's own classes, which the host describes itself, so this class leaves the pack module jar only when those
* become settings of modules.
*/
@Snippet("floating-child-biome")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@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).")
@Data
public class IrisFloatingChildBiomes implements IRare {
private final transient AtomicCache<IrisBiome> resolvedBiome = new AtomicCache<>();
private final transient AtomicCache<CNG> footprintCache = new AtomicCache<>();
private final transient AtomicCache<FloatingIslandEdgeProfile> edgeTaperProfileCache = new AtomicCache<>();
private final transient AtomicCache<CNG> pickerCache = new AtomicCache<>();
private final transient AtomicCache<CNG> altitudeCache = new AtomicCache<>();
private final transient AtomicCache<CNG> topShapeCache = new AtomicCache<>();
private final transient AtomicCache<CNG> bottomCache = new AtomicCache<>();
private final transient AtomicCache<CNG> wallWarpCache = new AtomicCache<>();
private final transient AtomicCache<CNG> carveCache = new AtomicCache<>();
private final transient AtomicCache<IrisCaveProfileSampler> carvingProfileSamplerCache = new AtomicCache<>(true);
private final transient AtomicCache<IrisObjectScale> shrinkScaleCache = new AtomicCache<>();
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");
public CNG getFootprintCng(long baseSeed, IrisData data) {
return footprintCache.aquire(() -> getFootprintStyle().create(new RNG(baseSeed ^ 0xF007B17DL), data));
}
public FloatingIslandEdgeProfile getEdgeTaperProfile(long baseSeed, IrisData data) {
return edgeTaperProfileCache.aquire(() -> {
int width = FloatingIslandEdgeProfile.clampWidth(getEdgeTaperWidth());
double amplitude = FloatingIslandEdgeProfile.clampVariationAmplitude(
getEdgeTaperVariationAmplitude(), width);
IrisGeneratorStyle style = getEdgeTaperVariationStyle();
CNG variation = amplitude > 0.0D && style != null
? style.create(new RNG(baseSeed ^ 0xED6E7A9E5L), data)
: null;
return new FloatingIslandEdgeProfile(width, getEdgeTaperExponent(), amplitude, variation);
});
}
public CNG getPickerCng(long baseSeed, IrisData data) {
return pickerCache.aquire(() -> getPickerStyle().create(new RNG(baseSeed ^ 0x91C4E72DL), data));
}
public CNG getAltitudeCng(long baseSeed, IrisData data) {
return altitudeCache.aquire(() -> getAltitudeStyle().create(new RNG(baseSeed ^ 0xA17DEBBL), data));
}
public CNG getTopShapeCng(long baseSeed, IrisData data) {
return topShapeCache.aquire(() -> getTopShapeStyle().create(new RNG(baseSeed ^ 0x70970601DEFL), data));
}
public CNG getBottomCng(long baseSeed, IrisData data) {
return bottomCache.aquire(() -> getBottomStyle().create(new RNG(baseSeed ^ 0xB0770075CAFEL), data));
}
public CNG getWallWarpCng(long baseSeed, IrisData data) {
IrisGeneratorStyle style = getWallWarpStyle();
if (style == null) {
return null;
}
return wallWarpCache.aquire(() -> style.create(new RNG(baseSeed ^ 0xA117BA17E0FL), data));
}
public CNG getCarveCng(long baseSeed, IrisData data) {
IrisGeneratorStyle style = getCarveStyle();
if (style == null) {
return null;
}
return carveCache.aquire(() -> style.create(new RNG(baseSeed ^ 0xCA5EC1EE5EL), data));
}
public IrisCaveProfileSampler getCarvingProfileSampler(Engine engine, IrisData data) {
if (!hasCarvingReference()) {
return null;
}
return carvingProfileSamplerCache.aquire(() -> {
IrisBiome resolved = resolveCarvingBiome(carving, engine, data);
if (resolved == null || resolved.getCaveProfile() == null || !resolved.getCaveProfile().isEnabled()) {
return null;
}
return new IrisCaveProfileSampler(engine, resolved.getCaveProfile());
});
}
public boolean hasCarvingReference() {
return carving != null && !carving.isBlank();
}
static IrisBiome resolveCarvingBiome(String carving, Engine engine, IrisData data) {
if (carving == null || carving.isBlank() || engine == null || data == null) {
return null;
}
IrisDimension dimension = engine.getDimension();
if (dimension != null && dimension.getCarvingEntryIndex() != null) {
IrisDimensionCarvingEntry entry = dimension.getCarvingEntryIndex().get(carving);
if (entry != null) {
return IrisDimensionCarvingResolver.resolveEntryBiome(engine, entry);
}
}
if (data.getBiomeLoader() == null) {
return null;
}
return data.getBiomeLoader().load(carving);
}
@RegistryListResource(IrisBiome.class)
@Ref(Reference.PACK_BIOME)
@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 = "";
@@ -167,7 +63,7 @@ public class IrisFloatingChildBiomes implements IRare {
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 IrisGeneratorStyle footprintStyle = NoiseStyle.SIMPLEX.style();
private NoiseStyle footprintStyle = DEFAULT_FOOTPRINT_STYLE;
@MinNumber(0)
@MaxNumber(1)
@@ -177,15 +73,15 @@ public class IrisFloatingChildBiomes implements IRare {
@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 = FloatingIslandEdgeProfile.DEFAULT_WIDTH;
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 = FloatingIslandEdgeProfile.DEFAULT_EXPONENT;
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 IrisGeneratorStyle edgeTaperVariationStyle = NoiseStyle.SIMPLEX.style().zoomed(0.18D);
private NoiseStyle edgeTaperVariationStyle = DEFAULT_EDGE_TAPER_VARIATION_STYLE;
@MinNumber(0)
@MaxNumber(8)
@@ -193,10 +89,10 @@ public class IrisFloatingChildBiomes implements IRare {
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 IrisGeneratorStyle pickerStyle = NoiseStyle.SIMPLEX.style();
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 IrisGeneratorStyle altitudeStyle = NoiseStyle.SIMPLEX.style();
private NoiseStyle altitudeStyle = DEFAULT_ALTITUDE_STYLE;
@MinNumber(0)
@MaxNumber(2032)
@@ -223,7 +119,7 @@ public class IrisFloatingChildBiomes implements IRare {
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 IrisGeneratorStyle topShapeStyle = NoiseStyle.SIMPLEX.style();
private NoiseStyle topShapeStyle = DEFAULT_TOP_SHAPE_STYLE;
@MinNumber(0)
@MaxNumber(1)
@@ -231,7 +127,7 @@ public class IrisFloatingChildBiomes implements IRare {
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 IrisGeneratorStyle bottomStyle = NoiseStyle.SIMPLEX.style();
private NoiseStyle bottomStyle = DEFAULT_BOTTOM_STYLE;
@MinNumber(0)
@MaxNumber(512)
@@ -251,9 +147,9 @@ public class IrisFloatingChildBiomes implements IRare {
@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;
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
@MinItems(1)
@Desc("Custom palette layers used near the underside when bottomPaletteMode=CUSTOM. The layer format is the same as normal biome layers.")
private KList<IrisBiomePaletteLayer> bottomPalette = new KList<>();
private List<IrisBiomePaletteLayer> bottomPalette = List.of();
@MinNumber(1)
@MaxNumber(512)
@@ -261,7 +157,7 @@ public class IrisFloatingChildBiomes implements IRare {
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 IrisGeneratorStyle wallWarpStyle = null;
private NoiseStyle wallWarpStyle;
@MinNumber(0)
@MaxNumber(64)
@@ -269,7 +165,7 @@ public class IrisFloatingChildBiomes implements IRare {
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 IrisGeneratorStyle carveStyle = null;
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 = "";
@@ -283,7 +179,7 @@ public class IrisFloatingChildBiomes implements IRare {
private Integer localFluidHeight = null;
@Desc("Block used for the internal water pool when localFluidHeight is positive.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String fluidBlock = "minecraft:water";
@Desc("When true, the target biome's decorators apply to the island's top surface.")
@@ -297,13 +193,13 @@ public class IrisFloatingChildBiomes implements IRare {
@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;
@ArrayType(min = 1, type = IrisObjectPlacement.class)
@MinItems(1)
@Desc("Additional object placements anchored to the island top.")
private KList<IrisObjectPlacement> extraObjects = new KList<>();
private List<IrisObjectPlacement> extraObjects = List.of();
@ArrayType(min = 1, type = IrisObjectPlacement.class)
@MinItems(1)
@Desc("Additional object placements that float freely in air, independent of the island. Forced to ObjectPlaceMode.FLOATING.")
private KList<IrisObjectPlacement> floatingObjects = new KList<>();
private List<IrisObjectPlacement> floatingObjects = List.of();
@Desc("Visualization color for this floating child in Iris Studio.")
private String color = null;
@@ -314,63 +210,187 @@ public class IrisFloatingChildBiomes implements IRare {
@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;
@ArrayType(min = 1, type = IrisObjectPlacement.class)
@MinItems(1)
@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 KList<IrisObjectPlacement> topObjectOverrides = new KList<>();
private List<IrisObjectPlacement> topObjectOverrides = List.of();
@ArrayType(min = 1, type = IrisObjectPlacement.class)
@MinItems(1)
@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 KList<IrisObjectPlacement> bottomObjectOverrides = new KList<>();
private List<IrisObjectPlacement> bottomObjectOverrides = List.of();
public KList<IrisObjectPlacement> resolveTopObjects(IrisBiome target) {
KList<IrisObjectPlacement> surfaceObjects = (inheritObjects && target != null) ? target.getSurfaceObjects() : new KList<>();
return resolveTopObjectsFromSurface(surfaceObjects);
public FloatingChildBiome() {
}
KList<IrisObjectPlacement> resolveTopObjectsFromSurface(KList<IrisObjectPlacement> surfaceObjects) {
return switch (topObjectMode) {
case REPLACE -> new KList<>(topObjectOverrides);
case MERGE -> {
KList<IrisObjectPlacement> merged = new KList<>();
merged.addAll(surfaceObjects);
merged.addAll(topObjectOverrides);
yield merged;
}
case INHERIT_ONLY -> surfaceObjects;
};
public String biome() {
return biome == null ? "" : biome;
}
public KList<IrisObjectPlacement> resolveBottomObjects(IrisBiome target) {
return switch (bottomObjectMode) {
case INHERIT_ONLY -> new KList<>();
case MERGE, REPLACE -> bottomObjectOverrides;
};
public int rarity() {
return rarity;
}
public boolean hasObjectShrink() {
return objectShrinkFactor > 0 && objectShrinkFactor < 1.0;
public NoiseStyle footprintStyle() {
return footprintStyle == null ? DEFAULT_FOOTPRINT_STYLE : footprintStyle;
}
public IrisObjectScale getShrinkScale() {
return shrinkScaleCache.aquire(() -> {
IrisObjectScale s = new IrisObjectScale();
s.setSize(Math.max(0.01, Math.min(1.0, objectShrinkFactor)));
return s;
});
public double footprintThreshold() {
return footprintThreshold;
}
public IrisBiome getRealBiome(IrisBiome parent, IrisData data) {
return resolvedBiome.aquire(() -> {
if (biome == null || biome.isBlank() || biome.equals(parent.getLoadKey())) {
return parent;
}
public int edgeTaperWidth() {
return edgeTaperWidth;
}
IrisBiome loaded = data.getBiomeLoader().load(biome);
if (loaded == null) {
return parent;
}
public double edgeTaperExponent() {
return edgeTaperExponent;
}
return loaded;
});
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<IrisBiomePaletteLayer> 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<IrisObjectPlacement> extraObjects() {
return extraObjects == null ? List.of() : Collections.unmodifiableList(extraObjects);
}
public List<IrisObjectPlacement> 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<IrisObjectPlacement> topObjectOverrides() {
return topObjectOverrides == null ? List.of() : Collections.unmodifiableList(topObjectOverrides);
}
public List<IrisObjectPlacement> bottomObjectOverrides() {
return bottomObjectOverrides == null ? List.of() : Collections.unmodifiableList(bottomObjectOverrides);
}
}
@@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.terrain.floating;
package art.arcane.iris.builtin.floating;
import art.arcane.iris.engine.object.annotations.Desc;
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 {
@@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.terrain.floating;
package art.arcane.iris.builtin.floating;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("How the top profile of a floating-child island is shaped.")
public enum TopShapeMode {
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,44 +16,29 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.coral;
package art.arcane.iris.builtin.objects.coral;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.placement.IrisObjectLimit;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.IrisStiltSettings;
import art.arcane.iris.engine.object.placement.IrisVacuumSettings;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
import art.arcane.iris.engine.object.procedural.IrisProceduralPlacement;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.iris.engine.object.procedural.coral.CoralGenerator;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.prepare.ObjectTranslate;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.validate.ObjectLimit;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Required;
import java.util.Optional;
@Snippet("coral")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A single procedurally generated coral reef structure. Iris bakes a pool of deterministic variants from these settings and scatters them across the seafloor at world-gen time, exactly like an object placement but generated from scratch instead of loaded from an iob file. Mirrors the procedural tree system but tuned for underwater reefs: structural blocks are waterlogged so the coral stays alive, and placement defaults to anchoring on the terrain beneath the water surface.")
@Data
public class IrisCoral implements IrisProceduralPlacement {
private final transient AtomicCache<KList<IrisObject>> variantCache = new AtomicCache<>();
public final class Coral {
@Desc("A human readable name used in logs and as the variant load key.")
private String name = "coral";
@@ -78,10 +63,10 @@ public class IrisCoral implements IrisProceduralPlacement {
private ObjectPlaceMode mode = ObjectPlaceMode.CENTER_HEIGHT;
@Desc("Rotate this coral's placement.")
private IrisObjectRotation rotation = new IrisObjectRotation();
private ObjectRotation rotation = new ObjectRotation();
@Desc("Limit the max or min height of placement.")
private IrisObjectLimit clamp = new IrisObjectLimit();
private ObjectLimit clamp = new ObjectLimit();
@Desc("Whether this coral may place on the terrain surface, under carvings, or both.")
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
@@ -90,34 +75,34 @@ public class IrisCoral implements IrisProceduralPlacement {
private boolean underwater = true;
@Desc("Translate (offset) this placement along each axis; for example set a negative y to sink it into the seafloor.")
private IrisObjectTranslate translate = new IrisObjectTranslate();
private ObjectTranslate translate = new ObjectTranslate();
@Desc("Settings for the stilt place modes (STILT, MIN_STILT, FAST_STILT, CENTER_STILT, ERODE_STILT, ORGANIC_STILT).")
private IrisStiltSettings stiltSettings;
private StiltSettings stiltSettings;
@Desc("Settings for the vacuum place modes (VACUUM, VACUUM_HIGH, VACUUM_FAST, VACUUM_ORGANIC).")
private IrisVacuumSettings vacuumSettings;
private VacuumSettings vacuumSettings;
@Desc("If true (default), every resolved coral block that is waterloggable is forced waterlogged so the coral does not die in water (coral fans, sea pickles and kelp also waterlog). Set false to place dead/dry coral.")
private boolean waterlogged = true;
@Desc("The overall silhouette this coral grows into (branching, fan, brain, pillar, tendril). Each form runs a different generation routine.")
private IrisCoralForm form = IrisCoralForm.BRANCHING;
private CoralForm form = CoralForm.BRANCHING;
@Required
@Desc("The structural coral block (the living wood of the reef), e.g. minecraft:tube_coral_block. Ignored when blockPalette is set.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String block = "minecraft:tube_coral_block";
@Desc("A noise-driven palette for the structural coral block. When set this overrides the single block, letting the reef mix tube/brain/bubble/fire/horn coral_block tones across its body.")
private IrisMaterialPalette blockPalette = null;
private PaletteSpec blockPalette;
@Desc("Optional tip block placed at branch tips and at the very top of the structure, e.g. coral fans or minecraft:sea_pickle. Ignored when tipPalette is set. Null disables tips.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String tipBlock = null;
@Desc("A noise-driven palette for the tip block. When set this overrides the single tipBlock, letting tips mix fan / pickle decorations.")
private IrisMaterialPalette tipPalette = null;
private PaletteSpec tipPalette;
@MinNumber(0)
@MaxNumber(1)
@@ -156,7 +141,7 @@ public class IrisCoral implements IrisProceduralPlacement {
private double branchElevation = 55;
@Desc("BRANCHING only: how the arms are distributed around the stalk by azimuth.")
private IrisCoralBranchAzimuth branchAzimuth = IrisCoralBranchAzimuth.GOLDEN_ANGLE;
private CoralBranchAzimuth branchAzimuth = CoralBranchAzimuth.GOLDEN_ANGLE;
@Desc("BRANCHING only: if true, each arm splits once into a small fan of sub-arms for a bushier reef.")
private boolean subBranches = true;
@@ -201,49 +186,159 @@ public class IrisCoral implements IrisProceduralPlacement {
@Desc("TENDRIL only: how many thin wavy stalks rise from the base.")
private int tendrilCount = 4;
public KList<IrisObject> getVariantObjects(IrisData data) {
return variantCache.aquire(() -> {
KList<IrisObject> baked = new KList<>();
int count = Math.max(1, variants);
for (int i = 0; i < count; i++) {
IrisObject object = CoralGenerator.generate(this, i, new RNG(seed + (i * 7919L)), data);
if (object == null || object.getBlocks().isEmpty()) {
continue;
}
object.setLoadKey("procedural/" + name + "#" + i);
object.setLoader(data);
baked.add(object);
}
return baked;
});
public Coral() {
}
public IrisObject getVariantObject(IrisData data, RNG rng) {
KList<IrisObject> baked = getVariantObjects(data);
if (baked == null || baked.isEmpty()) {
return null;
}
return baked.get(rng.i(baked.size()));
public String name() {
return name;
}
public IrisObjectPlacement asPlacement() {
IrisObjectPlacement placement = new IrisObjectPlacement();
placement.setMode(mode);
placement.setRotation(rotation);
placement.setClamp(clamp);
placement.setCarvingSupport(carvingSupport);
placement.setUnderwater(underwater);
placement.setTranslate(translate);
placement.setStiltSettings(stiltSettings);
placement.setVacuumSettings(vacuumSettings);
placement.setChance(chance);
placement.setDensity(density);
return placement;
public double chance() {
return chance;
}
public boolean isPlausible() {
return false;
public int density() {
return density;
}
public int variants() {
return variants;
}
public long seed() {
return seed;
}
public ObjectPlaceMode mode() {
return mode == null ? ObjectPlaceMode.CENTER_HEIGHT : mode;
}
public ObjectRotation rotation() {
return rotation;
}
public ObjectLimit clamp() {
return clamp;
}
public CarvingMode carvingSupport() {
return carvingSupport == null ? CarvingMode.SURFACE_ONLY : carvingSupport;
}
public boolean underwater() {
return underwater;
}
public ObjectTranslate translate() {
return translate;
}
/** Empty where the pack sets none. */
public Optional<StiltSettings> stiltSettings() {
return Optional.ofNullable(stiltSettings);
}
/** Empty where the pack sets none. */
public Optional<VacuumSettings> vacuumSettings() {
return Optional.ofNullable(vacuumSettings);
}
public boolean waterlogged() {
return waterlogged;
}
public CoralForm form() {
return form == null ? CoralForm.BRANCHING : form;
}
public String block() {
return block;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> blockPalette() {
return Optional.ofNullable(blockPalette);
}
/** Empty where the pack sets none. */
public Optional<String> tipBlock() {
return Optional.ofNullable(tipBlock);
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> tipPalette() {
return Optional.ofNullable(tipPalette);
}
public double tipChance() {
return tipChance;
}
public int heightMin() {
return heightMin;
}
public int heightMax() {
return heightMax;
}
public double spread() {
return spread;
}
public double sway() {
return sway;
}
public int branchCount() {
return branchCount;
}
public double branchLength() {
return branchLength;
}
public double branchElevation() {
return branchElevation;
}
public CoralBranchAzimuth branchAzimuth() {
return branchAzimuth == null ? CoralBranchAzimuth.GOLDEN_ANGLE : branchAzimuth;
}
public boolean subBranches() {
return subBranches;
}
public int subBranchCount() {
return subBranchCount;
}
public double subBranchScale() {
return subBranchScale;
}
public int tipClusterRadius() {
return tipClusterRadius;
}
public int brainRadius() {
return brainRadius;
}
public double brainRoughness() {
return brainRoughness;
}
public int pillarRadius() {
return pillarRadius;
}
public int fanWidth() {
return fanWidth;
}
public int tendrilCount() {
return tendrilCount;
}
}
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.coral;
package art.arcane.iris.builtin.objects.coral;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("How the arms of a BRANCHING coral are distributed around the central stalk by compass azimuth.")
public enum IrisCoralBranchAzimuth {
public enum CoralBranchAzimuth {
@Desc("Distribute arms by the golden angle (about 137.5 degrees per arm) for a natural phyllotactic spiral where no two arms overlap.")
GOLDEN_ANGLE,
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.coral;
package art.arcane.iris.builtin.objects.coral;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("The overall silhouette a procedural coral grows into. Each form drives a completely different generation routine in the coral generator, from tree-like branching arms to rounded brain blobs and thin wavy tendrils.")
public enum IrisCoralForm {
public enum CoralForm {
@Desc("A tree-like coral built from a stout central stalk that sprouts several upward-leaning arms (distributed by golden angle or randomly), each optionally splitting once into sub-arms, with small coral tip clusters (fans / sea pickles) at the ends. The most structurally complex form and the closest analogue to a procedural tree.")
BRANCHING,
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,44 +16,29 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.crystal;
package art.arcane.iris.builtin.objects.crystal;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.placement.IrisObjectLimit;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.IrisStiltSettings;
import art.arcane.iris.engine.object.placement.IrisVacuumSettings;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
import art.arcane.iris.engine.object.procedural.IrisProceduralPlacement;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.iris.engine.object.procedural.crystal.CrystalGenerator;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.prepare.ObjectTranslate;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.validate.ObjectLimit;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Required;
import java.util.Optional;
@Snippet("crystal")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A single procedurally generated crystal cluster: a budding base blob with faceted, tapered shards radiating from it (geode / amethyst-style). Iris bakes a pool of deterministic variants from these settings and scatters them at world-gen time, exactly like an object placement but generated from scratch instead of loaded from an iob file. Built for caves.")
@Data
public class IrisCrystal implements IrisProceduralPlacement {
private final transient AtomicCache<KList<IrisObject>> variantCache = new AtomicCache<>();
public final class Crystal {
@Desc("A human readable name used in logs and as the variant load key.")
private String name = "crystal";
@@ -78,10 +63,10 @@ public class IrisCrystal implements IrisProceduralPlacement {
private ObjectPlaceMode mode = ObjectPlaceMode.CENTER_HEIGHT;
@Desc("Rotate this crystal cluster's placement.")
private IrisObjectRotation rotation = new IrisObjectRotation();
private ObjectRotation rotation = new ObjectRotation();
@Desc("Limit the max or min height of placement.")
private IrisObjectLimit clamp = new IrisObjectLimit();
private ObjectLimit clamp = new ObjectLimit();
@Desc("Whether this crystal cluster may place on the terrain surface, under carvings, or both. Crystals are meant for caves, so this defaults to CARVING_ONLY.")
private CarvingMode carvingSupport = CarvingMode.CARVING_ONLY;
@@ -90,31 +75,31 @@ public class IrisCrystal implements IrisProceduralPlacement {
private boolean underwater = false;
@Desc("Translate (offset) this placement along each axis; for example set a negative y to sink it into the ground.")
private IrisObjectTranslate translate = new IrisObjectTranslate();
private ObjectTranslate translate = new ObjectTranslate();
@Desc("Settings for the stilt place modes (STILT, MIN_STILT, FAST_STILT, CENTER_STILT, ERODE_STILT, ORGANIC_STILT).")
private IrisStiltSettings stiltSettings;
private StiltSettings stiltSettings;
@Desc("Settings for the vacuum place modes (VACUUM, VACUUM_HIGH, VACUUM_FAST, VACUUM_ORGANIC).")
private IrisVacuumSettings vacuumSettings;
private VacuumSettings vacuumSettings;
@Desc("The surface this crystal grows from (FLOOR shards up, CEILING shards down, WALL shards outward). This orients the baked geometry only.")
private IrisCrystalSurface growthSurface = IrisCrystalSurface.FLOOR;
private CrystalSurface growthSurface = CrystalSurface.FLOOR;
@Required
@Desc("The primary crystal shard block, e.g. minecraft:amethyst_block. Ignored when blockPalette is set.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String block = "minecraft:amethyst_block";
@Desc("A noise-driven palette for the crystal shards (a prismatic mix, e.g. amethyst_block, calcite, tinted_glass). When set this overrides the single block, letting the shards mix blocks by noise. Palette wins.")
private IrisMaterialPalette blockPalette = null;
private PaletteSpec blockPalette;
@Desc("Optional block placed at the very tip of each shard for a different colored or sparkling point (e.g. minecraft:amethyst_cluster or glowstone). Ignored when tipPalette is set. If unset and glow is true, a light-emitting block is sprinkled among the tips instead.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String tipBlock = null;
@Desc("A noise-driven palette for the shard tips. When set this overrides the single tipBlock. Palette wins.")
private IrisMaterialPalette tipPalette = null;
private PaletteSpec tipPalette;
@MinNumber(0)
@MaxNumber(1)
@@ -125,15 +110,15 @@ public class IrisCrystal implements IrisProceduralPlacement {
private boolean glow = false;
@Desc("The light-emitting block sprinkled among the tips when glow is true and no tip block is configured.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String glowBlock = "minecraft:glowstone";
@Desc("Optional block for the budding base blob the shards grow from, e.g. minecraft:budding_amethyst or calcite. Ignored when basePalette is set. If unset, the base is built from the primary shard block.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String baseBlock = "minecraft:budding_amethyst";
@Desc("A noise-driven palette for the budding base blob. When set this overrides the single baseBlock. Palette wins.")
private IrisMaterialPalette basePalette = null;
private PaletteSpec basePalette;
@MinNumber(0)
@Desc("Radius in blocks of the budding base blob the shards radiate from. 0 places no base blob (shards spring from a single point).")
@@ -175,56 +160,155 @@ public class IrisCrystal implements IrisProceduralPlacement {
private double spreadAngle = 45;
@Desc("How the shard azimuths are distributed around the normal (RANDOM for a chaotic clump, GOLDEN_ANGLE for an evenly spaced rosette).")
private IrisCrystalDistribution distribution = IrisCrystalDistribution.GOLDEN_ANGLE;
private CrystalDistribution distribution = CrystalDistribution.GOLDEN_ANGLE;
@MinNumber(0)
@MaxNumber(1)
@Desc("Per-shard angular randomness (0-1) added on top of the chosen distribution so the cluster never looks mechanically regular. 0 is perfectly distributed; 1 is heavily jittered.")
private double jitter = 0.25;
public KList<IrisObject> getVariantObjects(IrisData data) {
return variantCache.aquire(() -> {
KList<IrisObject> baked = new KList<>();
int count = Math.max(1, variants);
for (int i = 0; i < count; i++) {
IrisObject object = CrystalGenerator.generate(this, i, new RNG(seed + (i * 7919L)), data);
if (object == null || object.getBlocks().isEmpty()) {
continue;
}
object.setLoadKey("procedural/" + name + "#" + i);
object.setLoader(data);
baked.add(object);
}
return baked;
});
public Crystal() {
}
public IrisObject getVariantObject(IrisData data, RNG rng) {
KList<IrisObject> baked = getVariantObjects(data);
if (baked == null || baked.isEmpty()) {
return null;
}
return baked.get(rng.i(baked.size()));
public String name() {
return name;
}
public IrisObjectPlacement asPlacement() {
IrisObjectPlacement placement = new IrisObjectPlacement();
placement.setMode(mode);
placement.setRotation(rotation);
placement.setClamp(clamp);
placement.setCarvingSupport(carvingSupport);
placement.setUnderwater(underwater);
placement.setTranslate(translate);
placement.setStiltSettings(stiltSettings);
placement.setVacuumSettings(vacuumSettings);
placement.setChance(chance);
placement.setDensity(density);
return placement;
public double chance() {
return chance;
}
public boolean isPlausible() {
return false;
public int density() {
return density;
}
public int variants() {
return variants;
}
public long seed() {
return seed;
}
public ObjectPlaceMode mode() {
return mode == null ? ObjectPlaceMode.CENTER_HEIGHT : mode;
}
public ObjectRotation rotation() {
return rotation;
}
public ObjectLimit clamp() {
return clamp;
}
public CarvingMode carvingSupport() {
return carvingSupport == null ? CarvingMode.CARVING_ONLY : carvingSupport;
}
public boolean underwater() {
return underwater;
}
public ObjectTranslate translate() {
return translate;
}
/** Empty where the pack sets none. */
public Optional<StiltSettings> stiltSettings() {
return Optional.ofNullable(stiltSettings);
}
/** Empty where the pack sets none. */
public Optional<VacuumSettings> vacuumSettings() {
return Optional.ofNullable(vacuumSettings);
}
public CrystalSurface growthSurface() {
return growthSurface == null ? CrystalSurface.FLOOR : growthSurface;
}
public String block() {
return block;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> blockPalette() {
return Optional.ofNullable(blockPalette);
}
/** Empty where the pack sets none. */
public Optional<String> tipBlock() {
return Optional.ofNullable(tipBlock);
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> tipPalette() {
return Optional.ofNullable(tipPalette);
}
public double tipChance() {
return tipChance;
}
public boolean glow() {
return glow;
}
public String glowBlock() {
return glowBlock;
}
public String baseBlock() {
return baseBlock;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> basePalette() {
return Optional.ofNullable(basePalette);
}
public double baseRadius() {
return baseRadius;
}
public double baseNoise() {
return baseNoise;
}
public int shardCountMin() {
return shardCountMin;
}
public int shardCountMax() {
return shardCountMax;
}
public int shardLengthMin() {
return shardLengthMin;
}
public int shardLengthMax() {
return shardLengthMax;
}
public double shardBaseRadius() {
return shardBaseRadius;
}
public double shardTaper() {
return shardTaper;
}
public double spreadAngle() {
return spreadAngle;
}
public CrystalDistribution distribution() {
return distribution == null ? CrystalDistribution.GOLDEN_ANGLE : distribution;
}
public double jitter() {
return jitter;
}
}
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.crystal;
package art.arcane.iris.builtin.objects.crystal;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("How the shards of a crystal cluster are angularly distributed around the surface normal.")
public enum IrisCrystalDistribution {
public enum CrystalDistribution {
@Desc("Each shard gets a uniformly random azimuth around the normal. Produces a chaotic, naturally clumped cluster.")
RANDOM,
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.crystal;
package art.arcane.iris.builtin.objects.crystal;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("The surface a crystal cluster grows from. This only orients the baked geometry (which way the shards point); placement of the object into a cave is handled by the placement system, not here.")
public enum IrisCrystalSurface {
public enum CrystalSurface {
@Desc("Grows from a cave floor. The budding base sits at the bottom and the shards point upward, fanning within the spread cone around the up axis. Built with positive py so the cluster grows up from the base layer.")
FLOOR,
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,44 +16,29 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.formation;
package art.arcane.iris.builtin.objects.formation;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.placement.IrisObjectLimit;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.IrisStiltSettings;
import art.arcane.iris.engine.object.placement.IrisVacuumSettings;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
import art.arcane.iris.engine.object.procedural.IrisProceduralPlacement;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.iris.engine.object.procedural.formation.FormationGenerator;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.prepare.ObjectTranslate;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.validate.ObjectLimit;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Required;
import java.util.Optional;
@Snippet("formation")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A single procedurally generated natural formation, including rock landmarks and magical glacial silhouettes. Iris bakes a pool of deterministic variants from these settings and scatters them at world-gen time, exactly like an object placement but generated from scratch instead of loaded from an iob file.")
@Data
public class IrisFormation implements IrisProceduralPlacement {
private final transient AtomicCache<KList<IrisObject>> variantCache = new AtomicCache<>();
public final class Formation {
@Desc("A human readable name used in logs and as the variant load key.")
private String name = "formation";
@@ -78,10 +63,10 @@ public class IrisFormation implements IrisProceduralPlacement {
private ObjectPlaceMode mode = ObjectPlaceMode.CENTER_HEIGHT;
@Desc("Rotate this formation's placement.")
private IrisObjectRotation rotation = new IrisObjectRotation();
private ObjectRotation rotation = new ObjectRotation();
@Desc("Limit the max or min height of placement.")
private IrisObjectLimit clamp = new IrisObjectLimit();
private ObjectLimit clamp = new ObjectLimit();
@Desc("Whether this formation may place on the terrain surface, under carvings, or both.")
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
@@ -95,34 +80,34 @@ public class IrisFormation implements IrisProceduralPlacement {
private boolean underwater = false;
@Desc("Translate (offset) this placement along each axis; for example set a negative y to sink it into the ground.")
private IrisObjectTranslate translate = new IrisObjectTranslate();
private ObjectTranslate translate = new ObjectTranslate();
@Desc("Settings for the stilt place modes (STILT, MIN_STILT, FAST_STILT, CENTER_STILT, ERODE_STILT, ORGANIC_STILT).")
private IrisStiltSettings stiltSettings;
private StiltSettings stiltSettings;
@Desc("Settings for the vacuum place modes (VACUUM, VACUUM_HIGH, VACUUM_FAST, VACUUM_ORGANIC).")
private IrisVacuumSettings vacuumSettings;
private VacuumSettings vacuumSettings;
@Desc("The overall silhouette of the formation. Drives which sculpting routine the generator uses.")
private IrisFormationForm form = IrisFormationForm.SPIRE;
private FormationForm form = FormationForm.SPIRE;
@Required
@Desc("The main rock block, e.g. minecraft:stone. Ignored when blockPalette is set.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String block = "minecraft:stone";
@Desc("A noise-driven palette for the main rock body. When set this overrides the single block, letting the body mix blocks by noise.")
private IrisMaterialPalette blockPalette = null;
private PaletteSpec blockPalette;
@Desc("Optional caprock block placed on the top crown of the formation (and the wide overhanging cap for HOODOO). Ignored when capPalette is set. When null and capPalette is unset, the formation uses its main rock everywhere.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String capBlock = null;
@Desc("A noise-driven palette for the caprock. When set this overrides the single capBlock.")
private IrisMaterialPalette capPalette = null;
private PaletteSpec capPalette;
@Desc("Optional palette of strata (horizontal colored bands) blended into the rock body by y level. When set, every strataThickness blocks of height switches to the next strata block, producing the signature banded look. Falls back to the main block where unset.")
private IrisMaterialPalette strataPalette = null;
private PaletteSpec strataPalette;
@MinNumber(1)
@MaxNumber(32)
@@ -150,7 +135,7 @@ public class IrisFormation implements IrisProceduralPlacement {
private int topWidth = 0;
@Desc("The function used to shape the formation radius over its height.")
private IrisFormationProfile profile = IrisFormationProfile.TAPER;
private FormationProfile profile = FormationProfile.TAPER;
@MinNumber(0)
@MaxNumber(1)
@@ -255,50 +240,208 @@ public class IrisFormation implements IrisProceduralPlacement {
@Desc("How many blocks the tip of an OVERHANG curls downward.")
private int overhangDrop = 3;
public KList<IrisObject> getVariantObjects(IrisData data) {
return variantCache.aquire(() -> {
KList<IrisObject> baked = new KList<>();
int count = Math.max(1, variants);
for (int i = 0; i < count; i++) {
IrisObject object = FormationGenerator.generate(this, i, new RNG(seed + (i * 7919L)), data);
if (object == null || object.getBlocks().isEmpty()) {
continue;
}
object.setLoadKey("procedural/" + name + "#" + i);
object.setLoader(data);
baked.add(object);
}
return baked;
});
public Formation() {
}
public IrisObject getVariantObject(IrisData data, RNG rng) {
KList<IrisObject> baked = getVariantObjects(data);
if (baked == null || baked.isEmpty()) {
return null;
}
return baked.get(rng.i(baked.size()));
public String name() {
return name;
}
public IrisObjectPlacement asPlacement() {
IrisObjectPlacement placement = new IrisObjectPlacement();
placement.setMode(mode);
placement.setRotation(rotation);
placement.setClamp(clamp);
placement.setCarvingSupport(carvingSupport);
placement.setSurfaceSupportBuffer(surfaceSupportBuffer);
placement.setUnderwater(underwater);
placement.setTranslate(translate);
placement.setStiltSettings(stiltSettings);
placement.setVacuumSettings(vacuumSettings);
placement.setChance(chance);
placement.setDensity(density);
return placement;
public double chance() {
return chance;
}
public boolean isPlausible() {
return false;
public int density() {
return density;
}
public int variants() {
return variants;
}
public long seed() {
return seed;
}
public ObjectPlaceMode mode() {
return mode == null ? ObjectPlaceMode.CENTER_HEIGHT : mode;
}
public ObjectRotation rotation() {
return rotation;
}
public ObjectLimit clamp() {
return clamp;
}
public CarvingMode carvingSupport() {
return carvingSupport == null ? CarvingMode.SURFACE_ONLY : carvingSupport;
}
public int surfaceSupportBuffer() {
return surfaceSupportBuffer;
}
public boolean underwater() {
return underwater;
}
public ObjectTranslate translate() {
return translate;
}
/** Empty where the pack sets none. */
public Optional<StiltSettings> stiltSettings() {
return Optional.ofNullable(stiltSettings);
}
/** Empty where the pack sets none. */
public Optional<VacuumSettings> vacuumSettings() {
return Optional.ofNullable(vacuumSettings);
}
public FormationForm form() {
return form == null ? FormationForm.SPIRE : form;
}
public String block() {
return block;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> blockPalette() {
return Optional.ofNullable(blockPalette);
}
/** Empty where the pack sets none. */
public Optional<String> capBlock() {
return Optional.ofNullable(capBlock);
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> capPalette() {
return Optional.ofNullable(capPalette);
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> strataPalette() {
return Optional.ofNullable(strataPalette);
}
public int strataThickness() {
return strataThickness;
}
public int heightMin() {
return heightMin;
}
public int heightMax() {
return heightMax;
}
public int baseWidthMin() {
return baseWidthMin;
}
public int baseWidthMax() {
return baseWidthMax;
}
public int topWidth() {
return topWidth;
}
public FormationProfile profile() {
return profile == null ? FormationProfile.TAPER : profile;
}
public double profileWaist() {
return profileWaist;
}
public double profileWaistFloor() {
return profileWaistFloor;
}
public double lean() {
return lean;
}
public double leanAzimuth() {
return leanAzimuth;
}
public double roughness() {
return roughness;
}
public double jitter() {
return jitter;
}
public int hoodooCapRadius() {
return hoodooCapRadius;
}
public int hoodooCapHeight() {
return hoodooCapHeight;
}
public int archSpan() {
return archSpan;
}
public int archThickness() {
return archThickness;
}
public double archAsymmetry() {
return archAsymmetry;
}
public int basaltColumns() {
return basaltColumns;
}
public int basaltColumnRadius() {
return basaltColumnRadius;
}
public double basaltHeightVariance() {
return basaltHeightVariance;
}
public int icebergPeaks() {
return icebergPeaks;
}
public int fractureCount() {
return fractureCount;
}
public int fractureSeparation() {
return fractureSeparation;
}
public double spiralTurns() {
return spiralTurns;
}
public int spiralRadius() {
return spiralRadius;
}
public int spiralThickness() {
return spiralThickness;
}
public int overhangReach() {
return overhangReach;
}
public int overhangDrop() {
return overhangDrop;
}
}
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.formation;
package art.arcane.iris.builtin.objects.formation;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("The overall silhouette of a procedural natural formation. Each form drives a distinct sculpting routine in the formation generator.")
public enum IrisFormationForm {
public enum FormationForm {
@Desc("A tall, slender needle of rock that tapers smoothly to a point at the top (a sharp pinnacle or stone spire).")
SPIRE,
@Desc("A column with a pinched, eroded waist and a wide overhanging caprock balanced on top (the classic desert hoodoo / mushroom rock).")
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.formation;
package art.arcane.iris.builtin.objects.formation;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("A width-shaping function evaluated over normalized height (0 at the base, 1 at the top). Controls how the formation radius scales between baseWidth at the bottom and topWidth at the top.")
public enum IrisFormationProfile {
public enum FormationProfile {
@Desc("Same radius at every height (a straight cylinder of constant baseWidth).")
CONSTANT,
@Desc("Radius ramps straight from baseWidth at the bottom to topWidth at the top.")
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,44 +16,29 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.fungi;
package art.arcane.iris.builtin.objects.fungi;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.placement.IrisObjectLimit;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.IrisStiltSettings;
import art.arcane.iris.engine.object.placement.IrisVacuumSettings;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
import art.arcane.iris.engine.object.procedural.IrisProceduralPlacement;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.iris.engine.object.procedural.fungi.FungusGenerator;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.prepare.ObjectTranslate;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.validate.ObjectLimit;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Required;
import java.util.Optional;
@Snippet("fungus")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A single procedurally generated fungus (giant mushroom or shelf fungus). Iris bakes a pool of deterministic variants from these settings and scatters them at world-gen time, exactly like an object placement but generated from scratch instead of loaded from an iob file. The fungus is built as a stem column with a cap dome grown on top, mirroring the trunk-and-canopy model used by procedural trees.")
@Data
public class IrisFungus implements IrisProceduralPlacement {
private final transient AtomicCache<KList<IrisObject>> variantCache = new AtomicCache<>();
public final class Fungus {
@Desc("A human readable name used in logs and as the variant load key.")
private String name = "fungus";
@@ -78,10 +63,10 @@ public class IrisFungus implements IrisProceduralPlacement {
private ObjectPlaceMode mode = ObjectPlaceMode.CENTER_HEIGHT;
@Desc("Rotate this fungus's placement.")
private IrisObjectRotation rotation = new IrisObjectRotation();
private ObjectRotation rotation = new ObjectRotation();
@Desc("Limit the max or min height of placement.")
private IrisObjectLimit clamp = new IrisObjectLimit();
private ObjectLimit clamp = new ObjectLimit();
@Desc("Whether this fungus may place on the terrain surface, under carvings, or both.")
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
@@ -90,29 +75,29 @@ public class IrisFungus implements IrisProceduralPlacement {
private boolean underwater = false;
@Desc("Translate (offset) this placement along each axis; for example set a negative y to sink it into the ground.")
private IrisObjectTranslate translate = new IrisObjectTranslate();
private ObjectTranslate translate = new ObjectTranslate();
@Desc("Settings for the stilt place modes (STILT, MIN_STILT, FAST_STILT, CENTER_STILT, ERODE_STILT, ORGANIC_STILT).")
private IrisStiltSettings stiltSettings;
private StiltSettings stiltSettings;
@Desc("Settings for the vacuum place modes (VACUUM, VACUUM_HIGH, VACUUM_FAST, VACUUM_ORGANIC).")
private IrisVacuumSettings vacuumSettings;
private VacuumSettings vacuumSettings;
@Required
@Desc("The stem block, e.g. minecraft:mushroom_stem. Ignored when stemPalette is set.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String stem = "minecraft:mushroom_stem";
@Desc("A noise-driven palette for the stem. When set this overrides the single stem block, letting the stem mix blocks by noise.")
private IrisMaterialPalette stemPalette = null;
private PaletteSpec stemPalette;
@Required
@Desc("The cap block, e.g. minecraft:red_mushroom_block. Ignored when capPalette is set.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String cap = "minecraft:red_mushroom_block";
@Desc("A noise-driven palette for the cap. When set this overrides the single cap block, letting the cap mix blocks by noise.")
private IrisMaterialPalette capPalette = null;
private PaletteSpec capPalette;
@MinNumber(1)
@Desc("Minimum total stem height in blocks. Variants spread between this and stemHeightMax.")
@@ -142,7 +127,7 @@ public class IrisFungus implements IrisProceduralPlacement {
private double stemWavePeriods = 1;
@Desc("The silhouette of the cap (dome, flat umbrella, funnel, cone, or wide shallow slab).")
private IrisFungusCapShape capShape = IrisFungusCapShape.DOME;
private FungusCapShape capShape = FungusCapShape.DOME;
@MinNumber(1)
@Desc("Minimum cap radius in blocks (measured from the cap center to its rim).")
@@ -171,11 +156,11 @@ public class IrisFungus implements IrisProceduralPlacement {
private double capOverhang = 2;
@Desc("Optional block forming the gill layer on the underside of the cap (gills or a glow layer), e.g. minecraft:brown_mushroom_block or minecraft:shroomlight. Ignored when gillPalette is set or left null.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String gillBlock = null;
@Desc("A noise-driven palette for the underside gill layer. When set this overrides the single gillBlock.")
private IrisMaterialPalette gillPalette = null;
private PaletteSpec gillPalette;
@MinNumber(0)
@MaxNumber(1)
@@ -183,11 +168,11 @@ public class IrisFungus implements IrisProceduralPlacement {
private double gillChance = 0.85;
@Desc("Optional block speckled across the top of the cap by noise (white toadstool dots, warts, glowing spots), e.g. minecraft:bone_block or minecraft:white_concrete. Ignored when spotPalette is set or left null.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String spotBlock = null;
@Desc("A noise-driven palette for the cap top spots. When set this overrides the single spotBlock.")
private IrisMaterialPalette spotPalette = null;
private PaletteSpec spotPalette;
@MinNumber(0)
@MaxNumber(1)
@@ -201,62 +186,170 @@ public class IrisFungus implements IrisProceduralPlacement {
@Desc("The radius in blocks of the sideways fan when shelf is true.")
private int shelfRadius = 3;
public KList<IrisObject> getVariantObjects(IrisData data) {
return variantCache.aquire(() -> {
KList<IrisObject> baked = new KList<>();
int count = Math.max(1, variants);
int lo = Math.min(stemHeightMin, stemHeightMax);
int hi = Math.max(stemHeightMin, stemHeightMax);
RNG heightRng = new RNG(seed);
for (int i = 0; i < count; i++) {
int height;
if (count == 1 || lo == hi) {
height = heightRng.i(lo, hi + 1);
} else {
double step = (hi - lo) / (double) (count - 1);
double base = lo + step * i;
double jitter = heightRng.d(-step * 0.3, step * 0.3);
height = (int) Math.round(Math.max(lo, Math.min(hi, base + jitter)));
}
IrisObject object = FungusGenerator.generate(this, Math.max(1, height), new RNG(seed + (i * 7919L)), data);
if (object == null || object.getBlocks().isEmpty()) {
continue;
}
object.setLoadKey("procedural/" + name + "#" + i);
object.setLoader(data);
baked.add(object);
}
return baked;
});
public Fungus() {
}
public IrisObject getVariantObject(IrisData data, RNG rng) {
KList<IrisObject> baked = getVariantObjects(data);
if (baked == null || baked.isEmpty()) {
return null;
}
return baked.get(rng.i(baked.size()));
public String name() {
return name;
}
public IrisObjectPlacement asPlacement() {
IrisObjectPlacement placement = new IrisObjectPlacement();
placement.setMode(mode);
placement.setRotation(rotation);
placement.setClamp(clamp);
placement.setCarvingSupport(carvingSupport);
placement.setUnderwater(underwater);
placement.setTranslate(translate);
placement.setStiltSettings(stiltSettings);
placement.setVacuumSettings(vacuumSettings);
placement.setChance(chance);
placement.setDensity(density);
return placement;
public double chance() {
return chance;
}
public boolean isPlausible() {
return false;
public int density() {
return density;
}
public int variants() {
return variants;
}
public long seed() {
return seed;
}
public ObjectPlaceMode mode() {
return mode == null ? ObjectPlaceMode.CENTER_HEIGHT : mode;
}
public ObjectRotation rotation() {
return rotation;
}
public ObjectLimit clamp() {
return clamp;
}
public CarvingMode carvingSupport() {
return carvingSupport == null ? CarvingMode.SURFACE_ONLY : carvingSupport;
}
public boolean underwater() {
return underwater;
}
public ObjectTranslate translate() {
return translate;
}
/** Empty where the pack sets none. */
public Optional<StiltSettings> stiltSettings() {
return Optional.ofNullable(stiltSettings);
}
/** Empty where the pack sets none. */
public Optional<VacuumSettings> vacuumSettings() {
return Optional.ofNullable(vacuumSettings);
}
public String stem() {
return stem;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> stemPalette() {
return Optional.ofNullable(stemPalette);
}
public String cap() {
return cap;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> capPalette() {
return Optional.ofNullable(capPalette);
}
public int stemHeightMin() {
return stemHeightMin;
}
public int stemHeightMax() {
return stemHeightMax;
}
public int stemWidth() {
return stemWidth;
}
public double stemCurve() {
return stemCurve;
}
public double stemLeanAzimuth() {
return stemLeanAzimuth;
}
public double stemWaveAmplitude() {
return stemWaveAmplitude;
}
public double stemWavePeriods() {
return stemWavePeriods;
}
public FungusCapShape capShape() {
return capShape == null ? FungusCapShape.DOME : capShape;
}
public int capRadiusMin() {
return capRadiusMin;
}
public int capRadiusMax() {
return capRadiusMax;
}
public int capThickness() {
return capThickness;
}
public double capSquish() {
return capSquish;
}
public double capDroop() {
return capDroop;
}
public double capOverhang() {
return capOverhang;
}
/** Empty where the pack sets none. */
public Optional<String> gillBlock() {
return Optional.ofNullable(gillBlock);
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> gillPalette() {
return Optional.ofNullable(gillPalette);
}
public double gillChance() {
return gillChance;
}
/** Empty where the pack sets none. */
public Optional<String> spotBlock() {
return Optional.ofNullable(spotBlock);
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> spotPalette() {
return Optional.ofNullable(spotPalette);
}
public double spotChance() {
return spotChance;
}
public boolean shelf() {
return shelf;
}
public int shelfRadius() {
return shelfRadius;
}
}
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.fungi;
package art.arcane.iris.builtin.objects.fungi;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("The silhouette of the mushroom cap. Each shape drives how the cap radius and thickness vary from its apex down to the rim, giving the fungus a distinct profile.")
public enum IrisFungusCapShape {
public enum FungusCapShape {
@Desc("A rounded hemisphere cap that bulges up and curls slightly under at the rim, the classic red toadstool dome.")
DOME,
@Desc("A wide, nearly flat umbrella that holds its full radius almost to the edge before dropping, the brown-mushroom plate look.")
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,46 +16,32 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.ruin;
package art.arcane.iris.builtin.objects.ruin;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.placement.IrisObjectLimit;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.IrisStiltSettings;
import art.arcane.iris.engine.object.placement.IrisVacuumSettings;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.engine.object.procedural.IrisProceduralPlacement;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.annotations.ArrayType;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.iris.engine.object.procedural.ruin.RuinGenerator;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.prepare.ObjectTranslate;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.validate.ObjectLimit;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinItems;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Required;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@Snippet("ruin")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A single procedurally generated ruin: a crumbling man-made structure (pillar, wall, arch, foundation slab, or rubble pile). Iris bakes a pool of deterministic variants from these settings and scatters them at world-gen time, exactly like an object placement but generated from scratch instead of loaded from an iob file. Weathering swaps blocks for mossy or cracked variants by noise, erosion deletes blocks so the shape reads as collapsed, and a buried fraction sinks the ruin into the terrain.")
@Data
public class IrisRuin implements IrisProceduralPlacement {
private final transient AtomicCache<KList<IrisObject>> variantCache = new AtomicCache<>();
public final class Ruin {
@Desc("A human readable name used in logs and as the variant load key (procedural/<name>#<index>).")
private String name = "ruin";
@@ -80,10 +66,10 @@ public class IrisRuin implements IrisProceduralPlacement {
private ObjectPlaceMode mode = ObjectPlaceMode.MIN_HEIGHT;
@Desc("Rotate this ruin's placement so variants do not all face the same way.")
private IrisObjectRotation rotation = new IrisObjectRotation();
private ObjectRotation rotation = new ObjectRotation();
@Desc("Limit the max or min terrain height at which this ruin may place.")
private IrisObjectLimit clamp = new IrisObjectLimit();
private ObjectLimit clamp = new ObjectLimit();
@Desc("Whether this ruin may place on the terrain surface, under carvings (caves), or both. SURFACE_ONLY keeps ruins above ground.")
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
@@ -92,24 +78,24 @@ public class IrisRuin implements IrisProceduralPlacement {
private boolean underwater = false;
@Desc("Translate (offset) this placement along each axis; for example set a negative y to sink it into the ground.")
private IrisObjectTranslate translate = new IrisObjectTranslate();
private ObjectTranslate translate = new ObjectTranslate();
@Desc("Settings for the stilt place modes (STILT, MIN_STILT, FAST_STILT, CENTER_STILT, ERODE_STILT, ORGANIC_STILT).")
private IrisStiltSettings stiltSettings;
private StiltSettings stiltSettings;
@Desc("Settings for the vacuum place modes (VACUUM, VACUUM_HIGH, VACUUM_FAST, VACUUM_ORGANIC).")
private IrisVacuumSettings vacuumSettings;
private VacuumSettings vacuumSettings;
@Required
@Desc("The primary structural block, e.g. minecraft:cobblestone or minecraft:stone_bricks. Ignored when blockPalette is set. This is the bulk material of the ruin before weathering swaps some of it out.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String block = "minecraft:cobblestone";
@Desc("A noise-driven palette for the primary block. When set this overrides the single block, letting the structure mix materials by noise. Palette wins over the block string via IrisProceduralBlocks.resolve.")
private IrisMaterialPalette blockPalette = null;
private PaletteSpec blockPalette;
@Desc("The overall silhouette of the ruin: PILLAR (broken column), WALL (gapped segment), ARCH (two legs plus a curved span), FLOOR_SLAB (foundation patch), or RUBBLE (low scattered pile).")
private IrisRuinForm form = IrisRuinForm.PILLAR;
private RuinForm form = RuinForm.PILLAR;
@MinNumber(1)
@Desc("Minimum structure height in blocks (PILLAR/WALL/ARCH height, slab thickness for FLOOR_SLAB, mound height for RUBBLE). Variants interpolate between this and heightMax.")
@@ -136,10 +122,10 @@ public class IrisRuin implements IrisProceduralPlacement {
private int lengthMax = 7;
@Desc("A palette of weathered variants (mossy/cracked block ids) blended over the structure by noise. When set this drives weathering; otherwise weatheredBlock is used.")
private IrisMaterialPalette weatheringPalette = null;
private PaletteSpec weatheringPalette;
@Desc("A single weathered block id used when weatheringPalette is not set, e.g. minecraft:mossy_cobblestone. Applied to a noise-selected fraction of the structure, biased toward the lower rows.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String weatheredBlock = "minecraft:mossy_cobblestone";
@MinNumber(0)
@@ -167,53 +153,134 @@ public class IrisRuin implements IrisProceduralPlacement {
@Desc("How far the structure extends below the surface as a fraction of its height (0 sits fully on top, 1 sinks it a full height into the ground). The buried rows live at negative y so the ruin reads as settled and partly swallowed by the terrain.")
private double buriedFraction = 0.2;
@ArrayType(min = 1, type = IrisRuinDecorator.class)
@MinItems(1)
@Desc("Accent decorators applied after the ruin is built and eroded (moss carpets and lanterns on broken tops, vines and lichen on the faces, rubble and growth scattered around the base).")
private KList<IrisRuinDecorator> accents = new KList<>();
private List<RuinDecorator> accents = List.of();
public KList<IrisObject> getVariantObjects(IrisData data) {
return variantCache.aquire(() -> {
KList<IrisObject> baked = new KList<>();
int count = Math.max(1, variants);
for (int i = 0; i < count; i++) {
IrisObject object = RuinGenerator.generate(this, i, new RNG(seed + (i * 7919L)), data);
if (object == null || object.getBlocks().isEmpty()) {
continue;
}
object.setLoadKey("procedural/" + name + "#" + i);
object.setLoader(data);
baked.add(object);
}
return baked;
});
public Ruin() {
}
public IrisObject getVariantObject(IrisData data, RNG rng) {
KList<IrisObject> baked = getVariantObjects(data);
if (baked == null || baked.isEmpty()) {
return null;
}
return baked.get(rng.i(baked.size()));
public String name() {
return name;
}
public IrisObjectPlacement asPlacement() {
IrisObjectPlacement placement = new IrisObjectPlacement();
placement.setMode(mode);
placement.setRotation(rotation);
placement.setClamp(clamp);
placement.setCarvingSupport(carvingSupport);
placement.setUnderwater(underwater);
placement.setTranslate(translate);
placement.setStiltSettings(stiltSettings);
placement.setVacuumSettings(vacuumSettings);
placement.setChance(chance);
placement.setDensity(density);
return placement;
public double chance() {
return chance;
}
public boolean isPlausible() {
return false;
public int density() {
return density;
}
public int variants() {
return variants;
}
public long seed() {
return seed;
}
public ObjectPlaceMode mode() {
return mode == null ? ObjectPlaceMode.MIN_HEIGHT : mode;
}
public ObjectRotation rotation() {
return rotation;
}
public ObjectLimit clamp() {
return clamp;
}
public CarvingMode carvingSupport() {
return carvingSupport == null ? CarvingMode.SURFACE_ONLY : carvingSupport;
}
public boolean underwater() {
return underwater;
}
public ObjectTranslate translate() {
return translate;
}
/** Empty where the pack sets none. */
public Optional<StiltSettings> stiltSettings() {
return Optional.ofNullable(stiltSettings);
}
/** Empty where the pack sets none. */
public Optional<VacuumSettings> vacuumSettings() {
return Optional.ofNullable(vacuumSettings);
}
public String block() {
return block;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> blockPalette() {
return Optional.ofNullable(blockPalette);
}
public RuinForm form() {
return form == null ? RuinForm.PILLAR : form;
}
public int heightMin() {
return heightMin;
}
public int heightMax() {
return heightMax;
}
public int widthMin() {
return widthMin;
}
public int widthMax() {
return widthMax;
}
public int lengthMin() {
return lengthMin;
}
public int lengthMax() {
return lengthMax;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> weatheringPalette() {
return Optional.ofNullable(weatheringPalette);
}
public String weatheredBlock() {
return weatheredBlock;
}
public double mossiness() {
return mossiness;
}
public double weatheringScale() {
return weatheringScale;
}
public double erosion() {
return erosion;
}
public double erosionScale() {
return erosionScale;
}
public double buriedFraction() {
return buriedFraction;
}
public List<RuinDecorator> accents() {
return accents == null ? List.of() : Collections.unmodifiableList(accents);
}
}
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,38 +16,32 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.ruin;
package art.arcane.iris.builtin.objects.ruin;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Required;
import java.util.Optional;
@Snippet("ruin-decorator")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("An accent block applied to a generated ruin after it is built and eroded, such as moss carpets on broken tops, vines on the faces, or rubble scattered around the base.")
@Data
public class IrisRuinDecorator {
public final class RuinDecorator {
@Desc("Where on the ruin this accent is placed. TOP sits on the highest block of each column, SURFACE clings to air-facing vertical faces, BASE_SCATTER rings the ground footprint around the base.")
private IrisRuinDecoratorTarget target = IrisRuinDecoratorTarget.TOP;
private RuinDecoratorTarget target = RuinDecoratorTarget.TOP;
@Required
@Desc("The block id to place, e.g. minecraft:moss_carpet or minecraft:vine. Ignored when palette is set.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String block = "";
@Desc("A noise-driven palette for this decorator. When set this overrides the single block, letting the accent mix blocks by noise. Resolved through IrisProceduralBlocks.resolve so the palette wins over the string.")
private IrisMaterialPalette palette = null;
private PaletteSpec palette;
@MinNumber(0)
@MaxNumber(1)
@@ -57,4 +51,28 @@ public class IrisRuinDecorator {
@MinNumber(1)
@Desc("For the BASE_SCATTER target, how many blocks beyond the ruin footprint the scatter ring extends outward in each direction. Higher values fling rubble and growth further from the structure.")
private int scatterRadius = 2;
public RuinDecorator() {
}
public RuinDecoratorTarget target() {
return target == null ? RuinDecoratorTarget.TOP : target;
}
public String block() {
return block;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> palette() {
return Optional.ofNullable(palette);
}
public double chance() {
return chance;
}
public int scatterRadius() {
return scatterRadius;
}
}
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.ruin;
package art.arcane.iris.builtin.objects.ruin;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Where a ruin accent block is placed after the ruin has been built and eroded.")
public enum IrisRuinDecoratorTarget {
public enum RuinDecoratorTarget {
@Desc("On top of the highest surviving block in each column (moss carpets, snow, sculk, lanterns on broken tops).")
TOP,
@Desc("On air-facing vertical sides of any surviving block (vines, glow lichen, climbing growth on the ruin faces).")
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.ruin;
package art.arcane.iris.builtin.objects.ruin;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("The overall silhouette of a procedural ruin. Each form rasterizes a different crumbling man-made shape from the same size, weathering, and erosion settings.")
public enum IrisRuinForm {
public enum RuinForm {
@Desc("A broken vertical column. A square trunk (widthMin..widthMax footprint) rises to a randomized height then snaps off with a jagged crown, leaving a toppled stub. Use for ancient pillars and obelisk stumps.")
PILLAR,
@Desc("A standing wall segment. A flat slab spanning lengthMin..lengthMax long and heightMin..heightMax tall, thickness widthMin..widthMax, punched through with noise-driven gaps and a ragged top edge. Use for collapsed building sides and fortifications.")
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Controls the compass direction (azimuth) of trunk lean as it rises, or the direction each branch is thrown.")
public enum IrisTreeAzimuthMode {
public enum TreeAzimuthMode {
@Desc("A single fixed azimuth.")
CONSTANT,
@Desc("Azimuth ramps straight from start to end with height.")
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Controls how the chance of spawning a branch varies with trunk height (0 at the base, 1 at the top).")
public enum IrisTreeBranchProbability {
public enum TreeBranchProbability {
@Desc("Same branch chance at every height.")
CONSTANT,
@Desc("Ramps straight from base chance to crown chance.")
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,26 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import java.util.Optional;
@Snippet("tree-branches")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A branch system that throws limbs out of the trunk and places a leaf ball at each tip. When present, branches drive the canopy and only the topmost crown disc of the profile is still placed.")
@Data
public class IrisTreeBranches {
public final class TreeBranches {
@Desc("How branch spawn chance varies over trunk height.")
private IrisTreeBranchProbability probabilityFunction = IrisTreeBranchProbability.TOP_HEAVY;
private TreeBranchProbability probabilityFunction = TreeBranchProbability.TOP_HEAVY;
@MinNumber(0)
@Desc("Branch chance for the CONSTANT probability function.")
@@ -72,7 +66,7 @@ public class IrisTreeBranches {
private double probabilityPeriods = 5;
@Desc("How branch length varies over trunk height.")
private IrisTreeFunction lengthFunction = IrisTreeFunction.LINEAR;
private TreeFunction lengthFunction = TreeFunction.LINEAR;
@MinNumber(0)
@Desc("Branch length at the base for the LINEAR length function.")
@@ -94,7 +88,7 @@ public class IrisTreeBranches {
private double lengthSteepness = 5;
@Desc("How the compass direction of each branch is chosen.")
private IrisTreeAzimuthMode azimuthMode = IrisTreeAzimuthMode.RANDOM;
private TreeAzimuthMode azimuthMode = TreeAzimuthMode.RANDOM;
@Desc("Fixed azimuth in degrees when azimuthMode is CONSTANT.")
private double azimuth = 0;
@@ -120,12 +114,124 @@ public class IrisTreeBranches {
private int clusterRadius = 2;
@Desc("How the branch tip leaf cluster fills.")
private IrisTreeLeafMode clusterMode = IrisTreeLeafMode.TRIMMED;
private TreeLeafMode clusterMode = TreeLeafMode.TRIMMED;
@MinNumber(0)
@Desc("Fill density for the branch tip leaf cluster when clusterMode is density or noise.")
private double clusterDensity = 0.85;
@Desc("Optional one level of recursive sub-branches sprouting from each branch tip.")
private IrisTreeSubBranches subBranches = null;
private TreeSubBranches subBranches = null;
public TreeBranches() {
}
public TreeBranchProbability probabilityFunction() {
return probabilityFunction == null ? TreeBranchProbability.TOP_HEAVY : probabilityFunction;
}
public double probabilityConstant() {
return probabilityConstant;
}
public double probabilityBase() {
return probabilityBase;
}
public double probabilityCrown() {
return probabilityCrown;
}
public double probabilitySteepness() {
return probabilitySteepness;
}
public double probabilityMidpoint() {
return probabilityMidpoint;
}
public double probabilityExponent() {
return probabilityExponent;
}
public double probabilityMean() {
return probabilityMean;
}
public double probabilityStd() {
return probabilityStd;
}
public double probabilityScale() {
return probabilityScale;
}
public double probabilityPeriods() {
return probabilityPeriods;
}
public TreeFunction lengthFunction() {
return lengthFunction == null ? TreeFunction.LINEAR : lengthFunction;
}
public double lengthBase() {
return lengthBase;
}
public double lengthCrown() {
return lengthCrown;
}
public double lengthConstant() {
return lengthConstant;
}
public double lengthMax() {
return lengthMax;
}
public double lengthSteepness() {
return lengthSteepness;
}
public TreeAzimuthMode azimuthMode() {
return azimuthMode == null ? TreeAzimuthMode.RANDOM : azimuthMode;
}
public double azimuth() {
return azimuth;
}
public double elevation() {
return elevation;
}
public double sag() {
return sag;
}
public int branchDepth() {
return branchDepth;
}
public boolean leafStartUp() {
return leafStartUp;
}
public int clusterRadius() {
return clusterRadius;
}
public TreeLeafMode clusterMode() {
return clusterMode == null ? TreeLeafMode.TRIMMED : clusterMode;
}
public double clusterDensity() {
return clusterDensity;
}
/** Empty where the pack sets none. */
public Optional<TreeSubBranches> subBranches() {
return Optional.ofNullable(subBranches);
}
}
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,26 +16,21 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.ArrayType;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.volmlib.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinItems;
import com.volmit.config.MinNumber;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@Snippet("tree-canopy")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("The leaf crown of a procedural tree. Built from stacked dome-shaped discs (driven by the profile or by explicit layers) and optionally a branch system.")
@Data
public class IrisTreeCanopy {
public final class TreeCanopy {
@MinNumber(0)
@MaxNumber(180)
@Desc("Elevation angle in degrees from vertical for each leaf dome. 90 is a flat disc, below 90 domes downward into a sphere, above 90 flares outward into an umbrella.")
@@ -47,7 +42,7 @@ public class IrisTreeCanopy {
private double squish = 1;
@Desc("How leaves fill each canopy disc.")
private IrisTreeLeafMode mode = IrisTreeLeafMode.TRIMMED;
private TreeLeafMode mode = TreeLeafMode.TRIMMED;
@MinNumber(0)
@MaxNumber(1)
@@ -62,10 +57,46 @@ public class IrisTreeCanopy {
@Desc("Horizontal Z stretch of the crown for elliptical or wind-blown shapes. 1 is circular.")
private double crownStretchZ = 1;
@ArrayType(min = 1, type = IrisTreeLayer.class)
@MinItems(1)
@Desc("Optional explicit crown discs. When provided these replace the profile-driven layers and let you sculpt the silhouette by hand.")
private KList<IrisTreeLayer> layers = new KList<>();
private List<TreeLayer> layers = List.of();
@Desc("Optional branch system. When present, branches build most of the canopy and only the topmost profile disc is still placed as a crown.")
private IrisTreeBranches branches = null;
private TreeBranches branches = null;
public TreeCanopy() {
}
public double startAngle() {
return startAngle;
}
public double squish() {
return squish;
}
public TreeLeafMode mode() {
return mode == null ? TreeLeafMode.TRIMMED : mode;
}
public double leafDensity() {
return leafDensity;
}
public double crownStretchX() {
return crownStretchX;
}
public double crownStretchZ() {
return crownStretchZ;
}
public List<TreeLayer> layers() {
return layers == null ? List.of() : Collections.unmodifiableList(layers);
}
/** Empty where the pack sets none. */
public Optional<TreeBranches> branches() {
return Optional.ofNullable(branches);
}
}
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,37 +16,32 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Required;
import java.util.Optional;
@Snippet("tree-decorator")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("An accent block applied to a generated tree such as fruit on branch tips, vines on the trunk, snow on the crown, or a glowing underside.")
@Data
public class IrisTreeDecorator {
public final class TreeDecorator {
@Desc("Where this decorator is placed on the tree.")
private IrisTreeDecoratorTarget target = IrisTreeDecoratorTarget.BRANCH_TIP;
private TreeDecoratorTarget target = TreeDecoratorTarget.BRANCH_TIP;
@Required
@Desc("The block id to place, e.g. minecraft:magma_block. Ignored when palette is set.")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String block = "";
@Desc("A noise-driven palette for this decorator. When set this overrides the single block.")
private IrisMaterialPalette palette = null;
private PaletteSpec palette;
@MinNumber(0)
@MaxNumber(1)
@@ -59,4 +54,32 @@ public class IrisTreeDecorator {
@Desc("If true the block's facing is oriented away from the trunk (for trunk-mounted fences/gates/banners).")
private boolean axisAware = false;
public TreeDecorator() {
}
public TreeDecoratorTarget target() {
return target == null ? TreeDecoratorTarget.BRANCH_TIP : target;
}
public String block() {
return block;
}
/** Empty where the pack sets none. */
public Optional<PaletteSpec> palette() {
return Optional.ofNullable(palette);
}
public double chance() {
return chance;
}
public int length() {
return length;
}
public boolean axisAware() {
return axisAware;
}
}
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Where a tree decorator block is placed.")
public enum IrisTreeDecoratorTarget {
public enum TreeDecoratorTarget {
@Desc("At the tip of each generated branch (vines, fruit, lanterns).")
BRANCH_TIP,
@Desc("On air-facing sides of trunk and branch blocks (vines, moss).")
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("A shaping function evaluated over normalized height (0 at the base, 1 at the top). Used for trunk width, trunk curve and branch length.")
public enum IrisTreeFunction {
public enum TreeFunction {
@Desc("Same value at every height.")
CONSTANT,
@Desc("Ramps straight from start to end.")
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,27 +16,30 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MinNumber;
@Snippet("tree-layer")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("An explicit canopy disc at a given vertical offset and radius. Define a list of these to bypass the profile and sculpt the crown by hand.")
@Data
public class IrisTreeLayer {
public final class TreeLayer {
@Desc("The vertical offset of this disc, measured in blocks above the trunk base.")
private int yOffset = 0;
@MinNumber(0.5)
@Desc("The radius of this leaf disc in blocks.")
private double radius = 2;
public TreeLayer() {
}
public int yOffset() {
return yOffset;
}
public double radius() {
return radius;
}
}
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("How leaves fill a disc or cluster.")
public enum IrisTreeLeafMode {
public enum TreeLeafMode {
@Desc("Corner-trimmed disc/sphere for a rounded silhouette.")
TRIMMED,
@Desc("Completely filled disc/sphere.")
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("Named canopy presets that drive default layer radii and shape, scaled to the tree height.")
public enum IrisTreeProfile {
public enum TreeProfile {
@Desc("Rounded broadleaf crown.")
OAK,
@Desc("Slim upright broadleaf crown.")
@@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import com.volmit.config.Desc;
@Desc("How a procedural tree's root system is built below (and around) the trunk base.")
public enum IrisTreeRootStyle {
public enum TreeRootStyle {
@Desc("A single tapering taproot straight down from the base.")
TAPROOT,
@Desc("A taproot plus a ring of flared buttress legs that splay outward as they descend (default).")
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,31 +16,35 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MinNumber;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import com.volmit.config.Required;
@Snippet("tree-secondary-leaf")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A weighted accent leaf or foliage block scattered through the canopy (blossoms, shroomlight, berries).")
@Data
public class IrisTreeSecondaryLeaf {
public final class TreeSecondaryLeaf {
@Required
@Desc("The block id to scatter, e.g. minecraft:shroomlight")
@RegistryListBlockType
@Ref(Reference.BLOCK)
private String block = "";
@MinNumber(0)
@Desc("The relative weight of this block among the secondary leaves.")
private int weight = 1;
public TreeSecondaryLeaf() {
}
public String block() {
return block;
}
public int weight() {
return weight;
}
}
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,24 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.tree;
package art.arcane.iris.builtin.objects.tree;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
@Snippet("tree-sub-branches")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("One recursive level of sub-branches sprouting from each primary branch tip.")
@Data
public class IrisTreeSubBranches {
public final class TreeSubBranches {
@MinNumber(1)
@Desc("How many sub-branches sprout from each primary branch tip.")
private int count = 1;
@@ -58,9 +50,44 @@ public class IrisTreeSubBranches {
private int clusterRadius = 1;
@Desc("How the sub-branch tip leaf cluster fills.")
private IrisTreeLeafMode clusterMode = IrisTreeLeafMode.TRIMMED;
private TreeLeafMode clusterMode = TreeLeafMode.TRIMMED;
@MinNumber(0)
@Desc("Fill density for the sub-branch leaf cluster when clusterMode is density or noise.")
private double clusterDensity = 0.85;
public TreeSubBranches() {
}
public int count() {
return count;
}
public double pitchDelta() {
return pitchDelta;
}
public double yawDelta() {
return yawDelta;
}
public double lengthScale() {
return lengthScale;
}
public double sag() {
return sag;
}
public int clusterRadius() {
return clusterRadius;
}
public TreeLeafMode clusterMode() {
return clusterMode == null ? TreeLeafMode.TRIMMED : clusterMode;
}
public double clusterDensity() {
return clusterDensity;
}
}
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,57 +16,78 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.prefab;
package art.arcane.iris.builtin.prepare;
import art.arcane.iris.engine.object.annotations.DependsOn;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.volmlib.util.math.M;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
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.Objects;
/** One axis of an object rotation, with the angles it may turn by and the steps between them. */
@Snippet("axis-rotation")
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Desc("Represents a rotation axis with intervals and maxes. The x and z axis values are defaulted to disabled. The Y axis defaults to on, rotating by 90 degree increments.")
@Data
public class IrisAxisRotationClamp {
public final class AxisRotationClamp {
private static final double FULL_TURN_DEGREES = 360D;
@Desc("Should this axis be rotated at all?")
private boolean enabled = false;
private transient boolean forceLock = false;
@Required
@DependsOn({"max"})
@MinNumber(-360)
@MaxNumber(360)
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
private double min = 0;
@Required
@DependsOn({"min"})
@MinNumber(-360)
@MaxNumber(360)
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
private double max = 0;
@Required
@DependsOn({"min", "max"})
@MinNumber(0)
@MaxNumber(360)
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees. \nSetting this to 0 means totally free rotation.\n\nNote that a lot of structures can have issues with non 90 degree intervals because the minecraft block resolution is so low.")
private double interval = 0;
public void minMax(double fd) {
min = fd;
max = fd;
forceLock = true;
public AxisRotationClamp() {
}
/** An axis turned as {@code enabled} says, by angles from {@code min} to {@code max} in steps of {@code interval}. */
public static AxisRotationClamp of(boolean enabled, boolean forceLock, double min, double max, double interval) {
AxisRotationClamp clamp = new AxisRotationClamp();
clamp.enabled = enabled;
clamp.forceLock = forceLock;
clamp.min = min;
clamp.max = max;
clamp.interval = interval;
return clamp;
}
/** An axis that turns to exactly {@code angle}, in steps of {@code interval}, whatever its min and max say. */
public static AxisRotationClamp locked(boolean enabled, double angle, double interval) {
return of(enabled, true, angle, angle, interval);
}
public boolean enabled() {
return enabled;
}
public double min() {
return min;
}
public double max() {
return max;
}
public double interval() {
return interval;
}
public boolean isUnlimited() {
@@ -79,18 +100,33 @@ public class IrisAxisRotationClamp {
public double getRadians(int rng) {
if (forceLock) {
return Math.toRadians(Math.ceil(Math.abs((max % 360D))));
return Math.toRadians(Math.ceil(Math.abs((max % FULL_TURN_DEGREES))));
}
if (isUnlimited()) {
double resolvedInterval = interval < 1 ? 1 : interval;
return Math.toRadians((resolvedInterval * (Math.ceil(Math.abs((rng % 360D) / resolvedInterval)))) % 360D);
return Math.toRadians((resolvedInterval * (Math.ceil(Math.abs((rng % FULL_TURN_DEGREES) / resolvedInterval)))) % FULL_TURN_DEGREES);
}
if (min == max && min != 0) {
return Math.toRadians(max);
}
return Math.toRadians(M.clip((interval * (Math.ceil(Math.abs((rng % 360D) / interval)))) % 360D, Math.min(min, max), Math.max(min, max)));
double angle = (interval * (Math.ceil(Math.abs((rng % FULL_TURN_DEGREES) / interval)))) % FULL_TURN_DEGREES;
return Math.toRadians(Math.min(Math.max(min, max), Math.max(Math.min(min, max), angle)));
}
@Override
public boolean equals(Object other) {
return other instanceof AxisRotationClamp clamp
&& enabled == clamp.enabled
&& Double.compare(min, clamp.min) == 0
&& Double.compare(max, clamp.max) == 0
&& Double.compare(interval, clamp.interval) == 0;
}
@Override
public int hashCode() {
return Objects.hash(enabled, min, max, interval);
}
}
@@ -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.builtin.prepare;
import com.volmit.config.Desc;
import com.volmit.config.Snippet;
/** How an object is turned around each axis, written as a placement's {@code rotation}. */
@Snippet("object-rotator")
@Desc("Configures rotation for iris")
public final class ObjectRotation {
private static final double QUARTER_TURN_DEGREES = 90;
@Desc("If this rotator is enabled or not")
private boolean enabled = true;
@Desc("The x axis rotation")
private AxisRotationClamp xAxis = new AxisRotationClamp();
@Desc("The y axis rotation")
private AxisRotationClamp yAxis = AxisRotationClamp.of(true, false, 0, 0, QUARTER_TURN_DEGREES);
@Desc("The z axis rotation")
private AxisRotationClamp zAxis = new AxisRotationClamp();
public ObjectRotation() {
}
public boolean enabled() {
return enabled;
}
public AxisRotationClamp xAxis() {
return xAxis;
}
public AxisRotationClamp yAxis() {
return yAxis;
}
public AxisRotationClamp zAxis() {
return zAxis;
}
}
@@ -0,0 +1,70 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.prepare;
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;
/** How far an object is shifted from where it would be placed, written as a placement's {@code translate}. */
@Snippet("object-translator")
@Desc("Translate objects")
public final class ObjectTranslate {
@MinNumber(-128)
@MaxNumber(128)
@Desc("The x shift in blocks")
private int x = 0;
@Required
@MinNumber(-128)
@MaxNumber(128)
@Desc("The y shift in blocks")
private int y = 0;
@MinNumber(-128)
@MaxNumber(128)
@Desc("Adds an additional amount of height randomly (translateY + rand(0 - yRandom))")
private int yRandom = 0;
@MinNumber(-128)
@MaxNumber(128)
@Desc("The z shift in blocks")
private int z = 0;
public ObjectTranslate() {
}
public int x() {
return x;
}
public int y() {
return y;
}
public int yRandom() {
return yRandom;
}
public int z() {
return z;
}
}
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,39 +16,46 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.placement;
package art.arcane.iris.builtin.prepare;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Snippet;
/** The terrain slopes a placement or decorator may sit on, written as its {@code slopeCondition}. */
@Snippet("slope-clip")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Limits placement to a minimum and maximum terrain slope")
@Data
public class IrisSlopeClip {
public final class SlopeClip {
private static final double DEFAULT_MINIMUM_SLOPE = 0;
private static final double DEFAULT_MAXIMUM_SLOPE = 10;
@MinNumber(0)
@MaxNumber(1024)
@Desc("The minimum slope for placement")
private double minimumSlope = 0;
private double minimumSlope = DEFAULT_MINIMUM_SLOPE;
@MinNumber(0)
@MaxNumber(1024)
@Desc("The maximum slope for placement")
private double maximumSlope = 10;
private double maximumSlope = DEFAULT_MAXIMUM_SLOPE;
public SlopeClip() {
}
public double minimumSlope() {
return minimumSlope;
}
public double maximumSlope() {
return maximumSlope;
}
/** Whether every slope passes. */
public boolean isDefault() {
return minimumSlope <= 0 && maximumSlope >= 10;
return minimumSlope <= 0 && maximumSlope >= DEFAULT_MAXIMUM_SLOPE;
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean isValid(double slope) {
if (isDefault()) {
return true;
@@ -0,0 +1,90 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.stilt;
import com.volmit.block.PaletteSpec;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Snippet;
import java.util.Optional;
/** How far and with which blocks an object stilts into the ground, written as the placement's {@code stiltSettings}. */
@Snippet("stilt-settings")
@Desc("Defines stilting behaviour.")
public final class StiltSettings {
@MinNumber(0)
@MaxNumber(64)
@Desc("Defines the maximum amount of blocks the object stilts verticially before overstilting and randomRange.")
private int yMax;
@MinNumber(0)
@MaxNumber(64)
@Desc("Defines the upper boundary for additional blocks after overstilting and/or maxStiltRange.")
private int yRand;
@MaxNumber(64)
@MinNumber(0)
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
private int overStilt;
@Desc("If defined, stilting will be done using this block palette rather than the last layer of the object.")
private PaletteSpec palette;
@MinNumber(1)
@MaxNumber(256)
@Desc("For ORGANIC_STILT / CEILING_HANG: the maximum number of blocks to scan toward the cave floor (or ceiling) looking for solid ground before giving up.")
private int organicMaxScan = 48;
@MinNumber(0)
@MaxNumber(32)
@Desc("For ORGANIC_STILT / CEILING_HANG: the maximum number of blocks each column's stilt is randomly shortened by, giving the underside a ragged organic edge instead of a flat disc.")
private int organicJitter = 3;
@MinNumber(0)
@MaxNumber(1)
@Desc("For ORGANIC_STILT / CEILING_HANG: in the deepest fraction of each stilt column, blocks are randomly skipped to break the tip up. Higher = more broken and scratchy. 0 disables.")
private double organicScratch = 0.55;
public StiltSettings() {
}
public int yMax() {
return yMax;
}
public int yRand() {
return yRand;
}
public int overStilt() {
return overStilt;
}
public Optional<PaletteSpec> palette() {
return Optional.ofNullable(palette);
}
public int organicMaxScan() {
return organicMaxScan;
}
public int organicJitter() {
return organicJitter;
}
public double organicScratch() {
return organicScratch;
}
}
@@ -1,21 +1,32 @@
package art.arcane.iris.engine.object.placement;
/*
* 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/>.
*/
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
package art.arcane.iris.builtin.vacuum;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Snippet;
/** How a VACUUM place mode bends terrain to meet an object's base, written as the placement's {@code vacuumSettings}. */
@Snippet("vacuum-settings")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Defines how a VACUUM place mode bends terrain to meet an object's base.")
@Data
public class IrisVacuumSettings {
public final class VacuumSettings {
@MinNumber(0)
@MaxNumber(128)
@Desc("The horizontal radius (in blocks) the terrain deformation extends beyond the object footprint before it blends back to the natural surface. 0 = derive automatically from the place mode (VACUUM, VACUUM_HIGH larger, VACUUM_FAST smaller).")
@@ -36,4 +47,27 @@ public class IrisVacuumSettings {
@MaxNumber(64)
@Desc("For VACUUM_WAVY: the frequency of the simplex wave. Higher values make tighter, choppier ripples; lower values make broad, gentle swells. The wavelength in blocks is roughly 100 / waveScale.")
private double waveScale = 5.0;
public VacuumSettings() {
}
public int radius() {
return radius;
}
public double falloff() {
return falloff;
}
public int organicJitter() {
return organicJitter;
}
public int waveAmplitude() {
return waveAmplitude;
}
public double waveScale() {
return waveScale;
}
}
@@ -1,6 +1,6 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
* 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
@@ -16,24 +16,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.placement;
package art.arcane.iris.builtin.validate;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.volmit.config.Desc;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
import com.volmit.config.Snippet;
/** The heights an object placement may sit between, written as the placement's {@code clamp}. */
@Snippet("object-limit")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Limits object placement by minimum and maximum world height")
@Data
public class IrisObjectLimit {
public final class ObjectLimit {
@MinNumber(-2048)
@MaxNumber(2048)
@Desc("The minimum height for placement (bottom of object)")
@@ -44,7 +37,19 @@ public class IrisObjectLimit {
@Desc("The maximum height for placement (top of object)")
private int maximumHeight = 2048;
public boolean canPlace(int h, int l) {
return h <= maximumHeight && l >= minimumHeight;
public ObjectLimit() {
}
public int minimumHeight() {
return minimumHeight;
}
public int maximumHeight() {
return maximumHeight;
}
/** Whether an object whose top is at {@code highest} and bottom at {@code lowest} fits between the limits. */
public boolean canPlace(int highest, int lowest) {
return highest <= maximumHeight && lowest >= minimumHeight;
}
}
@@ -19,6 +19,7 @@
package art.arcane.iris.engine.framework;
import art.arcane.iris.engine.framework.structure.NativeStartPlanner;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.engine.framework.structure.StructureResources;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.framework.structure.StructureGraphCatalog;
@@ -35,7 +36,6 @@ import art.arcane.iris.engine.object.structure.IrisStructurePlacement;
import art.arcane.iris.engine.object.structure.IrisStructureTerrain;
import art.arcane.iris.engine.object.structure.IrisStructureTerrainMode;
import art.arcane.iris.engine.object.structure.vanilla.NativeStructureSuppression;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.engine.object.structure.StructureDistribution;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
@@ -18,8 +18,8 @@
package art.arcane.iris.engine.framework.structure;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.core.pack.PackValidationIo;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.volmlib.util.json.JSONArray;
import art.arcane.volmlib.util.json.JSONObject;
import com.volmit.validation.Problem;
@@ -18,12 +18,12 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.engine.IrisComplex;
import art.arcane.iris.engine.UpperDimensionContext;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.mantle.MantleWriter;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveProfile;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingEntry;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
import art.arcane.iris.engine.object.world.region.IrisRegion;
@@ -67,7 +67,7 @@ public class CaveCarving {
private final Engine engine;
private final Object profileCarverLock = new Object();
private volatile Map<IrisCaveProfile, IrisCaveCarver3D> profileCarvers = new IdentityHashMap<>();
private volatile Map<CaveProfile, IrisCaveCarver3D> profileCarvers = new IdentityHashMap<>();
static {
int kernelIndex = 0;
@@ -132,7 +132,7 @@ public class CaveCarving {
private static int maxSurfaceBreakDepth(List<WeightedProfile> weightedProfiles) {
int maxDepth = 0;
for (WeightedProfile weightedProfile : weightedProfiles) {
maxDepth = Math.max(maxDepth, Math.max(0, weightedProfile.profile.getSurfaceBreakDepth()));
maxDepth = Math.max(maxDepth, Math.max(0, weightedProfile.profile.surfaceBreakDepth()));
}
return maxDepth;
}
@@ -202,11 +202,11 @@ public class CaveCarving {
private List<WeightedProfile> resolveWeightedProfiles(int chunkX, int chunkZ, IrisComplex complex, IrisDimensionCarvingResolver.State resolverState) {
BlendScratch blendScratch = BLEND_SCRATCH.get();
IrisCaveProfile[] profileField = blendScratch.profileField;
Map<IrisCaveProfile, double[]> columnProfileWeights = blendScratch.columnProfileWeights;
IdentityHashMap<IrisCaveProfile, Boolean> activeProfiles = blendScratch.activeProfiles;
List<IrisCaveProfile> profileOrder = blendScratch.profileOrder;
IrisCaveProfile[] kernelProfiles = blendScratch.kernelProfiles;
CaveProfile[] profileField = blendScratch.profileField;
Map<CaveProfile, double[]> columnProfileWeights = blendScratch.columnProfileWeights;
IdentityHashMap<CaveProfile, Boolean> activeProfiles = blendScratch.activeProfiles;
List<CaveProfile> profileOrder = blendScratch.profileOrder;
CaveProfile[] kernelProfiles = blendScratch.kernelProfiles;
double[] kernelProfileWeights = blendScratch.kernelProfileWeights;
activeProfiles.clear();
profileOrder.clear();
@@ -222,7 +222,7 @@ public class CaveCarving {
for (int kernelIndex = 0; kernelIndex < KERNEL_SIZE; kernelIndex++) {
int sampleX = centerX + KERNEL_DX[kernelIndex];
int sampleZ = centerZ + KERNEL_DZ[kernelIndex];
IrisCaveProfile profile = profileField[(sampleX * FIELD_SIZE) + sampleZ];
CaveProfile profile = profileField[(sampleX * FIELD_SIZE) + sampleZ];
if (!isProfileEnabled(profile)) {
continue;
}
@@ -245,7 +245,7 @@ public class CaveCarving {
int columnIndex = PowerOfTwoCoordinates.packLocal16(localX, localZ);
for (int profileIndex = 0; profileIndex < profileCount; profileIndex++) {
IrisCaveProfile profile = kernelProfiles[profileIndex];
CaveProfile profile = kernelProfiles[profileIndex];
double kernelWeight = kernelProfileWeights[profileIndex];
kernelProfiles[profileIndex] = null;
kernelProfileWeights[profileIndex] = 0D;
@@ -271,7 +271,7 @@ public class CaveCarving {
}
List<WeightedProfile> columnWeightedProfiles = new ArrayList<>();
for (IrisCaveProfile profile : profileOrder) {
for (CaveProfile profile : profileOrder) {
double[] weights = columnProfileWeights.get(profile);
if (weights == null) {
continue;
@@ -319,8 +319,8 @@ public class CaveCarving {
IrisDimensionCarvingEntry[] columnPlan = dimensionColumnPlans.computeIfAbsent(entry, key -> new IrisDimensionCarvingEntry[CHUNK_AREA]);
buildDimensionColumnPlan(columnPlan, chunkX, chunkZ, entry, resolverState);
Map<IrisCaveProfile, double[]> rootProfileColumnWeights = new IdentityHashMap<>();
List<IrisCaveProfile> rootProfileOrder = new ArrayList<>();
Map<CaveProfile, double[]> rootProfileColumnWeights = new IdentityHashMap<>();
List<CaveProfile> rootProfileOrder = new ArrayList<>();
IrisRange worldYRange = entry.getWorldYRange();
for (int columnIndex = 0; columnIndex < CHUNK_AREA; columnIndex++) {
IrisDimensionCarvingEntry resolvedEntry = columnPlan[columnIndex];
@@ -329,7 +329,7 @@ public class CaveCarving {
continue;
}
IrisCaveProfile profile = resolvedBiome.getCaveProfile();
CaveProfile profile = resolvedBiome.getCaveProfile();
if (!isProfileEnabled(profile)) {
continue;
}
@@ -343,7 +343,7 @@ public class CaveCarving {
columnWeights[columnIndex] = 1D;
}
for (IrisCaveProfile profile : rootProfileOrder) {
for (CaveProfile profile : rootProfileOrder) {
weightedProfiles.add(new WeightedProfile(profile, rootProfileColumnWeights.get(profile), -1D, worldYRange, weightedProfiles.size()));
}
}
@@ -364,7 +364,7 @@ public class CaveCarving {
}
}
private void fillProfileField(IrisCaveProfile[] profileField, int chunkX, int chunkZ, IrisComplex complex, IrisDimensionCarvingResolver.State resolverState, BlendScratch blendScratch) {
private void fillProfileField(CaveProfile[] profileField, int chunkX, int chunkZ, IrisComplex complex, IrisDimensionCarvingResolver.State resolverState, BlendScratch blendScratch) {
int startX = PowerOfTwoCoordinates.chunkToBlock(chunkX) - BLEND_RADIUS;
int startZ = PowerOfTwoCoordinates.chunkToBlock(chunkZ) - BLEND_RADIUS;
prefillProfileFieldSamples(startX, startZ, complex, blendScratch);
@@ -387,7 +387,7 @@ public class CaveCarving {
}
}
private int findProfileIndex(IrisCaveProfile[] profiles, int size, IrisCaveProfile profile) {
private int findProfileIndex(CaveProfile[] profiles, int size, CaveProfile profile) {
for (int index = 0; index < size; index++) {
if (profiles[index] == profile) {
return index;
@@ -397,7 +397,7 @@ public class CaveCarving {
return -1;
}
private IrisCaveProfile resolveColumnProfile(
private CaveProfile resolveColumnProfile(
int worldX,
int worldZ,
double surfaceHeight,
@@ -406,21 +406,21 @@ public class CaveCarving {
IrisBiome caveBiome,
IrisDimensionCarvingResolver.State resolverState
) {
IrisCaveProfile resolved = null;
IrisCaveProfile dimensionProfile = engine.getDimension().getCaveProfile();
CaveProfile resolved = null;
CaveProfile dimensionProfile = engine.getDimension().getCaveProfile();
if (isProfileEnabled(dimensionProfile)) {
resolved = dimensionProfile;
}
if (region != null) {
IrisCaveProfile regionProfile = region.getCaveProfile();
CaveProfile regionProfile = region.getCaveProfile();
if (isProfileEnabled(regionProfile)) {
resolved = regionProfile;
}
}
if (surfaceBiome != null) {
IrisCaveProfile surfaceProfile = surfaceBiome.getCaveProfile();
CaveProfile surfaceProfile = surfaceBiome.getCaveProfile();
if (isProfileEnabled(surfaceProfile)) {
resolved = surfaceProfile;
}
@@ -455,7 +455,7 @@ public class CaveCarving {
}
}
IrisCaveProfile caveProfile = effectiveCaveBiome.getCaveProfile();
CaveProfile caveProfile = effectiveCaveBiome.getCaveProfile();
if (isProfileEnabled(caveProfile)) {
resolved = caveProfile;
}
@@ -499,7 +499,7 @@ public class CaveCarving {
}
}
private IrisCaveCarver3D getCarver(IrisCaveProfile profile) {
private IrisCaveCarver3D getCarver(CaveProfile profile) {
IrisCaveCarver3D carver = profileCarvers.get(profile);
if (carver != null) {
return carver;
@@ -512,15 +512,15 @@ public class CaveCarving {
return published;
}
Map<IrisCaveProfile, IrisCaveCarver3D> updated = new IdentityHashMap<>(profileCarvers);
Map<CaveProfile, IrisCaveCarver3D> updated = new IdentityHashMap<>(profileCarvers);
updated.put(profile, createdCarver);
profileCarvers = updated;
return createdCarver;
}
}
private boolean isProfileEnabled(IrisCaveProfile profile) {
return profile != null && profile.isEnabled();
private boolean isProfileEnabled(CaveProfile profile) {
return profile != null && profile.enabled();
}
private int[] prepareChunkSurfaceHeights(int chunkX, int chunkZ, ChunkContext context, int[] scratch) {
@@ -656,13 +656,13 @@ public class CaveCarving {
}
private static final class WeightedProfile {
private final IrisCaveProfile profile;
private final CaveProfile profile;
private final double[] columnWeights;
private final double averageWeight;
private final IrisRange worldYRange;
private final int sequence;
private WeightedProfile(IrisCaveProfile profile, double[] columnWeights, double averageWeight, IrisRange worldYRange, int sequence) {
private WeightedProfile(CaveProfile profile, double[] columnWeights, double averageWeight, IrisRange worldYRange, int sequence) {
this.profile = profile;
this.columnWeights = columnWeights;
this.averageWeight = averageWeight;
@@ -676,13 +676,13 @@ public class CaveCarving {
}
private static final class BlendScratch {
private final IrisCaveProfile[] profileField = new IrisCaveProfile[FIELD_SIZE * FIELD_SIZE];
private final IrisCaveProfile[] kernelProfiles = new IrisCaveProfile[KERNEL_SIZE];
private final CaveProfile[] profileField = new CaveProfile[FIELD_SIZE * FIELD_SIZE];
private final CaveProfile[] kernelProfiles = new CaveProfile[KERNEL_SIZE];
private final double[] kernelProfileWeights = new double[KERNEL_SIZE];
private final IdentityHashMap<IrisCaveProfile, double[]> columnProfileWeights = new IdentityHashMap<>();
private final IdentityHashMap<CaveProfile, double[]> columnProfileWeights = new IdentityHashMap<>();
private final IdentityHashMap<IrisDimensionCarvingEntry, IrisDimensionCarvingEntry[]> dimensionColumnPlans = new IdentityHashMap<>();
private final IdentityHashMap<IrisCaveProfile, Boolean> activeProfiles = new IdentityHashMap<>();
private final List<IrisCaveProfile> profileOrder = new ArrayList<>();
private final IdentityHashMap<CaveProfile, Boolean> activeProfiles = new IdentityHashMap<>();
private final List<CaveProfile> profileOrder = new ArrayList<>();
private final double[] fieldSurfaceHeights = new double[FIELD_SIZE * FIELD_SIZE];
private final boolean[] fieldHasFluid = new boolean[FIELD_SIZE * FIELD_SIZE];
private final IrisRegion[] fieldRegions = new IrisRegion[FIELD_SIZE * FIELD_SIZE];
@@ -18,7 +18,7 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveFieldModule;
import art.arcane.iris.engine.object.terrain.carving.ResolvedCaveProfile;
import art.arcane.iris.engine.object.value.IrisRange;
import art.arcane.iris.util.project.noise.CNG;
@@ -32,14 +32,14 @@ final class CaveFieldModuleState {
final double minContribution;
final double maxContribution;
CaveFieldModuleState(IrisCaveFieldModule module, CNG density) {
IrisRange range = module.getVerticalRange();
CaveFieldModuleState(ResolvedCaveProfile.Module module, CNG density) {
IrisRange range = module.verticalRange();
this.density = density;
this.minY = (int) Math.floor(range.getMin());
this.maxY = (int) Math.ceil(range.getMax());
this.weight = module.getWeight();
this.threshold = module.getThreshold();
this.invert = module.isInvert();
this.weight = module.weight();
this.threshold = module.threshold();
this.invert = module.invert();
double rawMin = invert ? threshold - 1D : -1D - threshold;
double rawMax = invert ? threshold + 1D : 1D - threshold;
this.minContribution = rawMin * weight;
@@ -18,6 +18,10 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.engine.object.terrain.floating.FloatingChildren;
import art.arcane.iris.builtin.floating.FloatingChildBiome;
import art.arcane.iris.engine.object.terrain.floating.ResolvedFloatingChild;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.IrisComplex;
@@ -28,12 +32,10 @@ import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
import art.arcane.iris.engine.object.placement.FloatingObjectFootprint;
import art.arcane.iris.engine.object.placement.IObjectPlacer;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.terrain.floating.IrisFloatingChildBiomes;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.util.common.data.B;
@@ -47,6 +49,7 @@ import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -91,10 +94,10 @@ public class FloatingObjectPlacing {
// The IdentityHashMaps are lookup indices only. Iteration MUST follow the encounter
// order of the deterministic 0..255 column scan: identity-hash order changes per JVM
// run, and the shared chunkRng makes placement output depend on iteration order.
IdentityHashMap<IrisFloatingChildBiomes, KList<Integer>> entryColumns = new IdentityHashMap<>();
IdentityHashMap<IrisFloatingChildBiomes, KList<Integer>> bottomEntryColumns = new IdentityHashMap<>();
KList<IrisFloatingChildBiomes> entryOrder = new KList<>();
KList<IrisFloatingChildBiomes> bottomEntryOrder = new KList<>();
IdentityHashMap<ResolvedFloatingChild, KList<Integer>> entryColumns = new IdentityHashMap<>();
IdentityHashMap<ResolvedFloatingChild, KList<Integer>> bottomEntryColumns = new IdentityHashMap<>();
KList<ResolvedFloatingChild> entryOrder = new KList<>();
KList<ResolvedFloatingChild> bottomEntryOrder = new KList<>();
for (int i = 0; i < 256; i++) {
FloatingIslandSample s = samples[i];
if (s == null || s.entry == null) {
@@ -104,7 +107,7 @@ public class FloatingObjectPlacing {
entryOrder.add(e);
return new KList<>();
}).add(i);
IrisFloatingChildBiomes bottomEntry = s.bottomEntry();
ResolvedFloatingChild bottomEntry = s.bottomEntry();
if (bottomEntry != null) {
bottomEntryColumns.computeIfAbsent(bottomEntry, e -> {
bottomEntryOrder.add(e);
@@ -113,7 +116,7 @@ public class FloatingObjectPlacing {
}
}
for (IrisFloatingChildBiomes entry : entryOrder) {
for (ResolvedFloatingChild entry : entryOrder) {
KList<Integer> columns = entryColumns.get(entry);
if (columns.isEmpty()) {
continue;
@@ -123,7 +126,7 @@ public class FloatingObjectPlacing {
IrisBiome parent = sampleResolver.parent(minX + (firstKey & 15), minZ + (firstKey >> 4));
IrisBiome target = entry.getRealBiome(parent, data);
KList<IrisObjectPlacement> floating = entry.getFloatingObjects();
KList<IrisObjectPlacement> floating = new KList<>(entry.settings().floatingObjects());
if (floating != null && !floating.isEmpty()) {
for (IrisObjectPlacement placement : floating) {
tryPlaceFloatingChunk(writer, complex, chunkRng, data, placement, columns, minX, minZ, entry);
@@ -131,7 +134,7 @@ public class FloatingObjectPlacing {
}
KList<IrisObjectPlacement> surface = target != null ? entry.resolveTopObjects(target) : null;
KList<IrisObjectPlacement> extras = entry.getExtraObjects();
KList<IrisObjectPlacement> extras = new KList<>(entry.settings().extraObjects());
boolean hasSurface = surface != null && !surface.isEmpty();
boolean hasExtras = extras != null && !extras.isEmpty();
KList<Integer> interior = null;
@@ -150,7 +153,7 @@ public class FloatingObjectPlacing {
}
}
for (IrisFloatingChildBiomes entry : bottomEntryOrder) {
for (ResolvedFloatingChild entry : bottomEntryOrder) {
KList<Integer> columns = bottomEntryColumns.get(entry);
if (columns.isEmpty()) {
continue;
@@ -170,7 +173,7 @@ public class FloatingObjectPlacing {
}
@ChunkCoordinates
private void tryPlaceFloatingChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, KList<Integer> columns, int minX, int minZ, IrisFloatingChildBiomes entry) {
private void tryPlaceFloatingChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, KList<Integer> columns, int minX, int minZ, ResolvedFloatingChild entry) {
if (placement == null || columns == null || columns.isEmpty()) {
return;
}
@@ -216,7 +219,7 @@ public class FloatingObjectPlacing {
}
@ChunkCoordinates
private void tryPlaceAnchoredChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, FloatingIslandSample[] samples, IslandObjectPlacer.SampleProvider sampleProvider, KList<Integer> columns, KList<Integer> interior, int minX, int minZ, IrisFloatingChildBiomes entry) {
private void tryPlaceAnchoredChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, FloatingIslandSample[] samples, IslandObjectPlacer.SampleProvider sampleProvider, KList<Integer> columns, KList<Integer> interior, int minX, int minZ, ResolvedFloatingChild entry) {
if (placement == null || columns.isEmpty()) {
return;
}
@@ -301,7 +304,7 @@ public class FloatingObjectPlacing {
}
@ChunkCoordinates
private void tryPlaceInvertedChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, FloatingIslandSample[] samples, IslandObjectPlacer.SampleProvider sampleProvider, KList<Integer> columns, KList<Integer> interior, int minX, int minZ, IrisFloatingChildBiomes entry) {
private void tryPlaceInvertedChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, FloatingIslandSample[] samples, IslandObjectPlacer.SampleProvider sampleProvider, KList<Integer> columns, KList<Integer> interior, int minX, int minZ, ResolvedFloatingChild entry) {
if (placement == null || columns.isEmpty()) {
return;
}
@@ -405,7 +408,7 @@ public class FloatingObjectPlacing {
static boolean isFootprintFlatBottom(FloatingObjectFootprint fp, IrisObjectRotation rotation,
int pickedX, int pickedZ, int pickBottomY,
IslandObjectPlacer.SampleProvider samples,
IrisFloatingChildBiomes entry, int tolerance) {
ResolvedFloatingChild entry, int tolerance) {
IrisBlockVector anchor = invertedFootprintAnchor(fp, rotation);
long[] cells = fp.footprintXZ();
if (cells.length == 0) {
@@ -475,7 +478,7 @@ public class FloatingObjectPlacing {
static boolean isFootprintFlat(FloatingObjectFootprint fp, int pickedX, int pickedZ, int pickTopY,
IslandObjectPlacer.SampleProvider samples,
IrisFloatingChildBiomes entry, int tolerance) {
ResolvedFloatingChild entry, int tolerance) {
int tallestKx = fp.getTallestKx();
int tallestKz = fp.getTallestKz();
long[] cells = fp.footprintXZ();
@@ -499,7 +502,7 @@ public class FloatingObjectPlacing {
private static KList<Integer> interiorColumns(IslandObjectPlacer.SampleProvider samples,
KList<Integer> columns, int minX, int minZ,
IrisFloatingChildBiomes entry,
ResolvedFloatingChild entry,
IslandObjectPlacer.AnchorFace face) {
KList<Integer> interior = new KList<>();
for (int key : columns) {
@@ -554,15 +557,15 @@ public class FloatingObjectPlacing {
try {
IrisData data = engine.getData();
for (IrisBiome biome : engine.getDimension().getReachableBiomes(engine)) {
KList<IrisFloatingChildBiomes> entries = biome.getFloatingChildBiomes();
if (entries == null || entries.isEmpty()) {
List<FloatingChildBiome> settings = biome.getFloatingChildBiomes();
if (settings == null || settings.isEmpty()) {
continue;
}
for (IrisFloatingChildBiomes entry : entries) {
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(entry.getFloatingObjects(), data, sizeCache, warnedLargeObjects));
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(entry.getExtraObjects(), data, sizeCache, warnedLargeObjects));
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(entry.getTopObjectOverrides(), data, sizeCache, warnedLargeObjects));
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(entry.getBottomObjectOverrides(), data, sizeCache, warnedLargeObjects));
for (ResolvedFloatingChild entry : FloatingChildren.of(engine).of(settings)) {
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(new KList<>(entry.settings().floatingObjects()), data, sizeCache, warnedLargeObjects));
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(new KList<>(entry.settings().extraObjects()), data, sizeCache, warnedLargeObjects));
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(new KList<>(entry.settings().topObjectOverrides()), data, sizeCache, warnedLargeObjects));
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(new KList<>(entry.settings().bottomObjectOverrides()), data, sizeCache, warnedLargeObjects));
try {
IrisBiome target = entry.getRealBiome(biome, data);
if (target != null) {
@@ -18,11 +18,11 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.engine.object.terrain.carving.ResolvedCaveProfile;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.mantle.MantleWriter;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveFieldModule;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveProfile;
import art.arcane.iris.engine.object.value.IrisRange;
import art.arcane.iris.engine.object.noise.IrisStyledRange;
import art.arcane.iris.util.project.noise.CNG;
@@ -53,7 +53,8 @@ public class IrisCaveCarver3D {
private final Engine engine;
private final IrisData data;
private final IrisCaveProfile profile;
private final CaveProfile profile;
private final ResolvedCaveProfile resolved;
private final CNG baseDensity;
private final CNG detailDensity;
private final CNG warpDensity;
@@ -81,10 +82,11 @@ public class IrisCaveCarver3D {
private final int aquiferCeilingY;
private final ThreadLocal<CaveCarveScratch> scratchCache = ThreadLocal.withInitial(CaveCarveScratch::new);
public IrisCaveCarver3D(Engine engine, IrisCaveProfile profile) {
public IrisCaveCarver3D(Engine engine, CaveProfile profile) {
this.engine = engine;
this.data = engine.getData();
this.profile = profile;
this.resolved = ResolvedCaveProfile.of(profile);
this.carveAir = new MatterCavern(true, "", LIQUID_AIR);
this.carveFluid = new MatterCavern(true, "", LIQUID_FLUID);
this.carveLava = new MatterCavern(true, "", LIQUID_LAVA);
@@ -92,26 +94,26 @@ public class IrisCaveCarver3D {
List<CaveFieldModuleState> moduleStates = new ArrayList<>();
RNG baseRng = new RNG(engine.getSeedManager().getCarve());
this.baseDensity = profile.getBaseDensityStyle().create(baseRng.nextParallelRNG(934_447), data);
this.detailDensity = profile.getDetailDensityStyle().create(baseRng.nextParallelRNG(612_991), data);
this.warpDensity = profile.getWarpStyle().create(baseRng.nextParallelRNG(770_713), data);
this.surfaceBreakDensity = profile.getSurfaceBreakStyle().create(baseRng.nextParallelRNG(341_219), data);
this.baseDensity = resolved.baseDensityStyle().create(baseRng.nextParallelRNG(934_447), data);
this.detailDensity = resolved.detailDensityStyle().create(baseRng.nextParallelRNG(612_991), data);
this.warpDensity = resolved.warpStyle().create(baseRng.nextParallelRNG(770_713), data);
this.surfaceBreakDensity = resolved.surfaceBreakStyle().create(baseRng.nextParallelRNG(341_219), data);
this.thresholdRng = baseRng.nextParallelRNG(489_112);
this.baseWeight = profile.getBaseWeight();
this.detailWeight = profile.getDetailWeight();
this.warpStrength = profile.getWarpStrength();
this.baseWeight = profile.baseWeight();
this.detailWeight = profile.detailWeight();
this.warpStrength = profile.warpStrength();
this.hasWarp = this.warpStrength > 0D;
this.warpResolution = 2;
this.allowFluid = profile.isAllowFluid();
this.fluidRequiresFloor = profile.isFluidRequiresFloor();
this.fluidMinDepthBelowSurface = Math.max(0, profile.getFluidMinDepthBelowSurface());
this.allowFluid = profile.allowFluid();
this.fluidRequiresFloor = profile.fluidRequiresFloor();
this.fluidMinDepthBelowSurface = Math.max(0, profile.fluidMinDepthBelowSurface());
this.fluidHeight = engine.getDimension().getFluidHeight();
this.aquiferCeilingY = engine.getHeight() - 1;
double weight = Math.abs(baseWeight) + Math.abs(detailWeight);
int index = 0;
for (IrisCaveFieldModule module : profile.getModules()) {
CNG moduleDensity = module.getStyle().create(baseRng.nextParallelRNG(1_000_003L + (index * 65_537L)), data);
for (ResolvedCaveProfile.Module module : resolved.modules()) {
CNG moduleDensity = module.style().create(baseRng.nextParallelRNG(1_000_003L + (index * 65_537L)), data);
CaveFieldModuleState state = new CaveFieldModuleState(module, moduleDensity);
moduleStates.add(state);
weight += Math.abs(state.weight);
@@ -217,7 +219,7 @@ public class IrisCaveCarver3D {
double resolvedMinWeight = Math.max(0D, Math.min(1D, minWeight));
double resolvedThresholdPenalty = Math.max(0D, thresholdPenalty);
int worldHeight = writer.getMantle().getWorldHeight();
IrisRange effectiveVerticalRange = overrideVerticalRange != null ? overrideVerticalRange : profile.getVerticalRange();
IrisRange effectiveVerticalRange = overrideVerticalRange != null ? overrideVerticalRange : resolved.verticalRange();
int minY = Math.max(0, (int) Math.floor(effectiveVerticalRange.getMin()));
int maxY = Math.min(worldHeight - 1, (int) Math.ceil(effectiveVerticalRange.getMax()));
if (worldYRange != null) {
@@ -227,16 +229,16 @@ public class IrisCaveCarver3D {
minY = Math.max(minY, rangeMinY);
maxY = Math.min(maxY, rangeMaxY);
}
int sampleStep = Math.max(1, profile.getSampleStep());
int sampleStep = Math.max(1, profile.sampleStep());
boolean exactSampling = sampleStep <= 2;
boolean adaptiveSampling = exactSampling && profile.isAdaptiveSampling();
int adaptiveSampleStep = Math.max(2, profile.getAdaptiveSampleStep());
double adaptiveThresholdMargin = Math.max(0D, profile.getAdaptiveThresholdMargin());
int surfaceClearance = Math.max(0, profile.getSurfaceClearance());
int surfaceBreakDepth = Math.max(0, profile.getSurfaceBreakDepth());
double surfaceBreakNoiseThreshold = profile.getSurfaceBreakNoiseThreshold();
double surfaceBreakThresholdBoost = Math.max(0, profile.getSurfaceBreakThresholdBoost());
boolean allowSurfaceBreak = profile.isAllowSurfaceBreak();
boolean adaptiveSampling = exactSampling && profile.adaptiveSampling();
int adaptiveSampleStep = Math.max(2, profile.adaptiveSampleStep());
double adaptiveThresholdMargin = Math.max(0D, profile.adaptiveThresholdMargin());
int surfaceClearance = Math.max(0, profile.surfaceClearance());
int surfaceBreakDepth = Math.max(0, profile.surfaceBreakDepth());
double surfaceBreakNoiseThreshold = profile.surfaceBreakNoiseThreshold();
double surfaceBreakThresholdBoost = Math.max(0, profile.surfaceBreakThresholdBoost());
boolean allowSurfaceBreak = profile.allowSurfaceBreak();
if (maxY < minY) {
return 0;
}
@@ -263,10 +265,10 @@ public class IrisCaveCarver3D {
// IrisStyledRange.get() resolves its CNG per call, which costs a cache-key allocation,
// a capturing lambda and a shared LRU touch. The CNG is constant for (thresholdRng, data),
// so resolve it once here and replicate the min==max / isFlat short circuits verbatim.
IrisStyledRange densityThreshold = profile.getDensityThreshold();
IrisStyledRange densityThreshold = resolved.densityThreshold();
double thresholdMin = densityThreshold.getMin();
double thresholdMax = densityThreshold.getMax();
double thresholdBias = profile.getThresholdBias();
double thresholdBias = profile.thresholdBias();
CNG thresholdDensity = null;
double constantThreshold = 0D;
if (thresholdMin == thresholdMax) {
@@ -2180,7 +2182,7 @@ public class IrisCaveCarver3D {
}
MatterCavern[] matterByY = scratch.matterByY;
boolean allowLava = profile.isAllowLava();
boolean allowLava = profile.allowLava();
int lavaHeight = engine.getDimension().getCaveLavaHeight();
for (int y = minY; y <= maxY; y++) {
@@ -2354,8 +2356,8 @@ public class IrisCaveCarver3D {
}
double[] verticalEdgeFade = scratch.verticalEdgeFade;
int fadeRange = Math.max(0, profile.getVerticalEdgeFade());
double fadeStrength = Math.max(0D, profile.getVerticalEdgeFadeStrength());
int fadeRange = Math.max(0, profile.verticalEdgeFade());
double fadeStrength = Math.max(0D, profile.verticalEdgeFadeStrength());
if (size <= 0 || fadeRange <= 0 || maxY <= minY || fadeStrength <= 0D) {
Arrays.fill(verticalEdgeFade, 0, size, 0D);
return verticalEdgeFade;
@@ -18,12 +18,12 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.engine.object.terrain.floating.ResolvedFloatingChild;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.mantle.MantleWriter;
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
import art.arcane.iris.engine.object.placement.IObjectPlacer;
import art.arcane.iris.engine.object.terrain.floating.IrisFloatingChildBiomes;
import art.arcane.iris.engine.object.prefab.TileData;
import art.arcane.iris.spi.PlatformBlockState;
import org.jetbrains.annotations.Nullable;
@@ -34,7 +34,7 @@ public final class IslandObjectPlacer implements IObjectPlacer {
private final MantleWriter wrapped;
private final SampleProvider samples;
private final IrisFloatingChildBiomes entry;
private final ResolvedFloatingChild entry;
private final int anchorY;
private final AnchorFace face;
@@ -47,12 +47,12 @@ public final class IslandObjectPlacer implements IObjectPlacer {
}
public static IslandObjectPlacer top(MantleWriter wrapped, SampleProvider samples,
IrisFloatingChildBiomes entry, int anchorY) {
ResolvedFloatingChild entry, int anchorY) {
return new IslandObjectPlacer(wrapped, new AnchorSettings(samples, entry, anchorY, AnchorFace.TOP));
}
public static IslandObjectPlacer bottom(MantleWriter wrapped, SampleProvider samples,
IrisFloatingChildBiomes entry, int anchorY) {
ResolvedFloatingChild entry, int anchorY) {
return new IslandObjectPlacer(wrapped, new AnchorSettings(samples, entry, anchorY, AnchorFace.BOTTOM));
}
@@ -157,7 +157,7 @@ public final class IslandObjectPlacer implements IObjectPlacer {
return wrapped == null ? null : wrapped.getEngine();
}
static boolean matchesAnchor(FloatingIslandSample sample, IrisFloatingChildBiomes entry, AnchorFace face) {
static boolean matchesAnchor(FloatingIslandSample sample, ResolvedFloatingChild entry, AnchorFace face) {
if (sample == null) {
return false;
}
@@ -212,7 +212,7 @@ public final class IslandObjectPlacer implements IObjectPlacer {
private record AnchorSettings(
SampleProvider samples,
IrisFloatingChildBiomes entry,
ResolvedFloatingChild entry,
int anchorY,
AnchorFace face
) {
@@ -19,6 +19,14 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.builtin.objects.coral.Coral;
import art.arcane.iris.builtin.objects.crystal.Crystal;
import art.arcane.iris.builtin.objects.formation.Formation;
import art.arcane.iris.builtin.objects.fungi.Fungus;
import art.arcane.iris.builtin.objects.ruin.Ruin;
import art.arcane.iris.builtin.objects.tree.TreeCanopy;
import art.arcane.iris.builtin.objects.tree.TreeDecorator;
import art.arcane.iris.builtin.objects.tree.TreeSecondaryLeaf;
import art.arcane.iris.core.modules.IrisMantleChunk;
import art.arcane.iris.core.modules.IrisPackSettings;
import art.arcane.iris.engine.framework.Engine;
@@ -55,6 +63,14 @@ public final class ObjectModule implements IrisModule {
public void register(FeatureRegistry registry) {
registry.registerService(ObjectsAt.class, new ObjectLocating());
registry.registerService(SaplingGrowth.class, new TreeGrowing());
registry.registerHeldType(TreeCanopy.class);
registry.registerHeldType(TreeDecorator.class);
registry.registerHeldType(TreeSecondaryLeaf.class);
registry.registerHeldType(Coral.class);
registry.registerHeldType(Crystal.class);
registry.registerHeldType(Formation.class);
registry.registerHeldType(Fungus.class);
registry.registerHeldType(Ruin.class);
}
private static void place(MantleStageContext context) {
@@ -19,6 +19,11 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.carve.CaveAnchorMode;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.prepare.AxisRotationClamp;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.IrisObjectVacuum;
import art.arcane.iris.core.IrisSettings;
@@ -29,13 +34,9 @@ import art.arcane.iris.engine.UpperDimensionContext;
import art.arcane.iris.engine.mantle.MantleWriter;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.framework.TreeBlockMaterial;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.engine.object.placement.DecayControlPlacer;
import art.arcane.iris.engine.object.placement.IObjectPlacer;
import art.arcane.iris.engine.object.prefab.IrisAxisRotationClamp;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveAnchorMode;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveProfile;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
@@ -44,7 +45,6 @@ import art.arcane.iris.engine.object.procedural.IrisProceduralObjects;
import art.arcane.iris.engine.object.procedural.IrisProceduralPlacement;
import art.arcane.iris.engine.object.procedural.tree.IrisProceduralTree;
import art.arcane.iris.engine.object.world.region.IrisRegion;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.collection.KMap;
@@ -234,8 +234,8 @@ public class ObjectPlacing {
int rejected = 0;
int nullObjects = 0;
int errors = 0;
IrisCaveProfile biomeCaveProfile = resolveCaveProfile(caveBiome.getCaveProfile(), region.getCaveProfile());
IrisCaveProfile regionCaveProfile = resolveCaveProfile(region.getCaveProfile(), caveBiome.getCaveProfile());
CaveProfile biomeCaveProfile = resolveCaveProfile(caveBiome.getCaveProfile(), region.getCaveProfile());
CaveProfile regionCaveProfile = resolveCaveProfile(region.getCaveProfile(), caveBiome.getCaveProfile());
CaveAnchorCache caveAnchorCache = new CaveAnchorCache();
for (IrisObjectPlacement i : surfaceBiome.getSurfaceObjects()) {
@@ -383,12 +383,12 @@ public class ObjectPlacing {
@ChunkCoordinates
private void placeProceduralObjects(MantleWriter writer, RNG rng, int x, int z, IrisBiome surfaceBiome, IrisBiome caveBiome, IrisRegion region) {
IrisCaveProfile surfaceCaveProfile = resolveCaveProfile(surfaceBiome.getCaveProfile(), region.getCaveProfile());
IrisCaveProfile regionCaveProfile = resolveCaveProfile(region.getCaveProfile(), caveBiome == null ? null : caveBiome.getCaveProfile());
CaveProfile surfaceCaveProfile = resolveCaveProfile(surfaceBiome.getCaveProfile(), region.getCaveProfile());
CaveProfile regionCaveProfile = resolveCaveProfile(region.getCaveProfile(), caveBiome == null ? null : caveBiome.getCaveProfile());
placeProceduralFrom(writer, rng, x, z, surfaceBiome.getProceduralObjects(), surfaceBiome.getName(), surfaceCaveProfile, surfaceBiome.getLoadKey());
placeProceduralFrom(writer, rng, x, z, region.getProceduralObjects(), region.getName(), regionCaveProfile, null);
if (caveBiome != null && caveBiome != surfaceBiome) {
IrisCaveProfile caveProfile = resolveCaveProfile(caveBiome.getCaveProfile(), region.getCaveProfile());
CaveProfile caveProfile = resolveCaveProfile(caveBiome.getCaveProfile(), region.getCaveProfile());
placeProceduralFrom(writer, rng, x, z, caveBiome.getProceduralObjects(), caveBiome.getName(), caveProfile, caveBiome.getLoadKey());
}
}
@@ -401,7 +401,7 @@ public class ObjectPlacing {
int z,
IrisProceduralObjects proceduralObjects,
String scope,
IrisCaveProfile caveProfile,
CaveProfile caveProfile,
String expectedCaveBiomeKey
) {
if (proceduralObjects == null || proceduralObjects.isEmpty()) {
@@ -427,9 +427,9 @@ public class ObjectPlacing {
IrisObjectPlacement placement = p.asPlacement();
boolean carving = placement.getCarvingSupport() == CarvingMode.CARVING_ONLY;
IrisCaveAnchorMode anchorMode = resolveAnchorMode(placement, caveProfile);
CaveAnchorMode anchorMode = resolveAnchorMode(placement, caveProfile);
if (placement.getMode() == ObjectPlaceMode.CEILING_HANG) {
anchorMode = IrisCaveAnchorMode.CEILING;
anchorMode = CaveAnchorMode.CEILING;
}
int anchorScanStep = resolveAnchorScanStep(caveProfile);
int minDepthBelowSurface = resolveObjectMinDepthBelowSurface(caveProfile);
@@ -558,7 +558,7 @@ public class ObjectPlacing {
RNG rng,
int minX,
int minZ,
IrisCaveAnchorMode anchorMode,
CaveAnchorMode anchorMode,
int anchorScanStep,
int minDepthBelowSurface,
int searchAttempts,
@@ -774,7 +774,7 @@ public class ObjectPlacing {
int chunkX,
int chunkZ,
IrisObjectPlacement objectPlacement,
IrisCaveProfile caveProfile,
CaveProfile caveProfile,
IrisComplex complex,
boolean traceRegen,
int metricChunkX,
@@ -791,9 +791,9 @@ public class ObjectPlacing {
int minX = chunkX << 4;
int minZ = chunkZ << 4;
int density = objectPlacement.getDensity(rng, minX, minZ, engine.getData());
IrisCaveAnchorMode anchorMode = resolveAnchorMode(objectPlacement, caveProfile);
CaveAnchorMode anchorMode = resolveAnchorMode(objectPlacement, caveProfile);
if (objectPlacement.getMode() == ObjectPlaceMode.CEILING_HANG) {
anchorMode = IrisCaveAnchorMode.CEILING;
anchorMode = CaveAnchorMode.CEILING;
}
int anchorScanStep = resolveAnchorScanStep(caveProfile);
int objectMinDepthBelowSurface = resolveObjectMinDepthBelowSurface(caveProfile);
@@ -1092,9 +1092,9 @@ public class ObjectPlacing {
private IrisObjectRotation buildUpsideDownRotation() {
IrisObjectRotation rt = new IrisObjectRotation();
rt.setEnabled(true);
rt.setXAxis(new IrisAxisRotationClamp(true, true, 180D, 180D, 90D));
rt.setYAxis(new IrisAxisRotationClamp(true, false, 0D, 0D, 90D));
rt.setZAxis(new IrisAxisRotationClamp());
rt.setXAxis(AxisRotationClamp.of(true, true, 180D, 180D, 90D));
rt.setYAxis(AxisRotationClamp.of(true, false, 0D, 0D, 90D));
rt.setZAxis(new AxisRotationClamp());
return rt;
}
@@ -1107,7 +1107,7 @@ public class ObjectPlacing {
IrisObject object,
int densityIndex,
int density,
IrisCaveAnchorMode anchorMode,
CaveAnchorMode anchorMode,
int anchorSearchAttempts,
int anchorScanStep,
int objectMinDepthBelowSurface,
@@ -1208,13 +1208,13 @@ public class ObjectPlacing {
return effectivePlacement;
}
private IrisObjectPlacement resolveCavePlacement(IrisObjectPlacement objectPlacement, IrisObject object, IrisCaveProfile caveProfile) {
private IrisObjectPlacement resolveCavePlacement(IrisObjectPlacement objectPlacement, IrisObject object, CaveProfile caveProfile) {
IrisObjectPlacement resolvedPlacement = resolveEffectivePlacement(objectPlacement, object);
if (resolvedPlacement.getMode() != ObjectPlaceMode.CENTER_HEIGHT || caveProfile == null) {
return resolvedPlacement;
}
ObjectPlaceMode profileMode = caveProfile.getDefaultObjectPlaceMode();
ObjectPlaceMode profileMode = caveProfile.defaultObjectPlaceMode().orElse(null);
if (profileMode == null) {
return resolvedPlacement;
}
@@ -1237,7 +1237,7 @@ public class ObjectPlacing {
return maxAnchorY + 1;
}
private int findCaveAnchorY(MantleWriter writer, RNG rng, int x, int z, IrisCaveAnchorMode anchorMode, int anchorScanStep, int objectMinDepthBelowSurface, CaveAnchorCache anchorCache) {
private int findCaveAnchorY(MantleWriter writer, RNG rng, int x, int z, CaveAnchorMode anchorMode, int anchorScanStep, int objectMinDepthBelowSurface, CaveAnchorCache anchorCache) {
KList<Integer> anchors = anchorCache.get(writer, anchorMode, anchorScanStep, objectMinDepthBelowSurface, x, z);
if (anchors.isEmpty()) {
return -1;
@@ -1250,7 +1250,7 @@ public class ObjectPlacing {
return anchors.get(rng.i(anchors.size()));
}
private KList<Integer> scanCaveAnchorColumn(MantleWriter writer, IrisCaveAnchorMode anchorMode, int anchorScanStep, int objectMinDepthBelowSurface, int x, int z, CaveAnchorCache anchorCache) {
private KList<Integer> scanCaveAnchorColumn(MantleWriter writer, CaveAnchorMode anchorMode, int anchorScanStep, int objectMinDepthBelowSurface, int x, int z, CaveAnchorCache anchorCache) {
int height = engine.getHeight();
int step = Math.max(1, anchorScanStep);
int surfaceY = anchorCache.getSurfaceHeight(x, z);
@@ -1264,7 +1264,7 @@ public class ObjectPlacing {
return scanCaveAnchorRange(anchorMode, step, carvedHeight, BEDROCK_CLEARANCE, maxAnchorExclusive, carvedColumn);
}
private KList<Integer> scanCaveAnchorRange(IrisCaveAnchorMode anchorMode, int step, int height, int minAnchorY, int maxAnchorY, byte[] carvedColumn) {
private KList<Integer> scanCaveAnchorRange(CaveAnchorMode anchorMode, int step, int height, int minAnchorY, int maxAnchorY, byte[] carvedColumn) {
KList<Integer> anchors = new KList<>();
int startY = alignAnchorScanStart(minAnchorY, step);
for (int y = startY; y < maxAnchorY; y += step) {
@@ -1308,7 +1308,7 @@ public class ObjectPlacing {
return false;
}
private boolean matchesCaveAnchor(IrisCaveAnchorMode anchorMode, boolean solidBelow, boolean solidAbove) {
private boolean matchesCaveAnchor(CaveAnchorMode anchorMode, boolean solidBelow, boolean solidAbove) {
return switch (anchorMode) {
case PROFILE_DEFAULT, FLOOR -> solidBelow;
case CEILING -> solidAbove;
@@ -1317,13 +1317,13 @@ public class ObjectPlacing {
};
}
private IrisCaveProfile resolveCaveProfile(IrisCaveProfile preferred, IrisCaveProfile secondary) {
IrisCaveProfile dimensionProfile = engine.getDimension().getCaveProfile();
if (preferred != null && preferred.isEnabled()) {
private CaveProfile resolveCaveProfile(CaveProfile preferred, CaveProfile secondary) {
CaveProfile dimensionProfile = engine.getDimension().getCaveProfile();
if (preferred != null && preferred.enabled()) {
return preferred;
}
if (secondary != null && secondary.isEnabled()) {
if (secondary != null && secondary.enabled()) {
return secondary;
}
@@ -1331,49 +1331,49 @@ public class ObjectPlacing {
return dimensionProfile;
}
return new IrisCaveProfile();
return new CaveProfile();
}
private IrisCaveAnchorMode resolveAnchorMode(IrisObjectPlacement objectPlacement, IrisCaveProfile caveProfile) {
IrisCaveAnchorMode placementMode = objectPlacement.getCaveAnchorMode();
if (placementMode != null && !placementMode.equals(IrisCaveAnchorMode.PROFILE_DEFAULT)) {
private CaveAnchorMode resolveAnchorMode(IrisObjectPlacement objectPlacement, CaveProfile caveProfile) {
CaveAnchorMode placementMode = objectPlacement.getCaveAnchorMode();
if (placementMode != null && !placementMode.equals(CaveAnchorMode.PROFILE_DEFAULT)) {
return placementMode;
}
if (caveProfile == null) {
return IrisCaveAnchorMode.FLOOR;
return CaveAnchorMode.FLOOR;
}
IrisCaveAnchorMode profileMode = caveProfile.getDefaultObjectAnchor();
if (profileMode == null || profileMode.equals(IrisCaveAnchorMode.PROFILE_DEFAULT)) {
return IrisCaveAnchorMode.FLOOR;
CaveAnchorMode profileMode = caveProfile.defaultObjectAnchor();
if (profileMode == null || profileMode.equals(CaveAnchorMode.PROFILE_DEFAULT)) {
return CaveAnchorMode.FLOOR;
}
return profileMode;
}
private int resolveAnchorScanStep(IrisCaveProfile caveProfile) {
private int resolveAnchorScanStep(CaveProfile caveProfile) {
if (caveProfile == null) {
return 1;
}
return Math.max(1, caveProfile.getAnchorScanStep());
return Math.max(1, caveProfile.anchorScanStep());
}
private int resolveObjectMinDepthBelowSurface(IrisCaveProfile caveProfile) {
private int resolveObjectMinDepthBelowSurface(CaveProfile caveProfile) {
if (caveProfile == null) {
return 6;
}
return Math.max(0, caveProfile.getObjectMinDepthBelowSurface());
return Math.max(0, caveProfile.objectMinDepthBelowSurface());
}
private int resolveAnchorSearchAttempts(IrisCaveProfile caveProfile) {
private int resolveAnchorSearchAttempts(CaveProfile caveProfile) {
if (caveProfile == null) {
return 6;
}
return Math.max(1, caveProfile.getAnchorSearchAttempts());
return Math.max(1, caveProfile.anchorSearchAttempts());
}
private boolean isRegenTraceThread() {
@@ -1542,8 +1542,8 @@ public class ObjectPlacing {
int height = scaledDimension(size.getBlockY(), scale);
int depth = scaledDimension(size.getBlockZ(), scale);
IrisObjectRotation rotation = placement.getRotation();
boolean rotateX = rotation != null && rotation.isEnabled() && rotation.getXAxis() != null && rotation.getXAxis().isEnabled();
boolean rotateZ = rotation != null && rotation.isEnabled() && rotation.getZAxis() != null && rotation.getZAxis().isEnabled();
boolean rotateX = rotation != null && rotation.isEnabled() && rotation.getXAxis() != null && rotation.getXAxis().enabled();
boolean rotateZ = rotation != null && rotation.isEnabled() && rotation.getZAxis() != null && rotation.getZAxis().enabled();
int footprint = rotateX || rotateZ ? Math.max(width, Math.max(height, depth)) : Math.max(width, depth);
int translation = calculateTranslationReach(placement.getTranslate(), rotation, rotateX || rotateZ);
int warp = placement.getWarp() != null && !placement.getWarp().isFlat()
@@ -1574,7 +1574,7 @@ public class ObjectPlacing {
if (rotateVertically) {
return (int) Math.ceil(Math.sqrt((x * x) + (y * y) + (z * z)));
}
boolean rotateY = rotation != null && rotation.isEnabled() && rotation.getYAxis() != null && rotation.getYAxis().isEnabled();
boolean rotateY = rotation != null && rotation.isEnabled() && rotation.getYAxis() != null && rotation.getYAxis().enabled();
return rotateY ? (int) Math.ceil(Math.hypot(x, z)) : (int) Math.max(Math.abs(x), Math.abs(z));
}
@@ -1602,7 +1602,7 @@ public class ObjectPlacing {
this.surfaceHeights.defaultReturnValue(Integer.MIN_VALUE);
}
private KList<Integer> get(MantleWriter writer, IrisCaveAnchorMode anchorMode, int anchorScanStep, int objectMinDepthBelowSurface, int x, int z) {
private KList<Integer> get(MantleWriter writer, CaveAnchorMode anchorMode, int anchorScanStep, int objectMinDepthBelowSurface, int x, int z) {
if (anchorScanStep > 65535 || objectMinDepthBelowSurface > 65535) {
return scanCaveAnchorColumn(writer, anchorMode, anchorScanStep, objectMinDepthBelowSurface, x, z, this);
}
@@ -18,6 +18,7 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.engine.framework.structure.StructureResources;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.core.IrisSettings;
@@ -34,7 +35,6 @@ import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.placement.ObjectPlaceMode;
import art.arcane.iris.engine.object.world.region.IrisRegion;
import art.arcane.iris.engine.object.structure.IrisStructure;
import art.arcane.iris.engine.object.structure.IrisStructureCarveShape;
@@ -18,6 +18,9 @@
package art.arcane.iris.engine.modifier;
import art.arcane.iris.builtin.carve.CaveFieldModule;
import art.arcane.iris.builtin.carve.CaveProfile;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.core.modules.IrisChunk;
import art.arcane.iris.core.modules.IrisMantleChunk;
@@ -46,6 +49,12 @@ public final class CarveModule implements IrisModule {
return ModuleInfo.of("iris:carve", "Caves", VERSION);
}
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(CaveProfile.class);
registry.registerHeldType(CaveFieldModule.class);
}
@Override
public void install(StageGraph graph) {
graph.define(IrisStages.Carve.CAVES).reach(CAVE_REACH_BLOCKS).run(CarveModule::planCaves);
@@ -19,6 +19,9 @@
package art.arcane.iris.engine.modifier;
import art.arcane.iris.engine.object.terrain.floating.ResolvedFloatingChild;
import art.arcane.iris.builtin.floating.FloatingBottomPaletteMode;
import art.arcane.iris.builtin.prepare.SlopeClip;
import art.arcane.iris.engine.object.world.biome.custom.IrisBiomeCustom;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.IrisComplex;
@@ -26,15 +29,12 @@ import art.arcane.iris.engine.decorator.FloatingDecorator;
import art.arcane.iris.engine.decorator.IrisSeaSurfaceDecorator;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.framework.EngineDecorator;
import art.arcane.iris.engine.object.terrain.floating.FloatingBottomPaletteMode;
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandBoundarySampler;
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
import art.arcane.iris.engine.object.decoration.IrisDecorationPart;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.engine.object.terrain.floating.IrisFloatingChildBiomes;
import art.arcane.iris.engine.object.placement.IrisSlopeClip;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.util.common.data.B;
import art.arcane.iris.util.project.context.ChunkContext;
@@ -65,11 +65,11 @@ public class FloatingIslands {
private final RNG rng;
private final EngineDecorator seaSurfaceDecorator;
private static KList<PlatformBlockState> generateBottomPaletteLayers(IrisFloatingChildBiomes entry, IrisDimension dimension, double wx, double wz, RNG random, int paletteDepth, IrisData data, IrisComplex complex) {
if (entry == null || entry.getBottomPaletteMode() != FloatingBottomPaletteMode.CUSTOM || entry.getBottomPalette() == null || entry.getBottomPalette().isEmpty()) {
private static KList<PlatformBlockState> generateBottomPaletteLayers(ResolvedFloatingChild entry, IrisDimension dimension, double wx, double wz, RNG random, int paletteDepth, IrisData data, IrisComplex complex) {
if (entry == null || entry.settings().bottomPaletteMode() != FloatingBottomPaletteMode.CUSTOM || entry.settings().bottomPalette() == null || entry.settings().bottomPalette().isEmpty()) {
return null;
}
return generatePaletteLayers(dimension, entry.getBottomPalette(), wx, wz, random.nextParallelRNG(0xB0770B), paletteDepth, data, complex);
return generatePaletteLayers(dimension, new KList<>(entry.settings().bottomPalette()), wx, wz, random.nextParallelRNG(0xB0770B), paletteDepth, data, complex);
}
private static KList<PlatformBlockState> generatePaletteLayers(IrisDimension dimension, KList<IrisBiomePaletteLayer> layers, double wx, double wz, RNG random, int maxDepth, IrisData data, IrisComplex complex) {
@@ -86,7 +86,7 @@ public class FloatingIslands {
continue;
}
double layerDepth = heightGenerator.fit(layer.getMinHeight(), layer.getMaxHeight(), wx / layer.getZoom(), wz / layer.getZoom());
IrisSlopeClip slopeClip = layer.getSlopeCondition();
SlopeClip slopeClip = layer.getSlopeCondition();
if (slopeClip != null && !slopeClip.isDefault() && complex != null && !slopeClip.isValid(complex.getSlopeStream().get(wx, wz))) {
layerDepth = 0;
@@ -127,8 +127,8 @@ public class FloatingIslands {
return generated;
}
private static boolean usesBottomPalette(IrisFloatingChildBiomes entry) {
FloatingBottomPaletteMode mode = entry == null || entry.getBottomPaletteMode() == null ? FloatingBottomPaletteMode.DEPTH : entry.getBottomPaletteMode();
private static boolean usesBottomPalette(ResolvedFloatingChild entry) {
FloatingBottomPaletteMode mode = entry == null || entry.settings().bottomPaletteMode() == null ? FloatingBottomPaletteMode.DEPTH : entry.settings().bottomPaletteMode();
return mode != FloatingBottomPaletteMode.DEPTH;
}
@@ -138,7 +138,7 @@ public class FloatingIslands {
bottomDepths[i] = -1;
}
IdentityHashMap<IrisFloatingChildBiomes, Integer> depthByEntry = new IdentityHashMap<>();
IdentityHashMap<ResolvedFloatingChild, Integer> depthByEntry = new IdentityHashMap<>();
int max = Math.min(sample.topIdx, sample.solidMask.length - 1);
for (int k = 0; k <= max; k++) {
if (!sample.solidMask[k]) {
@@ -148,7 +148,7 @@ public class FloatingIslands {
if (y < 0 || y >= chunkHeight) {
continue;
}
IrisFloatingChildBiomes entry = sample.entryAt(k);
ResolvedFloatingChild entry = sample.entryAt(k);
int depth = depthByEntry.getOrDefault(entry, 0);
bottomDepths[k] = depth;
depthByEntry.put(entry, depth + 1);
@@ -157,8 +157,8 @@ public class FloatingIslands {
return bottomDepths;
}
private static PlatformBlockState selectPaletteBlock(IrisFloatingChildBiomes entry, KList<PlatformBlockState> topBlocks, KList<PlatformBlockState> bottomBlocks, int topDepth, int bottomDepth, PlatformBlockState fallbackSolid) {
FloatingBottomPaletteMode mode = entry == null || entry.getBottomPaletteMode() == null ? FloatingBottomPaletteMode.DEPTH : entry.getBottomPaletteMode();
private static PlatformBlockState selectPaletteBlock(ResolvedFloatingChild entry, KList<PlatformBlockState> topBlocks, KList<PlatformBlockState> bottomBlocks, int topDepth, int bottomDepth, PlatformBlockState fallbackSolid) {
FloatingBottomPaletteMode mode = entry == null || entry.settings().bottomPaletteMode() == null ? FloatingBottomPaletteMode.DEPTH : entry.settings().bottomPaletteMode();
if (mode == FloatingBottomPaletteMode.MIRROR_TOP) {
return paletteBlock(topBlocks, Math.min(topDepth, bottomDepth), fallbackSolid);
}
@@ -179,9 +179,9 @@ public class FloatingIslands {
return block == null ? fallbackSolid : block;
}
private PaletteContext createPaletteContext(IrisBiome parent, IrisFloatingChildBiomes entry, IrisDimension dimension, int wx, int wz, long colSeed, int paletteDepth, IrisData data, IrisComplex complex) {
private PaletteContext createPaletteContext(IrisBiome parent, ResolvedFloatingChild entry, IrisDimension dimension, int wx, int wz, long colSeed, int paletteDepth, IrisData data, IrisComplex complex) {
IrisBiome target = entry == null ? parent : entry.getRealBiome(parent, data);
int entrySeed = entry == null || entry.getBiome() == null ? 0 : entry.getBiome().hashCode();
int entrySeed = entry == null || entry.settings().biome() == null ? 0 : entry.settings().biome().hashCode();
RNG layerRng = rng.nextParallelRNG((int) (colSeed ^ 0x7A4E ^ entrySeed));
KList<PlatformBlockState> topBlocks = target == null ? null : target.generateLayers(dimension, wx, wz, layerRng, paletteDepth, paletteDepth, data, complex);
if (topBlocks == null || topBlocks.isEmpty()) {
@@ -235,8 +235,8 @@ public class FloatingIslands {
long colSeed = FloatingIslandSample.columnSeed(baseSeed, wx, wz);
int paletteDepth = Math.max(4, sample.solidCount + 4);
IdentityHashMap<IrisFloatingChildBiomes, PaletteContext> paletteContexts = new IdentityHashMap<>();
IdentityHashMap<IrisFloatingChildBiomes, Integer> topDepthByEntry = new IdentityHashMap<>();
IdentityHashMap<ResolvedFloatingChild, PaletteContext> paletteContexts = new IdentityHashMap<>();
IdentityHashMap<ResolvedFloatingChild, Integer> topDepthByEntry = new IdentityHashMap<>();
int[] bottomDepths = bottomDepths(sample, chunkHeight);
for (int k = sample.topIdx; k >= 0; k--) {
if (!sample.solidMask[k]) {
@@ -246,7 +246,7 @@ public class FloatingIslands {
if (y < 0 || y >= chunkHeight) {
continue;
}
IrisFloatingChildBiomes entry = sample.entryAt(k);
ResolvedFloatingChild entry = sample.entryAt(k);
PaletteContext paletteContext = paletteContexts.get(entry);
if (paletteContext == null) {
paletteContext = createPaletteContext(parent, entry, dimension, wx, wz, colSeed, paletteDepth, data, complex);
@@ -261,10 +261,10 @@ public class FloatingIslands {
topDepthByEntry.put(entry, depth + 1);
}
IrisFloatingChildBiomes entry = sample.entry;
Integer localFluidHeight = entry.getLocalFluidHeight();
if (localFluidHeight != null && localFluidHeight > 0) {
PlatformBlockState fluid = B.getStateOrNull(entry.getFluidBlock());
ResolvedFloatingChild entry = sample.entry;
int localFluidHeight = entry.settings().localFluidHeight().orElse(0);
if (localFluidHeight > 0) {
PlatformBlockState fluid = B.getStateOrNull(entry.settings().fluidBlock());
if (fluid == null) {
fluid = B.getState("minecraft:water");
}
@@ -317,10 +317,10 @@ public class FloatingIslands {
if (sample == null) {
continue;
}
IrisFloatingChildBiomes entry = sample.entry;
ResolvedFloatingChild entry = sample.entry;
IrisBiome target = entry.getRealBiome(parent, data);
if (!entry.isInheritDecorators() || target == null) {
if (!entry.settings().inheritDecorators() || target == null) {
continue;
}
@@ -338,8 +338,8 @@ public class FloatingIslands {
}
}
Integer localFluidHeight = entry.getLocalFluidHeight();
if (localFluidHeight != null && localFluidHeight > 0) {
int localFluidHeight = entry.settings().localFluidHeight().orElse(0);
if (localFluidHeight > 0) {
int fluidCap = Math.min(sample.thickness - 1, localFluidHeight);
int fluidTopY = -1;
for (int k = 1; k <= fluidCap; k++) {
@@ -375,7 +375,7 @@ public class FloatingIslands {
private void writeIslandSkyBiomes(IrisBiome parent, int wx, int wz, FloatingIslandSample sample, int chunkHeight, IrisData data) {
try {
IdentityHashMap<IrisFloatingChildBiomes, MatterBiomeInject> matterByEntry = new IdentityHashMap<>();
IdentityHashMap<ResolvedFloatingChild, MatterBiomeInject> matterByEntry = new IdentityHashMap<>();
for (int k = 0; k <= sample.topIdx; k++) {
if (!sample.solidMask[k]) {
continue;
@@ -384,7 +384,7 @@ public class FloatingIslands {
if (y < 0 || y >= chunkHeight) {
continue;
}
IrisFloatingChildBiomes entry = sample.entryAt(k);
ResolvedFloatingChild entry = sample.entryAt(k);
MatterBiomeInject matter = matterByEntry.get(entry);
if (matter == null) {
IrisBiome target = entry == null ? parent : entry.getRealBiome(parent, data);
@@ -18,6 +18,8 @@
package art.arcane.iris.engine.modifier;
import art.arcane.iris.builtin.floating.FloatingChildBiome;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.core.modules.IrisChunk;
import art.arcane.iris.core.modules.IrisMantleChunk;
@@ -46,6 +48,11 @@ public final class FloatingModule implements IrisModule {
return ModuleInfo.of("iris:floating", "Floating islands", VERSION);
}
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(FloatingChildBiome.class);
}
@Override
public void install(StageGraph graph) {
graph.define(IrisStages.Floating.OBJECTS).softAfter(IrisStages.Objects.PLACE.ref()).reach(FloatingModule::objectReach)
@@ -18,12 +18,12 @@
package art.arcane.iris.engine.modifier;
import art.arcane.iris.builtin.prepare.SlopeClip;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.mantle.EngineMantle;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.engine.object.placement.IrisSlopeClip;
import art.arcane.iris.util.project.context.ChunkContext;
import art.arcane.iris.util.common.data.B;
import art.arcane.iris.util.project.hunk.Hunk;
@@ -210,7 +210,7 @@ public class SurfaceSmoothing {
|| (hd == h + 1 && isSolidNonSlab(x, hd, z - 1, originX, originZ, currentData)))
//@done
{
IrisSlopeClip sc = biome.getSlab().getSlopeCondition();
SlopeClip sc = biome.getSlab().getSlopeCondition();
PlatformBlockState d = sc.isValid(engine.getComplex().getSlopeStream().get(x, z)) ? biome.getSlab().get(rng, x, h, z, engine.getData()) : null;
if (d != null) {
@@ -18,10 +18,10 @@
package art.arcane.iris.engine.object.decoration;
import art.arcane.iris.builtin.prepare.SlopeClip;
import art.arcane.iris.engine.object.material.IrisBlockData;
import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
import art.arcane.iris.engine.object.noise.NoiseStyle;
import art.arcane.iris.engine.object.placement.IrisSlopeClip;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
@@ -71,7 +71,7 @@ public class IrisDecorator {
@Desc("When set, the decorator will never place onto any of these blocks.")
private KList<IrisBlockData> blacklist;
@Desc("The slope at which this decorator can be placed. Range from 0 to 10 by default. Calculated from a 3-block radius from the center of the decorator placement.")
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
private SlopeClip slopeCondition = new SlopeClip();
@DependsOn({"scaleStack", "stackMin", "stackMax"})
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
private int absoluteMaxStack = 30;
@@ -18,7 +18,7 @@
package art.arcane.iris.engine.object.mod;
import art.arcane.iris.engine.object.placement.IrisObjectReplace;
import art.arcane.iris.builtin.blocks.ObjectReplace;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.world.region.IrisRegion;
@@ -100,9 +100,9 @@ public class IrisMod extends IrisRegistrant {
@Desc("Replace regions with other regions")
private KList<IrisModRegionReplacer> regionReplacers = new KList<>();
@ArrayType(min = 1, type = IrisObjectReplace.class)
@ArrayType(min = 1, type = ObjectReplace.class)
@Desc("Replace blocks with other blocks")
private KList<IrisObjectReplace> blockReplacers = new KList<>();
private KList<ObjectReplace> blockReplacers = new KList<>();
@ArrayType(min = 1, type = IrisModNoiseStyleReplacer.class)
@Desc("Replace noise styles with other styles")
@@ -18,11 +18,12 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.builtin.anchor.AnchorHeight;
import art.arcane.iris.core.modules.IrisPlacement;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import com.volmit.IrisModule;
import com.volmit.ModuleInfo;
import com.volmit.stage.PlacementStageContext;
@@ -19,6 +19,10 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.engine.spawn.SpawnResources;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.blocks.ObjectReplace;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.builtin.blocks.ObjectMarkers;
import art.arcane.iris.builtin.blocks.WrittenBlocks;
@@ -30,7 +34,6 @@ import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectShaping;
import art.arcane.iris.engine.object.prefab.TileData;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.util.common.data.B;
import art.arcane.volmlib.util.collection.KList;
@@ -66,6 +69,11 @@ public final class BlocksModule implements IrisModule {
return ModuleInfo.of("iris:blocks", "Object blocks", PlacementModules.VERSION);
}
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(ObjectReplace.class);
}
@Override
public void install(StageGraph graph) {
graph.define(IrisStages.Blocks.WRITE)
@@ -19,6 +19,14 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.engine.loot.LootResources;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.carve.CaveAnchorMode;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.blocks.ObjectReplace;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.prepare.SlopeClip;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.validate.ObjectLimit;
import art.arcane.iris.core.modules.ModuleSettings;
import art.arcane.iris.engine.object.loot.IObjectLoot;
import art.arcane.iris.engine.object.loot.IrisLootTable;
@@ -34,8 +42,6 @@ import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectScale;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.engine.object.terrain.carving.IrisCaveAnchorMode;
import art.arcane.iris.platform.bukkit.BukkitBlockResolution;
import art.arcane.iris.core.loader.IrisData;
@@ -97,7 +103,7 @@ public class IrisObjectPlacement {
@Desc("Rotate this objects placement")
private IrisObjectRotation rotation = new IrisObjectRotation();
@Desc("Limit the max height or min height of placement.")
private IrisObjectLimit clamp = new IrisObjectLimit();
private ObjectLimit clamp = new ObjectLimit();
@MinNumber(0)
@MaxNumber(1)
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
@@ -105,7 +111,7 @@ public class IrisObjectPlacement {
@Desc("Whether or not this object can be targeted by a dolphin.")
private boolean isDolphinTarget = false;
@Desc("The slope at which this object can be placed. Range from 0 to 10 by default. Calculated from a 3-block radius from the center of the object placement.")
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
private SlopeClip slopeCondition = new SlopeClip();
@Desc("Set to true to add the rotation of the direction of the slope of the terrain (wherever the slope is going down) to the y-axis rotation of the object." +
"Rounded to 90 degrees. Adds the *min* rotation of the y axis as well (to still allow you to rotate objects nicely). Discards *max* and *interval* on *yaxis*")
private boolean rotateTowardsSlope = false;
@@ -119,9 +125,9 @@ public class IrisObjectPlacement {
@Desc("If the chance check passes, and you specify this, it picks a number in the range based on noise, and 'density' is ignored.")
private IrisStyledRange densityStyle = null;
@Desc("When stilting is enabled, this object will define various properties related to it.")
private IrisStiltSettings stiltSettings;
private StiltSettings stiltSettings;
@Desc("When a VACUUM place mode is used, this defines the deformation radius and falloff.")
private IrisVacuumSettings vacuumSettings;
private VacuumSettings vacuumSettings;
@MaxNumber(64)
@MinNumber(0)
@Desc("When bore is enabled, expand max-y of the cuboid it removes")
@@ -148,7 +154,7 @@ public class IrisObjectPlacement {
@Desc("Set to false to let this placement sit over carved surface openings such as cave entrances.")
private boolean requireSurfaceSupport = true;
@Desc("When carving placement is enabled, select which carved-space anchor this placement targets.")
private IrisCaveAnchorMode caveAnchorMode = IrisCaveAnchorMode.PROFILE_DEFAULT;
private CaveAnchorMode caveAnchorMode = CaveAnchorMode.PROFILE_DEFAULT;
@Desc("If this is defined, this object wont place on the terrain heightmap, but instead on this virtual heightmap")
private IrisNoiseGenerator heightmap;
@Desc("If set to true, Iris will try to fill the insides of 'rooms' and 'pockets' where air should fit based off of raytrace checks. This prevents a village house placing in an area where a tree already exists, and instead replaces the parts of the tree where the interior of the structure is. \n\nThis operation does not affect warmed-up generation speed however it does slow down loading objects.")
@@ -169,9 +175,9 @@ public class IrisObjectPlacement {
private IrisGeneratorStyle warp = new IrisGeneratorStyle(NoiseStyle.FLAT);
@Desc("The placement mode")
private ObjectPlaceMode mode = ObjectPlaceMode.CENTER_HEIGHT;
@ArrayType(min = 1, type = IrisObjectReplace.class)
@ArrayType(min = 1, type = ObjectReplace.class)
@Desc("Find and replace blocks")
private KList<IrisObjectReplace> edit = new KList<>();
private KList<ObjectReplace> edit = new KList<>();
@Desc("Translate this object's placement")
private IrisObjectTranslate translate = new IrisObjectTranslate();
@Desc("Scale Objects")
@@ -1,84 +0,0 @@
/*
* 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.engine.object.placement;
import art.arcane.iris.engine.object.material.IrisBlockData;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.annotations.ArrayType;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Required;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import art.arcane.iris.util.project.noise.CNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import art.arcane.iris.spi.PlatformBlockState;
import lombok.experimental.Accessors;
@Snippet("object-block-replacer")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Find and replace object materials")
@Data
public class IrisObjectReplace {
private final transient AtomicCache<CNG> replaceGen = new AtomicCache<>();
private final transient AtomicCache<KList<PlatformBlockState>> findData = new AtomicCache<>();
private final transient AtomicCache<KList<PlatformBlockState>> replaceData = new AtomicCache<>();
@ArrayType(min = 1, type = IrisBlockData.class)
@Required
@Desc("Find this block")
private KList<IrisBlockData> find = new KList<>();
@Required
@Desc("Replace it with this block palette")
private IrisMaterialPalette replace = new IrisMaterialPalette();
@Desc("Exactly match the block data or not")
private boolean exact = false;
@MinNumber(0)
@MaxNumber(1)
@Desc("Modifies the chance the block is replaced")
private float chance = 1;
public KList<PlatformBlockState> getFind(IrisData rdata) {
return findData.aquire(() ->
{
KList<PlatformBlockState> b = new KList<>();
for (IrisBlockData i : find) {
PlatformBlockState bx = i.getBlockData(rdata);
if (bx != null) {
b.add(bx);
}
}
return b;
});
}
public PlatformBlockState getReplace(RNG seed, double x, double y, double z, IrisData rdata) {
return getReplace().get(seed, x, y, z, rdata);
}
}
@@ -18,6 +18,9 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
public final class IrisObjectVacuum {
private static final double DEFAULT_WAVE_AMPLITUDE = 3.0;
private static final double DEFAULT_WAVE_SCALE = 5.0;
@@ -28,21 +31,17 @@ public final class IrisObjectVacuum {
}
public static boolean isVacuumMode(ObjectPlaceMode mode) {
return mode == ObjectPlaceMode.VACUUM
|| mode == ObjectPlaceMode.VACUUM_HIGH
|| mode == ObjectPlaceMode.VACUUM_FAST
|| mode == ObjectPlaceMode.VACUUM_ORGANIC
|| mode == ObjectPlaceMode.VACUUM_WAVY;
return mode != null && mode.isVacuum();
}
public static int resolveRadius(ObjectPlaceMode mode, IrisVacuumSettings settings) {
public static int resolveRadius(ObjectPlaceMode mode, VacuumSettings settings) {
int radius = switch (mode) {
case VACUUM_HIGH -> 20;
case VACUUM_FAST -> 8;
default -> 12;
};
if (settings != null && settings.getRadius() > 0) {
radius = settings.getRadius();
if (settings != null && settings.radius() > 0) {
radius = settings.radius();
}
return Math.max(0, Math.min(MAX_RADIUS_BLOCKS, radius));
}
@@ -51,22 +50,22 @@ public final class IrisObjectVacuum {
return mode == ObjectPlaceMode.VACUUM_FAST ? 2 : 1;
}
public static double resolveFalloff(IrisVacuumSettings settings) {
return settings != null ? Math.max(0.25, settings.getFalloff()) : 2.0;
public static double resolveFalloff(VacuumSettings settings) {
return settings != null ? Math.max(0.25, settings.falloff()) : 2.0;
}
public static double resolveWaveAmplitude(IrisVacuumSettings settings) {
public static double resolveWaveAmplitude(VacuumSettings settings) {
if (settings == null) {
return DEFAULT_WAVE_AMPLITUDE;
}
return Math.max(0, settings.getWaveAmplitude());
return Math.max(0, settings.waveAmplitude());
}
public static double resolveWaveScale(IrisVacuumSettings settings) {
public static double resolveWaveScale(VacuumSettings settings) {
if (settings == null) {
return DEFAULT_WAVE_SCALE;
}
double scale = settings.getWaveScale();
double scale = settings.waveScale();
return scale > 0 ? scale : DEFAULT_WAVE_SCALE;
}
@@ -1,47 +0,0 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.MaxNumber;
import art.arcane.iris.engine.object.annotations.MinNumber;
import art.arcane.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("stilt-settings")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Defines stilting behaviour.")
@Data
public class IrisStiltSettings {
@MinNumber(0)
@MaxNumber(64)
@Desc("Defines the maximum amount of blocks the object stilts verticially before overstilting and randomRange.")
private int yMax;
@MinNumber(0)
@MaxNumber(64)
@Desc("Defines the upper boundary for additional blocks after overstilting and/or maxStiltRange.")
private int yRand;
@MaxNumber(64)
@MinNumber(0)
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
private int overStilt;
@Desc("If defined, stilting will be done using this block palette rather than the last layer of the object.")
private IrisMaterialPalette palette;
@MinNumber(1)
@MaxNumber(256)
@Desc("For ORGANIC_STILT / CEILING_HANG: the maximum number of blocks to scan toward the cave floor (or ceiling) looking for solid ground before giving up.")
private int organicMaxScan = 48;
@MinNumber(0)
@MaxNumber(32)
@Desc("For ORGANIC_STILT / CEILING_HANG: the maximum number of blocks each column's stilt is randomly shortened by, giving the underside a ragged organic edge instead of a flat disc.")
private int organicJitter = 3;
@MinNumber(0)
@MaxNumber(1)
@Desc("For ORGANIC_STILT / CEILING_HANG: in the deepest fraction of each stilt column, blocks are randomly skipped to break the tip up. Higher = more broken and scratchy. 0 disables.")
private double organicScratch = 0.55;
}
@@ -18,6 +18,7 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.blocks.ObjectReplace;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.material.BlockDataMergeSupport;
import art.arcane.iris.engine.object.prefab.IrisObjectShaping;
@@ -37,25 +38,27 @@ final class ObjectEdits {
/** {@code tile} may be null; the result's tile is the last replacement's tile, if it has one. */
static Edited apply(IrisObjectPlacement config, PlatformBlockState data, TileData tile, RNG rng,
double x, double y, double z, IrisData rdata) {
ResolvedReplaces replaces = ResolvedReplaces.of(rdata);
PlatformBlockState edited = data;
TileData editedTile = tile;
for (IrisObjectReplace replace : config.getEdit()) {
if (!rng.chance(replace.getChance())) {
for (ObjectReplace settings : config.getEdit()) {
ResolvedReplace replace = replaces.of(settings);
if (!rng.chance(replace.chance())) {
continue;
}
for (PlatformBlockState find : replace.getFind(rdata)) {
for (PlatformBlockState find : replace.find()) {
if (!finds(replace, find, edited)) {
continue;
}
edited = replaced(edited, replace.getReplace(rng, x, y, z, rdata));
editedTile = replace.getReplace().getTile(rng, x, y, z, rdata).orElse(editedTile);
edited = replaced(edited, replace.replacement(rng, x, y, z));
editedTile = replace.tile(rng).orElse(editedTile);
}
}
return new Edited(edited, editedTile);
}
private static boolean finds(IrisObjectReplace replace, PlatformBlockState find, PlatformBlockState data) {
return replace.isExact()
private static boolean finds(ResolvedReplace replace, PlatformBlockState find, PlatformBlockState data) {
return replace.exact()
? find.matches(data)
: IrisObjectShaping.materialKey(find).equals(IrisObjectShaping.materialKey(data));
}
@@ -1,6 +1,6 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.engine.object.prefab.IrisAxisRotationClamp;
import art.arcane.iris.builtin.prepare.AxisRotationClamp;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.util.common.math.IrisBlockVector;
@@ -55,20 +55,20 @@ import art.arcane.iris.util.common.math.IrisBlockVector;
ySin = Math.sin(yAngle);
}
private static int modeOf(IrisAxisRotationClamp clamp) {
private static int modeOf(AxisRotationClamp clamp) {
if (!clamp.isLocked()) {
return MODE_ANGLE;
}
if (Math.abs(clamp.getMax()) % 360D == 180D) {
if (Math.abs(clamp.max()) % 360D == 180D) {
return MODE_FLIP;
}
if (clamp.getMax() % 360D == 90D || clamp.getMax() % 360D == -270D) {
if (clamp.max() % 360D == 90D || clamp.max() % 360D == -270D) {
return MODE_QUARTER;
}
if (clamp.getMax() == -90D || clamp.getMax() % 360D == 270D) {
if (clamp.max() == -90D || clamp.max() % 360D == 270D) {
return MODE_THREE_QUARTER;
}
@@ -18,11 +18,14 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.prepare.SlopeClip;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.prepare.AxisRotationClamp;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.core.modules.IrisPlacement;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.framework.placer.HeightmapObjectPlacer;
import art.arcane.iris.engine.object.prefab.IrisAxisRotationClamp;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
@@ -52,6 +55,12 @@ public final class PrepareModule implements IrisModule {
return ModuleInfo.of("iris:prepare", "Placement preparation", PlacementModules.VERSION);
}
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(SlopeClip.class);
registry.registerHeldType(AxisRotationClamp.class);
}
@Override
public void install(StageGraph graph) {
graph.define(IrisStages.Prepare.SLOPE).produce(PrepareModule::slope);
@@ -89,15 +98,15 @@ public final class PrepareModule implements IrisModule {
double downhill = lowest == north ? NORTH : lowest == east ? EAST : lowest == south ? SOUTH : WEST;
IrisObjectRotation requested = config.getRotation();
double turn = requested.getYAxis().getMin() + downhill;
double turn = requested.getYAxis().min() + downhill;
IrisObjectRotation rotation = new IrisObjectRotation();
rotation.setXAxis(requested.getXAxis());
rotation.setZAxis(requested.getZAxis());
if (turn == 0) {
rotation.setYAxis(new IrisAxisRotationClamp(false, false, 0, 0, QUARTER_TURN));
rotation.setYAxis(AxisRotationClamp.of(false, false, 0, 0, QUARTER_TURN));
rotation.setEnabled(requested.canRotateX() || requested.canRotateZ());
} else {
rotation.setYAxis(new IrisAxisRotationClamp(true, false, turn, turn, QUARTER_TURN));
rotation.setYAxis(AxisRotationClamp.of(true, false, turn, turn, QUARTER_TURN));
rotation.setEnabled(true);
}
IrisObjectPlacement turned = config.toPlacement(config.getPlace().toArray(new String[0]));
@@ -18,6 +18,7 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.util.common.math.IrisBlockVector;
import art.arcane.iris.util.project.noise.CNG;
@@ -0,0 +1,94 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.blocks.ObjectReplace;
import art.arcane.iris.core.modules.BlockEntities;
import art.arcane.iris.engine.object.prefab.TileData;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.util.common.data.B;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.block.BlockRegistry;
import com.volmit.block.BlockSpec;
import com.volmit.block.PaletteSpec;
import com.volmit.object.BlockEntityData;
import java.util.List;
import java.util.Optional;
/**
* One {@link ObjectReplace} made ready for a pack: the blocks it finds resolved to the platform's, its palette
* picked through the pack's block registry with the seed of the {@link RNG} the placement hands in, and the tile
* data of the palette's entries resolved once. The old settings class cached the same things on itself.
*/
final class ResolvedReplace {
private final List<PlatformBlockState> find;
private final boolean exact;
private final float chance;
private final PaletteSpec replace;
private final BlockRegistry blocks;
private final List<Optional<BlockEntityData>> entryTiles;
private final int weightedSize;
ResolvedReplace(List<PlatformBlockState> find, boolean exact, float chance, PaletteSpec replace, BlockRegistry blocks) {
this.find = List.copyOf(find);
this.exact = exact;
this.chance = chance;
this.replace = replace;
this.blocks = blocks;
this.entryTiles = replace.palette().stream().map(blocks::blockEntity).toList();
this.weightedSize = replace.palette().stream().mapToInt(spec -> Math.max(0, spec.weight())).sum();
}
static ResolvedReplace of(ObjectReplace settings, BlockRegistry blocks) {
List<PlatformBlockState> find = settings.find().stream()
.map(spec -> B.getState(blocks.resolve(spec).key()))
.toList();
return new ResolvedReplace(find, settings.exact(), settings.chance(), settings.replace(), blocks);
}
float chance() {
return chance;
}
boolean exact() {
return exact;
}
List<PlatformBlockState> find() {
return find;
}
PlatformBlockState replacement(RNG rng, double x, double y, double z) {
return B.getState(blocks.palette(replace, rng.getSeed()).at(x, y, z).key());
}
/** The tile data of the entry picked for {@code rng}: the first entry when the palette's weights add up to one, else a uniform pick. */
Optional<TileData> tile(RNG rng) {
if (weightedSize == 0) {
return Optional.empty();
}
Optional<BlockEntityData> entity = entryTiles.get(weightedSize == 1 ? 0 : pickedEntry(rng));
return entity.map(BlockEntities::tileOf);
}
private int pickedEntry(RNG rng) {
return entryTiles.size() == 1 ? 0 : rng.nextInt(entryTiles.size());
}
}
@@ -0,0 +1,54 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.blocks.ObjectReplace;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.framework.Engine;
import com.volmit.block.BlockRegistry;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/** The {@link ResolvedReplace}s of one engine runtime, one per decoded {@link ObjectReplace}, built when a placement first uses it. */
final class ResolvedReplaces {
private final BlockRegistry blocks;
private final Map<ObjectReplace, ResolvedReplace> resolved = new ConcurrentHashMap<>();
ResolvedReplaces(Engine engine) {
this(engine.getData().getPackResources().blocks());
}
ResolvedReplaces(BlockRegistry blocks) {
this.blocks = blocks;
}
/** The replacements of the engine {@code data} serves, or of {@code data} alone when no engine runs it. */
static ResolvedReplaces of(IrisData data) {
Engine engine = data.getEngine();
if (engine == null) {
return new ResolvedReplaces(data.getPackResources().blocks());
}
return engine.getGeneration().state(ResolvedReplaces.class, ResolvedReplaces::new);
}
ResolvedReplace of(ObjectReplace settings) {
return resolved.computeIfAbsent(settings, replace -> ResolvedReplace.of(replace, blocks));
}
}
@@ -18,6 +18,9 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.anchor.StiltShape;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.builtin.stilt.StiltLayers;
import art.arcane.iris.core.modules.IrisPlacement;
@@ -64,6 +67,11 @@ public final class StiltModule implements IrisModule {
return ModuleInfo.of("iris:stilt", "Stilts", PlacementModules.VERSION);
}
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(StiltSettings.class);
}
@Override
public void install(StageGraph graph) {
graph.define(IrisStages.Stilt.LAYERS)
@@ -107,7 +115,8 @@ public final class StiltModule implements IrisModule {
private final IrisPlacement placement;
private final PreparedPlacement prepared;
private final IrisObjectPlacement config;
private final IrisStiltSettings settings;
private final StiltSettings settings;
private final PlatformBlockState palette;
private final StiltShape shape;
private final PlacementWorld world;
private final RNG rng;
@@ -124,10 +133,19 @@ public final class StiltModule implements IrisModule {
this.world = new PlacementWorld(context.access(), placement.states());
this.rng = new RNG(context.random().nextLong());
this.anchorY = context.output(IrisStages.Anchor.FINAL).y();
this.palette = settings == null ? null : paletteBlock(settings);
this.layerY = shape == StiltShape.CEILING ? layers.topY() : layers.bottomY();
this.erode = shape == StiltShape.ERODE ? ErodeShape.of(layers.bottom()) : null;
}
/** The block the settings' palette picks for this placement, the same for every column; null without a palette. */
private PlatformBlockState paletteBlock(StiltSettings stilt) {
return stilt.palette()
.map(spec -> placement.data().getPackResources().blocks().palette(spec, rng.getSeed()))
.map(picker -> B.getState(picker.at(placement.x(), anchorY, placement.z()).key()))
.orElse(null);
}
private void grow(ObjectBlock block) {
BlockPosition offset = block.position();
PlatformBlockState state = stiltState(block, offset);
@@ -152,8 +170,8 @@ public final class StiltModule implements IrisModule {
/** The block the stilt repeats: the palette's when the settings have one, soil turned to dirt, edited and turned with the object. */
private PlatformBlockState stiltState(ObjectBlock block, BlockPosition offset) {
PlatformBlockState state = placement.states().toPlatform(block.state());
if (settings != null && settings.getPalette() != null) {
state = settings.getPalette().get(rng, placement.x(), anchorY, placement.z(), placement.data());
if (palette != null) {
state = palette;
} else if (SOIL_MATERIALS.contains(IrisObjectShaping.materialKey(state))) {
state = B.getState(SOIL_REPLACEMENT);
}
@@ -174,9 +192,9 @@ public final class StiltModule implements IrisModule {
}
int lowerBound = highest - 1;
if (settings != null) {
lowerBound -= settings.getOverStilt() - rng.i(0, settings.getYRand());
if (settings.getYMax() != 0) {
lowerBound -= Math.min(settings.getYMax() - (top - highest), 0);
lowerBound -= settings.overStilt() - rng.i(0, settings.yRand());
if (settings.yMax() != 0) {
lowerBound -= Math.min(settings.yMax() - (top - highest), 0);
}
}
if (erode != null) {
@@ -198,9 +216,9 @@ public final class StiltModule implements IrisModule {
/** Grows from the layer toward the first solid block in {@code direction}, -1 down or 1 up. */
private void growOrganic(PlatformBlockState state, int x, int z, int direction) {
int maxScan = settings != null ? Math.max(1, settings.getOrganicMaxScan()) : DEFAULT_ORGANIC_MAX_SCAN;
int jitterMax = settings != null ? Math.max(0, settings.getOrganicJitter()) : DEFAULT_ORGANIC_JITTER;
double scratch = settings != null ? Math.max(0, Math.min(1, settings.getOrganicScratch())) : DEFAULT_ORGANIC_SCRATCH;
int maxScan = settings != null ? Math.max(1, settings.organicMaxScan()) : DEFAULT_ORGANIC_MAX_SCAN;
int jitterMax = settings != null ? Math.max(0, settings.organicJitter()) : DEFAULT_ORGANIC_JITTER;
double scratch = settings != null ? Math.max(0, Math.min(1, settings.organicScratch())) : DEFAULT_ORGANIC_SCRATCH;
long columnHash = ((long) x * HASH_X) ^ ((long) z * HASH_Y);
int jitter = jitterMax > 0 ? (int) (Math.abs(columnHash) % (jitterMax + 1)) : 0;
int start = layerY + anchorY;
@@ -18,6 +18,9 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.builtin.blocks.WrittenBlocks;
import art.arcane.iris.core.modules.IrisPlacement;
@@ -49,6 +52,11 @@ public final class VacuumModule implements IrisModule {
return ModuleInfo.of("iris:vacuum", "Vacuum", PlacementModules.VERSION);
}
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(VacuumSettings.class);
}
@Override
public void install(StageGraph graph) {
graph.define(IrisStages.Vacuum.TERRAIN)
@@ -91,11 +99,11 @@ public final class VacuumModule implements IrisModule {
this.prepared = prepared;
this.world = new PlacementWorld(context.access(), placement.states());
this.complex = engine.getComplex();
IrisVacuumSettings settings = prepared.config().getVacuumSettings();
VacuumSettings settings = prepared.config().getVacuumSettings();
this.radius = IrisObjectVacuum.resolveRadius(mode, settings);
this.step = IrisObjectVacuum.resolveStep(mode);
this.falloff = IrisObjectVacuum.resolveFalloff(settings);
this.jitter = settings != null ? Math.max(0, settings.getOrganicJitter()) : DEFAULT_ORGANIC_JITTER;
this.jitter = settings != null ? Math.max(0, settings.organicJitter()) : DEFAULT_ORGANIC_JITTER;
this.waveAmplitude = IrisObjectVacuum.resolveWaveAmplitude(settings);
this.waveScale = IrisObjectVacuum.resolveWaveScale(settings);
this.waves = mode == ObjectPlaceMode.VACUUM_WAVY && waveAmplitude > 0 ? new SimplexNoise(WAVE_SEED) : null;
@@ -18,13 +18,16 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.validate.ObjectLimit;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.core.modules.IrisPlacement;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.framework.NativeStructureVolume;
import art.arcane.iris.engine.framework.PlacedObject;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.terrain.carving.CarvingMode;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.volmlib.util.collection.KList;
import com.volmit.IrisModule;
@@ -53,6 +56,11 @@ public final class ValidateModule implements IrisModule {
return ModuleInfo.of("iris:validate", "Placement checks", PlacementModules.VERSION);
}
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(ObjectLimit.class);
}
@Override
public void install(StageGraph graph) {
graph.define(IrisStages.Validate.SURFACE)
@@ -18,6 +18,7 @@
package art.arcane.iris.engine.object.placement;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.core.modules.IrisPlacement;
/**
@@ -18,6 +18,7 @@
package art.arcane.iris.engine.object.prefab;
import art.arcane.iris.builtin.prepare.AxisRotationClamp;
import art.arcane.iris.engine.object.value.IrisDirection;
import art.arcane.iris.engine.object.value.IrisPosition;
import art.arcane.iris.engine.object.annotations.Desc;
@@ -79,64 +80,41 @@ public class IrisObjectRotation {
private boolean enabled = true;
@Desc("The x axis rotation")
private IrisAxisRotationClamp xAxis = new IrisAxisRotationClamp();
private AxisRotationClamp xAxis = new AxisRotationClamp();
@Desc("The y axis rotation")
private IrisAxisRotationClamp yAxis = new IrisAxisRotationClamp(true, false, 0, 0, 90);
private AxisRotationClamp yAxis = AxisRotationClamp.of(true, false, 0, 0, 90);
@Desc("The z axis rotation")
private IrisAxisRotationClamp zAxis = new IrisAxisRotationClamp();
private AxisRotationClamp zAxis = new AxisRotationClamp();
public static IrisObjectRotation xFlip180() {
IrisObjectRotation rt = new IrisObjectRotation();
IrisAxisRotationClamp rtx = new IrisAxisRotationClamp();
IrisAxisRotationClamp rty = new IrisAxisRotationClamp();
IrisAxisRotationClamp rtz = new IrisAxisRotationClamp();
rt.setEnabled(true);
rt.setXAxis(rtx);
rt.setYAxis(rty);
rt.setZAxis(rtz);
rtx.setEnabled(true);
rtx.minMax(180);
rty.setEnabled(false);
rtz.setEnabled(false);
rt.setXAxis(AxisRotationClamp.locked(true, 180, 0));
rt.setYAxis(new AxisRotationClamp());
rt.setZAxis(new AxisRotationClamp());
return rt;
}
public static IrisObjectRotation xFlip180RandomY() {
IrisObjectRotation rt = xFlip180();
rt.setYAxis(new IrisAxisRotationClamp(true, false, 0, 0, 90));
rt.setYAxis(AxisRotationClamp.of(true, false, 0, 0, 90));
return rt;
}
public static IrisObjectRotation xFlip180WithY(double y) {
IrisObjectRotation rt = xFlip180();
IrisAxisRotationClamp rty = new IrisAxisRotationClamp();
rty.setEnabled(true);
rty.setInterval(90);
rty.minMax(y);
rt.setYAxis(rty);
rt.setYAxis(AxisRotationClamp.locked(true, y, 90));
return rt;
}
public static IrisObjectRotation of(double x, double y, double z) {
IrisObjectRotation rt = new IrisObjectRotation();
IrisAxisRotationClamp rtx = new IrisAxisRotationClamp();
IrisAxisRotationClamp rty = new IrisAxisRotationClamp();
IrisAxisRotationClamp rtz = new IrisAxisRotationClamp();
rt.setEnabled(x != 0 || y != 0 || z != 0);
rt.setXAxis(rtx);
rt.setYAxis(rty);
rt.setZAxis(rtz);
rtx.setEnabled(x != 0);
rty.setEnabled(y != 0);
rtz.setEnabled(z != 0);
rtx.setInterval(90);
rty.setInterval(90);
rtz.setInterval(90);
rtx.minMax(x);
rty.minMax(y);
rtz.minMax(z);
rt.setXAxis(AxisRotationClamp.locked(x != 0, x, 90));
rt.setYAxis(AxisRotationClamp.locked(y != 0, y, 90));
rt.setZAxis(AxisRotationClamp.locked(z != 0, z, 90));
return rt;
}
@@ -182,12 +160,12 @@ public class IrisObjectRotation {
return s;
}
public double getRotation(int spin, IrisAxisRotationClamp clamp) {
public double getRotation(int spin, AxisRotationClamp clamp) {
if (!enabled) {
return 0;
}
if (!clamp.isEnabled()) {
if (!clamp.enabled()) {
return 0;
}
@@ -457,14 +435,14 @@ public class IrisObjectRotation {
if (canRotateX()) {
if (getXAxis().isLocked()) {
if (Math.abs(getXAxis().getMax()) % 360D == 180D) {
if (Math.abs(getXAxis().max()) % 360D == 180D) {
v.setZ(-v.getZ());
v.setY(-v.getY());
} else if (getXAxis().getMax() % 360D == 90D || getXAxis().getMax() % 360D == -270D) {
} else if (getXAxis().max() % 360D == 90D || getXAxis().max() % 360D == -270D) {
double z = v.getZ();
v.setZ(v.getY());
v.setY(-z);
} else if (getXAxis().getMax() == -90D || getXAxis().getMax() % 360D == 270D) {
} else if (getXAxis().max() == -90D || getXAxis().max() % 360D == 270D) {
double z = v.getZ();
v.setZ(-v.getY());
v.setY(z);
@@ -478,14 +456,14 @@ public class IrisObjectRotation {
if (canRotateZ()) {
if (getZAxis().isLocked()) {
if (Math.abs(getZAxis().getMax()) % 360D == 180D) {
if (Math.abs(getZAxis().max()) % 360D == 180D) {
v.setY(-v.getY());
v.setX(-v.getX());
} else if (getZAxis().getMax() % 360D == 90D || getZAxis().getMax() % 360D == -270D) {
} else if (getZAxis().max() % 360D == 90D || getZAxis().max() % 360D == -270D) {
double y = v.getY();
v.setY(v.getX());
v.setX(-y);
} else if (getZAxis().getMax() == -90D || getZAxis().getMax() % 360D == 270D) {
} else if (getZAxis().max() == -90D || getZAxis().max() % 360D == 270D) {
double y = v.getY();
v.setY(-v.getX());
v.setX(y);
@@ -499,14 +477,14 @@ public class IrisObjectRotation {
if (canRotateY()) {
if (getYAxis().isLocked()) {
if (Math.abs(getYAxis().getMax()) % 360D == 180D) {
if (Math.abs(getYAxis().max()) % 360D == 180D) {
v.setX(-v.getX());
v.setZ(-v.getZ());
} else if (getYAxis().getMax() % 360D == 90D || getYAxis().getMax() % 360D == -270D) {
} else if (getYAxis().max() % 360D == 90D || getYAxis().max() % 360D == -270D) {
double x = v.getX();
v.setX(v.getZ());
v.setZ(-x);
} else if (getYAxis().getMax() == -90D || getYAxis().getMax() % 360D == 270D) {
} else if (getYAxis().max() == -90D || getYAxis().max() % 360D == 270D) {
double x = v.getX();
v.setX(-v.getZ());
v.setZ(x);
@@ -522,15 +500,15 @@ public class IrisObjectRotation {
}
public boolean canRotateX() {
return enabled && xAxis.isEnabled();
return enabled && xAxis.enabled();
}
public boolean canRotateY() {
return enabled && yAxis.isEnabled();
return enabled && yAxis.enabled();
}
public boolean canRotateZ() {
return enabled && zAxis.isEnabled();
return enabled && zAxis.enabled();
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
@@ -18,7 +18,6 @@
package art.arcane.iris.engine.object.procedural;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.spi.PlatformBlockState;
@@ -26,8 +25,10 @@ import art.arcane.iris.util.common.data.B;
import art.arcane.iris.util.common.math.IrisBlockVector;
import art.arcane.iris.util.common.math.Vector3i;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.block.PaletteSpec;
import java.util.Map;
import java.util.Optional;
/**
* Shared low-level helpers for building procedural objects in memory: resolving a
@@ -52,13 +53,26 @@ public final class IrisProceduralBlocks {
};
}
public static boolean paletteSet(IrisMaterialPalette palette) {
return palette != null && palette.getPalette() != null && !palette.getPalette().isEmpty();
public static boolean paletteSet(PaletteSpec palette) {
return palette != null && !palette.palette().isEmpty();
}
public static PlatformBlockState resolve(String block, IrisMaterialPalette palette, IrisData data, int x, int y, int z, RNG paletteRng) {
public static boolean paletteSet(Optional<PaletteSpec> palette) {
return palette.filter(IrisProceduralBlocks::paletteSet).isPresent();
}
public static PlatformBlockState resolve(String block, Optional<PaletteSpec> palette, IrisData data, int x, int y, int z, RNG paletteRng) {
return resolve(block, palette.orElse(null), data, x, y, z, paletteRng);
}
public static PlatformBlockState resolve(Optional<String> block, Optional<PaletteSpec> palette, IrisData data, int x, int y, int z, RNG paletteRng) {
return resolve(block.orElse(null), palette.orElse(null), data, x, y, z, paletteRng);
}
/** The block of {@code palette} at the position, picked with the seed of {@code paletteRng} as the palette's old class did; else {@code block}. */
public static PlatformBlockState resolve(String block, PaletteSpec palette, IrisData data, int x, int y, int z, RNG paletteRng) {
if (paletteSet(palette)) {
return palette.get(paletteRng, x, y, z, data);
return pick(palette, data, paletteRng.getSeed(), x, y, z);
}
if (block != null && !block.isEmpty()) {
return B.getStateOrNull(block, false);
@@ -66,6 +80,11 @@ public final class IrisProceduralBlocks {
return null;
}
/** The block {@code palette} gives at the position when its noise is seeded with {@code seed}. */
public static PlatformBlockState pick(PaletteSpec palette, IrisData data, long seed, int x, int y, int z) {
return B.getState(data.getPackResources().blocks().palette(palette, seed).at(x, y, z).key());
}
public static boolean hasProperty(PlatformBlockState state, String property) {
String key = state.key();
int start = propertyStart(key, property);
@@ -18,18 +18,31 @@
package art.arcane.iris.engine.object.procedural;
import art.arcane.iris.engine.object.procedural.coral.IrisCoral;
import art.arcane.iris.engine.object.procedural.crystal.IrisCrystal;
import art.arcane.iris.engine.object.procedural.formation.IrisFormation;
import art.arcane.iris.engine.object.procedural.fungi.IrisFungus;
import art.arcane.iris.engine.object.procedural.ruin.IrisRuin;
import art.arcane.iris.builtin.objects.ruin.Ruin;
import art.arcane.iris.engine.object.procedural.ruin.ResolvedRuin;
import art.arcane.iris.builtin.objects.fungi.Fungus;
import art.arcane.iris.engine.object.procedural.fungi.ResolvedFungus;
import art.arcane.iris.builtin.objects.formation.Formation;
import art.arcane.iris.engine.object.procedural.formation.ResolvedFormation;
import art.arcane.iris.builtin.objects.crystal.Crystal;
import art.arcane.iris.engine.object.procedural.crystal.ResolvedCrystal;
import art.arcane.iris.builtin.objects.coral.Coral;
import art.arcane.iris.engine.object.procedural.coral.ResolvedCoral;
import art.arcane.iris.engine.object.procedural.tree.IrisProceduralTree;
import art.arcane.iris.engine.object.annotations.ArrayType;
import art.arcane.iris.engine.object.annotations.Desc;
import art.arcane.iris.engine.object.annotations.Snippet;
import art.arcane.volmlib.util.collection.KList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import lombok.AllArgsConstructor;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@@ -40,53 +53,59 @@ import lombok.experimental.Accessors;
@Desc("Procedurally generated objects placed in a biome or region. Unlike the objects block (which loads iob files), these are generated from scratch at world-gen time.")
@Data
public class IrisProceduralObjects {
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
@EqualsAndHashCode.Exclude
private final transient Map<Object, ResolvedProceduralPlacement> placeables = new ConcurrentHashMap<>();
@ArrayType(min = 1, type = IrisProceduralTree.class)
@Desc("Procedurally generated trees.")
private KList<IrisProceduralTree> trees = new KList<>();
@ArrayType(min = 1, type = IrisRuin.class)
@ArrayType(min = 1, type = Ruin.class)
@Desc("Procedurally generated ruins (crumbling pillars, walls, arches, rubble).")
private KList<IrisRuin> ruins = new KList<>();
private KList<Ruin> ruins = new KList<>();
@ArrayType(min = 1, type = IrisFormation.class)
@ArrayType(min = 1, type = Formation.class)
@Desc("Procedurally generated natural rock formations (spires, hoodoos, arches, sea stacks, boulders, basalt columns).")
private KList<IrisFormation> formations = new KList<>();
private KList<Formation> formations = new KList<>();
@ArrayType(min = 1, type = IrisCoral.class)
@ArrayType(min = 1, type = Coral.class)
@Desc("Procedurally generated underwater coral structures.")
private KList<IrisCoral> coral = new KList<>();
private KList<Coral> coral = new KList<>();
@ArrayType(min = 1, type = IrisFungus.class)
@ArrayType(min = 1, type = Fungus.class)
@Desc("Procedurally generated mushrooms and shelf fungi.")
private KList<IrisFungus> fungi = new KList<>();
private KList<Fungus> fungi = new KList<>();
@ArrayType(min = 1, type = IrisCrystal.class)
@ArrayType(min = 1, type = Crystal.class)
@Desc("Procedurally generated crystal clusters (usually placed in caves).")
private KList<IrisCrystal> crystals = new KList<>();
private KList<Crystal> crystals = new KList<>();
public KList<IrisProceduralPlacement> getAllPlacements() {
KList<IrisProceduralPlacement> all = new KList<>();
if (trees != null) {
all.addAll(trees);
}
if (ruins != null) {
all.addAll(ruins);
}
if (formations != null) {
all.addAll(formations);
}
if (coral != null) {
all.addAll(coral);
}
if (fungi != null) {
all.addAll(fungi);
}
if (crystals != null) {
all.addAll(crystals);
}
addPlaceable(all, ruins, ResolvedRuin::new);
addPlaceable(all, formations, ResolvedFormation::new);
addPlaceable(all, coral, ResolvedCoral::new);
addPlaceable(all, fungi, ResolvedFungus::new);
addPlaceable(all, crystals, ResolvedCrystal::new);
return all;
}
/** The settings in {@code settings}, each made placeable once, in order. */
@SuppressWarnings("unchecked")
private <S> void addPlaceable(KList<IrisProceduralPlacement> all, KList<S> settings, Function<S, ResolvedProceduralPlacement> resolve) {
if (settings == null) {
return;
}
for (S entry : settings) {
all.add(placeables.computeIfAbsent(entry, key -> resolve.apply((S) key)));
}
}
public boolean isEmpty() {
return getAllPlacements().isEmpty();
}
@@ -0,0 +1,158 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import art.arcane.iris.builtin.carve.CarvingMode;
import art.arcane.iris.builtin.prepare.ObjectRotation;
import art.arcane.iris.builtin.prepare.ObjectTranslate;
import art.arcane.iris.builtin.stilt.StiltSettings;
import art.arcane.iris.builtin.vacuum.VacuumSettings;
import art.arcane.iris.builtin.validate.ObjectLimit;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
/**
* A procedural object's settings made placeable: bakes a deterministic pool of variants from them, once, and turns
* the placement options into the object placement the engine scatters. The settings classes held the same cache
* and methods before they became module settings.
*/
public abstract class ResolvedProceduralPlacement implements IrisProceduralPlacement {
private static final long VARIANT_SEED_STRIDE = 7919L;
/** The options every procedural placement shares with an object placement. */
public record Shape(String name, double chance, int density, long seed, int variants, ObjectPlaceMode mode,
ObjectRotation rotation, ObjectLimit clamp, CarvingMode carvingSupport, boolean underwater,
ObjectTranslate translate, StiltSettings stiltSettings, VacuumSettings vacuumSettings) {
}
private final Shape shape;
private final AtomicCache<KList<IrisObject>> variantCache = new AtomicCache<>();
protected ResolvedProceduralPlacement(Shape shape) {
this.shape = shape;
}
/** The object variant {@code index} is baked as, from its own seeded stream. */
protected abstract IrisObject generate(int index, RNG rng, IrisData data);
/** The number of variants to bake; the settings' count, at least one. */
protected int variantCount() {
return Math.max(1, shape.variants());
}
@Override
public String getName() {
return shape.name();
}
@Override
public double getChance() {
return shape.chance();
}
@Override
public int getDensity() {
return shape.density();
}
@Override
public boolean isPlausible() {
return false;
}
@Override
public KList<IrisObject> getVariantObjects(IrisData data) {
return variantCache.aquire(() -> bake(data));
}
/** Bakes every variant; the default draws variant {@code i} from {@code seed + i * stride}. */
protected KList<IrisObject> bake(IrisData data) {
KList<IrisObject> baked = new KList<>();
int count = variantCount();
for (int i = 0; i < count; i++) {
IrisObject object = generate(i, variantRng(i), data);
if (object == null || object.getBlocks().isEmpty()) {
continue;
}
object.setLoadKey("procedural/" + shape.name() + "#" + i);
object.setLoader(data);
baked.add(object);
}
return baked;
}
protected final RNG variantRng(int index) {
return new RNG(shape.seed() + (index * VARIANT_SEED_STRIDE));
}
protected final long seed() {
return shape.seed();
}
@Override
public IrisObject getVariantObject(IrisData data, RNG rng) {
KList<IrisObject> baked = getVariantObjects(data);
if (baked == null || baked.isEmpty()) {
return null;
}
return baked.get(rng.i(baked.size()));
}
@Override
public IrisObjectPlacement asPlacement() {
IrisObjectPlacement placement = new IrisObjectPlacement();
placement.setMode(shape.mode());
placement.setRotation(irisRotation(shape.rotation()));
placement.setClamp(shape.clamp());
placement.setCarvingSupport(shape.carvingSupport());
placement.setUnderwater(shape.underwater());
placement.setTranslate(irisTranslate(shape.translate()));
placement.setStiltSettings(shape.stiltSettings());
placement.setVacuumSettings(shape.vacuumSettings());
placement.setChance(shape.chance());
placement.setDensity(shape.density());
customize(placement);
return placement;
}
/** Sets what this kind of placement adds to the common options. */
protected void customize(IrisObjectPlacement placement) {
}
private static IrisObjectRotation irisRotation(ObjectRotation rotation) {
return new IrisObjectRotation()
.setEnabled(rotation.enabled())
.setXAxis(rotation.xAxis())
.setYAxis(rotation.yAxis())
.setZAxis(rotation.zAxis());
}
private static IrisObjectTranslate irisTranslate(ObjectTranslate translate) {
return new IrisObjectTranslate(translate.x(), translate.y(), translate.yRandom(), translate.z());
}
}
@@ -18,8 +18,8 @@
package art.arcane.iris.engine.object.procedural.coral;
import art.arcane.iris.builtin.objects.coral.Coral;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.procedural.coral.IrisCoral;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.engine.object.procedural.tree.TreeFunctions;
@@ -36,14 +36,14 @@ public final class CoralGenerator {
private CoralGenerator() {
}
public static IrisObject generate(IrisCoral coral, int variantIndex, RNG rng, IrisData data) {
int lo = Math.min(coral.getHeightMin(), coral.getHeightMax());
int hi = Math.max(coral.getHeightMin(), coral.getHeightMax());
public static IrisObject generate(Coral coral, int variantIndex, RNG rng, IrisData data) {
int lo = Math.min(coral.heightMin(), coral.heightMax());
int hi = Math.max(coral.heightMin(), coral.heightMax());
int height = Math.max(2, rng.i(lo, hi + 1));
long shapeSeed = rng.getSeed() + variantIndex * 31L;
CoralCanvas canvas = new CoralCanvas();
switch (coral.getForm()) {
switch (coral.form()) {
case BRANCHING -> buildBranching(canvas, coral, height, shapeSeed, rng);
case FAN -> buildFan(canvas, coral, height, shapeSeed);
case BRAIN -> buildBrain(canvas, coral, height, shapeSeed);
@@ -55,39 +55,39 @@ public final class CoralGenerator {
return IrisProceduralBlocks.assemble(resolved);
}
private static void buildBranching(CoralCanvas canvas, IrisCoral coral, int height, long seed, RNG rng) {
private static void buildBranching(CoralCanvas canvas, Coral coral, int height, long seed, RNG rng) {
int stalkTop = Math.max(1, (int) Math.round(height * 0.5));
for (int y = 0; y < stalkTop; y++) {
placeWavy(canvas, coral, 0, y, 0, y, seed, CoralCanvas.Role.STRUCTURE);
}
int count = Math.max(1, coral.getBranchCount());
int count = Math.max(1, coral.branchCount());
for (int b = 0; b < count; b++) {
double az = branchAzimuth(coral, b, count, rng);
int startY = stalkTop - 1 + (int) Math.round((b % 2) * 1.0);
double[] tip = rasterizeArm(canvas, coral, 0, startY, 0, az,
coral.getBranchElevation(), coral.getBranchLength(), seed + b * 131L);
coral.branchElevation(), coral.branchLength(), seed + b * 131L);
placeTipCluster(canvas, coral, (int) Math.round(tip[0]), (int) Math.round(tip[1]), (int) Math.round(tip[2]),
coral.getTipClusterRadius(), seed + b * 977L);
coral.tipClusterRadius(), seed + b * 977L);
if (coral.isSubBranches()) {
int subCount = Math.max(1, coral.getSubBranchCount());
if (coral.subBranches()) {
int subCount = Math.max(1, coral.subBranchCount());
for (int s = 0; s < subCount; s++) {
double subAz = az + (s - (subCount - 1) / 2.0) * 35.0;
double subLen = coral.getBranchLength() * coral.getSubBranchScale();
double subLen = coral.branchLength() * coral.subBranchScale();
double[] subTip = rasterizeArm(canvas, coral,
(int) Math.round(tip[0]), (int) Math.round(tip[1]), (int) Math.round(tip[2]),
subAz, coral.getBranchElevation() + 10.0, subLen, seed + b * 131L + s * 17L + 5000L);
subAz, coral.branchElevation() + 10.0, subLen, seed + b * 131L + s * 17L + 5000L);
placeTipCluster(canvas, coral, (int) Math.round(subTip[0]), (int) Math.round(subTip[1]), (int) Math.round(subTip[2]),
Math.max(0, coral.getTipClusterRadius() - 1), seed + b * 977L + s * 53L);
Math.max(0, coral.tipClusterRadius() - 1), seed + b * 977L + s * 53L);
}
}
}
}
private static void buildFan(CoralCanvas canvas, IrisCoral coral, int height, long seed) {
int half = Math.max(1, coral.getFanWidth());
private static void buildFan(CoralCanvas canvas, Coral coral, int height, long seed) {
int half = Math.max(1, coral.fanWidth());
for (int y = 0; y < height; y++) {
double t = y / (double) Math.max(1, height - 1);
double profile = Math.sin(Math.PI * t);
@@ -101,10 +101,10 @@ public final class CoralGenerator {
}
}
private static void buildBrain(CoralCanvas canvas, IrisCoral coral, int height, long seed) {
int r = Math.max(1, coral.getBrainRadius());
private static void buildBrain(CoralCanvas canvas, Coral coral, int height, long seed) {
int r = Math.max(1, coral.brainRadius());
int ry = Math.max(1, Math.min(r, (int) Math.round(height * 0.6)));
double rough = coral.getBrainRoughness();
double rough = coral.brainRoughness();
for (int dx = -r; dx <= r; dx++) {
for (int dz = -r; dz <= r; dz++) {
for (int dy = 0; dy <= ry * 2; dy++) {
@@ -121,8 +121,8 @@ public final class CoralGenerator {
}
}
private static void buildPillar(CoralCanvas canvas, IrisCoral coral, int height, long seed) {
int r = Math.max(1, coral.getPillarRadius());
private static void buildPillar(CoralCanvas canvas, Coral coral, int height, long seed) {
int r = Math.max(1, coral.pillarRadius());
for (int y = 0; y < height; y++) {
for (int dx = -r; dx <= r; dx++) {
for (int dz = -r; dz <= r; dz++) {
@@ -132,12 +132,12 @@ public final class CoralGenerator {
}
}
}
placeTipCluster(canvas, coral, 0, height - 1, 0, coral.getTipClusterRadius(), seed);
placeTipCluster(canvas, coral, 0, height - 1, 0, coral.tipClusterRadius(), seed);
}
private static void buildTendril(CoralCanvas canvas, IrisCoral coral, int height, long seed, RNG rng) {
int count = Math.max(1, coral.getTendrilCount());
double radius = Math.max(0.0, coral.getSpread());
private static void buildTendril(CoralCanvas canvas, Coral coral, int height, long seed, RNG rng) {
int count = Math.max(1, coral.tendrilCount());
double radius = Math.max(0.0, coral.spread());
for (int c = 0; c < count; c++) {
double az = Math.toRadians(c * (360.0 / count));
double bx = Math.cos(az) * radius * 0.5;
@@ -153,7 +153,7 @@ public final class CoralGenerator {
}
}
private static double[] rasterizeArm(CoralCanvas canvas, IrisCoral coral, int ox, int oy, int oz,
private static double[] rasterizeArm(CoralCanvas canvas, Coral coral, int ox, int oy, int oz,
double azimuthDeg, double elevationDeg, double length, long seed) {
double azRad = Math.toRadians(azimuthDeg);
double elRad = Math.toRadians(elevationDeg);
@@ -175,23 +175,23 @@ public final class CoralGenerator {
return tip;
}
private static void placeWavy(CoralCanvas canvas, IrisCoral coral, int x, int y, int z, double phase, long seed, CoralCanvas.Role role) {
private static void placeWavy(CoralCanvas canvas, Coral coral, int x, int y, int z, double phase, long seed, CoralCanvas.Role role) {
double sway = swayOffset(coral, phase, seed);
int sx = (int) Math.round(sway);
int sz = (int) Math.round(swayOffset(coral, phase + 53.0, seed + 7L));
canvas.set(x + sx, y, z + sz, role);
}
private static double swayOffset(IrisCoral coral, double phase, long seed) {
double amount = Math.max(0.0, Math.min(1.0, coral.getSway()));
private static double swayOffset(Coral coral, double phase, long seed) {
double amount = Math.max(0.0, Math.min(1.0, coral.sway()));
if (amount <= 0.0) {
return 0.0;
}
double n = TreeFunctions.valueNoise1D(phase * 0.35, seed) - 0.5;
return n * 2.0 * amount * (1.0 + coral.getSpread() * 0.25);
return n * 2.0 * amount * (1.0 + coral.spread() * 0.25);
}
private static void placeTipCluster(CoralCanvas canvas, IrisCoral coral, int cx, int cy, int cz, int radius, long seed) {
private static void placeTipCluster(CoralCanvas canvas, Coral coral, int cx, int cy, int cz, int radius, long seed) {
if (radius <= 0) {
placeTip(canvas, coral, cx, cy, cz, seed);
return;
@@ -208,31 +208,31 @@ public final class CoralGenerator {
placeTip(canvas, coral, cx, cy + radius + 1, cz, seed);
}
private static void placeTip(CoralCanvas canvas, IrisCoral coral, int x, int y, int z, long seed) {
private static void placeTip(CoralCanvas canvas, Coral coral, int x, int y, int z, long seed) {
if (!hasTip(coral)) {
return;
}
if (TreeFunctions.valueNoise1D(x * 31.0 + y * 17.0 + z * 13.0, seed) <= coral.getTipChance()) {
if (TreeFunctions.valueNoise1D(x * 31.0 + y * 17.0 + z * 13.0, seed) <= coral.tipChance()) {
canvas.set(x, y, z, CoralCanvas.Role.TIP);
}
}
private static boolean hasTip(IrisCoral coral) {
return IrisProceduralBlocks.paletteSet(coral.getTipPalette())
|| (coral.getTipBlock() != null && !coral.getTipBlock().isEmpty());
private static boolean hasTip(Coral coral) {
return IrisProceduralBlocks.paletteSet(coral.tipPalette())
|| (coral.tipBlock() != null && !coral.tipBlock().isEmpty());
}
private static double branchAzimuth(IrisCoral coral, int index, int count, RNG rng) {
return switch (coral.getBranchAzimuth()) {
private static double branchAzimuth(Coral coral, int index, int count, RNG rng) {
return switch (coral.branchAzimuth()) {
case GOLDEN_ANGLE -> index * GOLDEN_ANGLE;
case EVEN -> index * (360.0 / count);
case RANDOM -> rng.d(0.0, 360.0);
};
}
private static Map<Vector3i, PlatformBlockState> resolve(CoralCanvas canvas, IrisCoral coral, IrisData data) {
private static Map<Vector3i, PlatformBlockState> resolve(CoralCanvas canvas, Coral coral, IrisData data) {
Map<Vector3i, PlatformBlockState> out = new HashMap<>();
RNG paletteRng = new RNG(coral.getSeed());
RNG paletteRng = new RNG(coral.seed());
for (Map.Entry<Long, CoralCanvas.Role> entry : canvas.getCells().entrySet()) {
int[] xyz = CoralCanvas.decode(entry.getKey());
int x = xyz[0];
@@ -240,17 +240,17 @@ public final class CoralGenerator {
int z = xyz[2];
PlatformBlockState state;
if (entry.getValue() == CoralCanvas.Role.TIP) {
state = IrisProceduralBlocks.resolve(coral.getTipBlock(), coral.getTipPalette(), data, x, y, z, paletteRng);
state = IrisProceduralBlocks.resolve(coral.tipBlock(), coral.tipPalette(), data, x, y, z, paletteRng);
if (state == null) {
state = IrisProceduralBlocks.resolve(coral.getBlock(), coral.getBlockPalette(), data, x, y, z, paletteRng);
state = IrisProceduralBlocks.resolve(coral.block(), coral.blockPalette(), data, x, y, z, paletteRng);
}
} else {
state = IrisProceduralBlocks.resolve(coral.getBlock(), coral.getBlockPalette(), data, x, y, z, paletteRng);
state = IrisProceduralBlocks.resolve(coral.block(), coral.blockPalette(), data, x, y, z, paletteRng);
}
if (state == null) {
continue;
}
if (coral.isWaterlogged() && IrisProceduralBlocks.hasProperty(state, "waterlogged")) {
if (coral.waterlogged() && IrisProceduralBlocks.hasProperty(state, "waterlogged")) {
try {
state = state.withProperty("waterlogged", "true");
} catch (IllegalArgumentException ignored) {
@@ -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.engine.object.procedural.coral;
import art.arcane.iris.builtin.objects.coral.Coral;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.ResolvedProceduralPlacement;
import art.arcane.volmlib.util.math.RNG;
/** A coral reef made placeable: its variants are baked by {@link CoralGenerator}. */
public final class ResolvedCoral extends ResolvedProceduralPlacement {
private final Coral settings;
public ResolvedCoral(Coral settings) {
super(new Shape(settings.name(), settings.chance(), settings.density(), settings.seed(), settings.variants(), settings.mode(),
settings.rotation(), settings.clamp(), settings.carvingSupport(), settings.underwater(), settings.translate(),
settings.stiltSettings().orElse(null), settings.vacuumSettings().orElse(null)));
this.settings = settings;
}
@Override
protected IrisObject generate(int index, RNG rng, IrisData data) {
return CoralGenerator.generate(settings, index, rng, data);
}
}
@@ -18,21 +18,21 @@
package art.arcane.iris.engine.object.procedural.crystal;
import art.arcane.iris.engine.object.procedural.crystal.IrisCrystal;
import art.arcane.iris.builtin.objects.crystal.Crystal;
import art.arcane.iris.engine.object.procedural.tree.TreeFunctions;
public final class CrystalBaseBuilder {
private CrystalBaseBuilder() {
}
public static void build(CrystalCanvas canvas, IrisCrystal crystal, long seed) {
double radius = crystal.getBaseRadius();
public static void build(CrystalCanvas canvas, Crystal crystal, long seed) {
double radius = crystal.baseRadius();
if (radius <= 0.0) {
canvas.set(0, 0, 0, CrystalRole.BASE);
return;
}
double noiseStrength = crystal.getBaseNoise();
double noiseStrength = crystal.baseNoise();
int reach = (int) Math.ceil(radius + 1.0);
for (int x = -reach; x <= reach; x++) {
for (int y = -reach; y <= reach; y++) {
@@ -18,8 +18,9 @@
package art.arcane.iris.engine.object.procedural.crystal;
import art.arcane.iris.builtin.objects.crystal.Crystal;
import com.volmit.block.PaletteSpec;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.procedural.crystal.IrisCrystal;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.spi.PlatformBlockState;
@@ -33,7 +34,7 @@ public final class CrystalGenerator {
private CrystalGenerator() {
}
public static IrisObject generate(IrisCrystal crystal, int variantIndex, RNG rng, IrisData data) {
public static IrisObject generate(Crystal crystal, int variantIndex, RNG rng, IrisData data) {
CrystalCanvas canvas = new CrystalCanvas();
long structureSeed = rng.getSeed();
@@ -41,8 +42,8 @@ public final class CrystalGenerator {
CrystalShardBuilder.build(canvas, crystal, rng);
Map<Vector3i, PlatformBlockState> resolved = new HashMap<>();
RNG paletteRng = new RNG(crystal.getSeed());
RNG tipRng = new RNG(crystal.getSeed() + (variantIndex * 31337L) + 4099L);
RNG paletteRng = new RNG(crystal.seed());
RNG tipRng = new RNG(crystal.seed() + (variantIndex * 31337L) + 4099L);
for (Map.Entry<Vector3i, CrystalRole> entry : canvas.getCells().entrySet()) {
Vector3i position = entry.getKey();
@@ -59,7 +60,7 @@ public final class CrystalGenerator {
return IrisProceduralBlocks.assemble(resolved);
}
private static PlatformBlockState resolveRole(IrisCrystal crystal, CrystalRole role, IrisData data, int x, int y, int z, RNG paletteRng, RNG tipRng) {
private static PlatformBlockState resolveRole(Crystal crystal, CrystalRole role, IrisData data, int x, int y, int z, RNG paletteRng, RNG tipRng) {
return switch (role) {
case BASE -> resolveBase(crystal, data, x, y, z, paletteRng);
case SHARD -> resolveShard(crystal, data, x, y, z, paletteRng);
@@ -67,11 +68,11 @@ public final class CrystalGenerator {
};
}
private static PlatformBlockState resolveBase(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng) {
boolean hasBase = IrisProceduralBlocks.paletteSet(crystal.getBasePalette())
|| (crystal.getBaseBlock() != null && !crystal.getBaseBlock().isEmpty());
private static PlatformBlockState resolveBase(Crystal crystal, IrisData data, int x, int y, int z, RNG paletteRng) {
boolean hasBase = IrisProceduralBlocks.paletteSet(crystal.basePalette())
|| (crystal.baseBlock() != null && !crystal.baseBlock().isEmpty());
if (hasBase) {
PlatformBlockState base = IrisProceduralBlocks.resolve(crystal.getBaseBlock(), crystal.getBasePalette(), data, x, y, z, paletteRng);
PlatformBlockState base = IrisProceduralBlocks.resolve(crystal.baseBlock(), crystal.basePalette(), data, x, y, z, paletteRng);
if (base != null) {
return base;
}
@@ -79,17 +80,17 @@ public final class CrystalGenerator {
return resolveShard(crystal, data, x, y, z, paletteRng);
}
private static PlatformBlockState resolveShard(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng) {
return IrisProceduralBlocks.resolve(crystal.getBlock(), crystal.getBlockPalette(), data, x, y, z, paletteRng);
private static PlatformBlockState resolveShard(Crystal crystal, IrisData data, int x, int y, int z, RNG paletteRng) {
return IrisProceduralBlocks.resolve(crystal.block(), crystal.blockPalette(), data, x, y, z, paletteRng);
}
private static PlatformBlockState resolveTip(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng, RNG tipRng) {
boolean hasTip = IrisProceduralBlocks.paletteSet(crystal.getTipPalette())
|| (crystal.getTipBlock() != null && !crystal.getTipBlock().isEmpty());
private static PlatformBlockState resolveTip(Crystal crystal, IrisData data, int x, int y, int z, RNG paletteRng, RNG tipRng) {
boolean hasTip = IrisProceduralBlocks.paletteSet(crystal.tipPalette())
|| (crystal.tipBlock() != null && !crystal.tipBlock().isEmpty());
if (hasTip) {
if (tipRng.chance(crystal.getTipChance())) {
PlatformBlockState tip = IrisProceduralBlocks.resolve(crystal.getTipBlock(), crystal.getTipPalette(), data, x, y, z, paletteRng);
if (tipRng.chance(crystal.tipChance())) {
PlatformBlockState tip = IrisProceduralBlocks.resolve(crystal.tipBlock(), crystal.tipPalette(), data, x, y, z, paletteRng);
if (tip != null) {
return tip;
}
@@ -97,9 +98,9 @@ public final class CrystalGenerator {
return resolveShard(crystal, data, x, y, z, paletteRng);
}
if (crystal.isGlow() && crystal.getGlowBlock() != null && !crystal.getGlowBlock().isEmpty()) {
if (tipRng.chance(crystal.getTipChance())) {
PlatformBlockState glow = IrisProceduralBlocks.resolve(crystal.getGlowBlock(), null, data, x, y, z, paletteRng);
if (crystal.glow() && crystal.glowBlock() != null && !crystal.glowBlock().isEmpty()) {
if (tipRng.chance(crystal.tipChance())) {
PlatformBlockState glow = IrisProceduralBlocks.resolve(crystal.glowBlock(), (PaletteSpec) null, data, x, y, z, paletteRng);
if (glow != null) {
return glow;
}
@@ -18,13 +18,14 @@
package art.arcane.iris.engine.object.procedural.crystal;
import art.arcane.iris.engine.object.procedural.crystal.IrisCrystalSurface;
import art.arcane.iris.builtin.objects.crystal.CrystalSurface;
public final class CrystalGeometry {
private CrystalGeometry() {
}
public static double[] surfaceNormal(IrisCrystalSurface surface) {
public static double[] surfaceNormal(CrystalSurface surface) {
return switch (surface) {
case FLOOR -> new double[]{0.0, 1.0, 0.0};
case CEILING -> new double[]{0.0, -1.0, 0.0};
@@ -18,8 +18,8 @@
package art.arcane.iris.engine.object.procedural.crystal;
import art.arcane.iris.engine.object.procedural.crystal.IrisCrystal;
import art.arcane.iris.engine.object.procedural.crystal.IrisCrystalDistribution;
import art.arcane.iris.builtin.objects.crystal.CrystalDistribution;
import art.arcane.iris.builtin.objects.crystal.Crystal;
import art.arcane.volmlib.util.math.RNG;
public final class CrystalShardBuilder {
@@ -28,24 +28,24 @@ public final class CrystalShardBuilder {
private CrystalShardBuilder() {
}
public static void build(CrystalCanvas canvas, IrisCrystal crystal, RNG rng) {
double[] normal = CrystalGeometry.surfaceNormal(crystal.getGrowthSurface());
public static void build(CrystalCanvas canvas, Crystal crystal, RNG rng) {
double[] normal = CrystalGeometry.surfaceNormal(crystal.growthSurface());
double[] u = CrystalGeometry.orthonormalBasisU(normal);
double[] v = CrystalGeometry.orthonormalBasisV(normal, u);
int countLo = Math.min(crystal.getShardCountMin(), crystal.getShardCountMax());
int countHi = Math.max(crystal.getShardCountMin(), crystal.getShardCountMax());
int countLo = Math.min(crystal.shardCountMin(), crystal.shardCountMax());
int countHi = Math.max(crystal.shardCountMin(), crystal.shardCountMax());
int shardCount = Math.max(1, rng.i(countLo, countHi + 1));
int lengthLo = Math.min(crystal.getShardLengthMin(), crystal.getShardLengthMax());
int lengthHi = Math.max(crystal.getShardLengthMin(), crystal.getShardLengthMax());
int lengthLo = Math.min(crystal.shardLengthMin(), crystal.shardLengthMax());
int lengthHi = Math.max(crystal.shardLengthMin(), crystal.shardLengthMax());
double spreadRadians = Math.toRadians(Math.max(0.0, Math.min(90.0, crystal.getSpreadAngle())));
double jitterAmount = Math.max(0.0, Math.min(1.0, crystal.getJitter()));
double emitRadius = Math.max(0.0, crystal.getBaseRadius() * 0.6);
double spreadRadians = Math.toRadians(Math.max(0.0, Math.min(90.0, crystal.spreadAngle())));
double jitterAmount = Math.max(0.0, Math.min(1.0, crystal.jitter()));
double emitRadius = Math.max(0.0, crystal.baseRadius() * 0.6);
for (int i = 0; i < shardCount; i++) {
double azimuth = azimuth(crystal.getDistribution(), i, rng);
double azimuth = azimuth(crystal.distribution(), i, rng);
azimuth += rng.d(-Math.PI, Math.PI) * jitterAmount * 0.5;
double cone = spreadRadians * fanFraction(shardCount, i, rng);
@@ -63,9 +63,9 @@ public final class CrystalShardBuilder {
}
}
private static void rasterizeShard(CrystalCanvas canvas, IrisCrystal crystal, double ox, double oy, double oz, double[] direction, int length) {
double baseRadius = Math.max(0.5, crystal.getShardBaseRadius());
double taper = Math.max(0.0, Math.min(1.0, crystal.getShardTaper()));
private static void rasterizeShard(CrystalCanvas canvas, Crystal crystal, double ox, double oy, double oz, double[] direction, int length) {
double baseRadius = Math.max(0.5, crystal.shardBaseRadius());
double taper = Math.max(0.0, Math.min(1.0, crystal.shardTaper()));
int samples = Math.max(1, length * 3);
@@ -108,8 +108,8 @@ public final class CrystalShardBuilder {
canvas.set(tipX, tipY, tipZ, CrystalRole.TIP);
}
private static double azimuth(IrisCrystalDistribution distribution, int index, RNG rng) {
if (distribution == IrisCrystalDistribution.GOLDEN_ANGLE) {
private static double azimuth(CrystalDistribution distribution, int index, RNG rng) {
if (distribution == CrystalDistribution.GOLDEN_ANGLE) {
return Math.toRadians(index * GOLDEN_ANGLE);
}
return rng.d(0.0, Math.PI * 2.0);
@@ -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.engine.object.procedural.crystal;
import art.arcane.iris.builtin.objects.crystal.Crystal;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.ResolvedProceduralPlacement;
import art.arcane.volmlib.util.math.RNG;
/** A crystal cluster made placeable: its variants are baked by {@link CrystalGenerator}. */
public final class ResolvedCrystal extends ResolvedProceduralPlacement {
private final Crystal settings;
public ResolvedCrystal(Crystal settings) {
super(new Shape(settings.name(), settings.chance(), settings.density(), settings.seed(), settings.variants(), settings.mode(),
settings.rotation(), settings.clamp(), settings.carvingSupport(), settings.underwater(), settings.translate(),
settings.stiltSettings().orElse(null), settings.vacuumSettings().orElse(null)));
this.settings = settings;
}
@Override
protected IrisObject generate(int index, RNG rng, IrisData data) {
return CrystalGenerator.generate(settings, index, rng, data);
}
}
@@ -18,8 +18,10 @@
package art.arcane.iris.engine.object.procedural.formation;
import com.volmit.block.PaletteSpec;
import java.util.Optional;
import art.arcane.iris.builtin.objects.formation.Formation;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.procedural.formation.IrisFormation;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.spi.PlatformBlockState;
@@ -30,37 +32,37 @@ public final class FormationBlockResolver {
private FormationBlockResolver() {
}
public static PlatformBlockState resolve(IrisFormation f, IrisData data, FormationCanvas.Role role, Vector3i raw) {
public static PlatformBlockState resolve(Formation f, IrisData data, FormationCanvas.Role role, Vector3i raw) {
int x = raw.getBlockX();
int y = raw.getBlockY();
int z = raw.getBlockZ();
RNG paletteRng = new RNG(f.getSeed());
RNG paletteRng = new RNG(f.seed());
if (role == FormationCanvas.Role.CAP && capDefined(f)) {
PlatformBlockState cap = IrisProceduralBlocks.resolve(f.getCapBlock(), f.getCapPalette(), data, x, y, z, paletteRng);
PlatformBlockState cap = IrisProceduralBlocks.resolve(f.capBlock(), f.capPalette(), data, x, y, z, paletteRng);
if (cap != null) {
return cap;
}
}
if (strataDefined(f)) {
IrisMaterialPalette strata = f.getStrataPalette();
int thickness = Math.max(1, f.getStrataThickness());
PaletteSpec strata = f.strataPalette().orElseThrow();
int thickness = Math.max(1, f.strataThickness());
int band = Math.floorDiv(y, thickness);
PlatformBlockState strataState = strata.get(new RNG(f.getSeed() + (band * 31L)), x, band, z, data);
PlatformBlockState strataState = IrisProceduralBlocks.pick(strata, data, f.seed() + (band * 31L), x, band, z);
if (strataState != null) {
return strataState;
}
}
return IrisProceduralBlocks.resolve(f.getBlock(), f.getBlockPalette(), data, x, y, z, paletteRng);
return IrisProceduralBlocks.resolve(f.block(), f.blockPalette(), data, x, y, z, paletteRng);
}
private static boolean capDefined(IrisFormation f) {
return IrisProceduralBlocks.paletteSet(f.getCapPalette()) || (f.getCapBlock() != null && !f.getCapBlock().isEmpty());
private static boolean capDefined(Formation f) {
return IrisProceduralBlocks.paletteSet(f.capPalette()) || f.capBlock().filter(block -> !block.isEmpty()).isPresent();
}
private static boolean strataDefined(IrisFormation f) {
return IrisProceduralBlocks.paletteSet(f.getStrataPalette());
private static boolean strataDefined(Formation f) {
return IrisProceduralBlocks.paletteSet(f.strataPalette());
}
}
@@ -18,8 +18,8 @@
package art.arcane.iris.engine.object.procedural.formation;
import art.arcane.iris.builtin.objects.formation.Formation;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.procedural.formation.IrisFormation;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.spi.PlatformBlockState;
@@ -33,18 +33,18 @@ public final class FormationGenerator {
private FormationGenerator() {
}
public static IrisObject generate(IrisFormation f, int variantIndex, RNG rng, IrisData data) {
int lo = Math.min(f.getHeightMin(), f.getHeightMax());
int hi = Math.max(f.getHeightMin(), f.getHeightMax());
public static IrisObject generate(Formation f, int variantIndex, RNG rng, IrisData data) {
int lo = Math.min(f.heightMin(), f.heightMax());
int hi = Math.max(f.heightMin(), f.heightMax());
int height = Math.max(3, rng.i(lo, hi + 1));
int wLo = Math.min(f.getBaseWidthMin(), f.getBaseWidthMax());
int wHi = Math.max(f.getBaseWidthMin(), f.getBaseWidthMax());
int wLo = Math.min(f.baseWidthMin(), f.baseWidthMax());
int wHi = Math.max(f.baseWidthMin(), f.baseWidthMax());
double baseRadius = Math.max(1, rng.i(wLo, wHi + 1));
FormationCanvas canvas = new FormationCanvas();
switch (f.getForm()) {
switch (f.form()) {
case SPIRE -> FormationShapeBuilder.spire(canvas, f, height, baseRadius, rng);
case HOODOO -> FormationShapeBuilder.hoodoo(canvas, f, height, baseRadius, rng);
case ARCH -> FormationShapeBuilder.arch(canvas, f, height, baseRadius, rng);
@@ -18,15 +18,16 @@
package art.arcane.iris.engine.object.procedural.formation;
import art.arcane.iris.engine.object.procedural.formation.IrisFormation;
import art.arcane.iris.builtin.objects.formation.Formation;
public final class FormationProfiles {
private FormationProfiles() {
}
public static double radiusAt(IrisFormation f, double baseRadius, double topRadius, double t) {
public static double radiusAt(Formation f, double baseRadius, double topRadius, double t) {
double clamped = Math.max(0.0, Math.min(1.0, t));
return switch (f.getProfile()) {
return switch (f.profile()) {
case CONSTANT -> baseRadius;
case LINEAR -> baseRadius + (topRadius - baseRadius) * clamped;
case TAPER -> baseRadius + (topRadius - baseRadius) * smoothstep(clamped);
@@ -35,9 +36,9 @@ public final class FormationProfiles {
};
}
private static double parabolic(IrisFormation f, double baseRadius, double topRadius, double t) {
double waist = Math.max(0.0, Math.min(1.0, f.getProfileWaist()));
double floor = Math.max(0.0, Math.min(1.0, f.getProfileWaistFloor()));
private static double parabolic(Formation f, double baseRadius, double topRadius, double t) {
double waist = Math.max(0.0, Math.min(1.0, f.profileWaist()));
double floor = Math.max(0.0, Math.min(1.0, f.profileWaistFloor()));
double denom = Math.pow(Math.max(waist, 1.0 - waist), 2);
if (denom == 0) {
denom = 1;
@@ -18,7 +18,7 @@
package art.arcane.iris.engine.object.procedural.formation;
import art.arcane.iris.engine.object.procedural.formation.IrisFormation;
import art.arcane.iris.builtin.objects.formation.Formation;
import art.arcane.iris.engine.object.procedural.tree.TreeFunctions;
import art.arcane.iris.util.common.math.Vector3i;
import art.arcane.volmlib.util.math.RNG;
@@ -30,11 +30,11 @@ public final class FormationShapeBuilder {
private FormationShapeBuilder() {
}
public static void spire(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
double topRadius = f.getTopWidth();
public static void spire(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
double topRadius = f.topWidth();
column(canvas, f, height, baseRadius, topRadius, 0, 0, rng, true);
double lean = Math.toRadians(f.getLean());
double azimuth = Math.toRadians(f.getLeanAzimuth());
double lean = Math.toRadians(f.lean());
double azimuth = Math.toRadians(f.leanAzimuth());
int previousX = 0;
int previousZ = 0;
for (int y = 0; y < height; y++) {
@@ -53,25 +53,25 @@ public final class FormationShapeBuilder {
}
}
public static void seaStack(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
public static void seaStack(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
double topRadius = Math.max(1.0, baseRadius * 0.55);
if (f.getTopWidth() > 0) {
topRadius = f.getTopWidth();
if (f.topWidth() > 0) {
topRadius = f.topWidth();
}
column(canvas, f, height, baseRadius, topRadius, 0, 0, rng, true);
}
public static void hoodoo(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
double topRadius = f.getTopWidth() > 0 ? f.getTopWidth() : Math.max(1.0, baseRadius * 0.7);
public static void hoodoo(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
double topRadius = f.topWidth() > 0 ? f.topWidth() : Math.max(1.0, baseRadius * 0.7);
column(canvas, f, height, baseRadius, topRadius, 0, 0, rng, false);
int capRadius = f.getHoodooCapRadius();
int capRadius = f.hoodooCapRadius();
if (capRadius <= 0) {
return;
}
int capHeight = Math.max(1, f.getHoodooCapHeight());
double lean = Math.toRadians(f.getLean());
double azimuth = Math.toRadians(f.getLeanAzimuth());
int capHeight = Math.max(1, f.hoodooCapHeight());
double lean = Math.toRadians(f.lean());
double azimuth = Math.toRadians(f.leanAzimuth());
double shear = Math.tan(lean) * height;
double topOffX = Math.cos(azimuth) * shear;
double topOffZ = Math.sin(azimuth) * shear;
@@ -85,12 +85,12 @@ public final class FormationShapeBuilder {
}
}
public static void boulder(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
public static void boulder(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
double rx = baseRadius;
double ry = Math.max(2.0, height * 0.5);
double rz = baseRadius * (0.8 + rng.d(0.0, 0.3));
double roughness = Math.max(0.0, Math.min(1.0, f.getRoughness()));
long noiseSeed = f.getSeed() + 4201L;
double roughness = Math.max(0.0, Math.min(1.0, f.roughness()));
long noiseSeed = f.seed() + 4201L;
int maxR = (int) Math.ceil(Math.max(rx, Math.max(ry, rz))) + 2;
for (int x = -maxR; x <= maxR; x++) {
@@ -109,10 +109,10 @@ public final class FormationShapeBuilder {
}
}
public static void arch(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
double span = Math.max(2.0, f.getArchSpan());
double tubeRadius = Math.max(0.75, f.getArchThickness() * 0.5);
double asymmetry = Math.max(0.0, Math.min(1.0, f.getArchAsymmetry()));
public static void arch(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
double span = Math.max(2.0, f.archSpan());
double tubeRadius = Math.max(0.75, f.archThickness() * 0.5);
double asymmetry = Math.max(0.0, Math.min(1.0, f.archAsymmetry()));
double leftFootX = -span * 0.5 - tubeRadius - rng.d(0.0, span * 0.16) * asymmetry;
double rightFootX = span * 0.5 + tubeRadius + rng.d(0.0, span * 0.16) * asymmetry;
double leftFootZ = rng.d(-tubeRadius * 0.45, tubeRadius * 0.45) * asymmetry;
@@ -164,10 +164,10 @@ public final class FormationShapeBuilder {
}
}
public static void basaltColumns(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
int count = Math.max(2, f.getBasaltColumns());
int colRadius = Math.max(1, f.getBasaltColumnRadius());
double variance = Math.max(0.0, Math.min(1.0, f.getBasaltHeightVariance()));
public static void basaltColumns(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
int count = Math.max(2, f.basaltColumns());
int colRadius = Math.max(1, f.basaltColumnRadius());
double variance = Math.max(0.0, Math.min(1.0, f.basaltHeightVariance()));
int spread = (int) Math.ceil(baseRadius);
for (int c = 0; c < count; c++) {
@@ -194,14 +194,14 @@ public final class FormationShapeBuilder {
}
}
public static void iceberg(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
public static void iceberg(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
long noiseSeed = rng.nextLong();
double bodyHeight = Math.max(2.0, height * 0.42);
double radiusX = baseRadius * rng.d(1.15, 1.5);
double radiusZ = baseRadius * rng.d(1.0, 1.35);
ellipsoid(canvas, radiusX, bodyHeight, radiusZ, bodyHeight * 0.36, noiseSeed, f.getRoughness());
ellipsoid(canvas, radiusX, bodyHeight, radiusZ, bodyHeight * 0.36, noiseSeed, f.roughness());
int peaks = Math.max(1, f.getIcebergPeaks());
int peaks = Math.max(1, f.icebergPeaks());
double phase = rng.d(0.0, Math.PI * 2.0);
for (int i = 0; i < peaks; i++) {
double angle = phase + (Math.PI * 2.0 * i / peaks) + rng.d(-0.35, 0.35);
@@ -215,9 +215,9 @@ public final class FormationShapeBuilder {
}
}
public static void fissure(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
int count = Math.max(2, f.getFractureCount());
double separation = Math.max(1.0, f.getFractureSeparation());
public static void fissure(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
int count = Math.max(2, f.fractureCount());
double separation = Math.max(1.0, f.fractureSeparation());
double shardRadius = Math.max(1.0, baseRadius / Math.max(1.6, count * 0.72));
double phase = rng.d(0.0, Math.PI * 2.0);
@@ -233,11 +233,11 @@ public final class FormationShapeBuilder {
}
}
public static void spiral(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
public static void spiral(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
int steps = Math.max(12, height * 4);
double turns = Math.max(0.25, f.getSpiralTurns());
double startRadius = Math.max(1.0, f.getSpiralRadius());
double startThickness = Math.max(1.0, f.getSpiralThickness());
double turns = Math.max(0.25, f.spiralTurns());
double startRadius = Math.max(1.0, f.spiralRadius());
double startThickness = Math.max(1.0, f.spiralThickness());
double phase = rng.d(0.0, Math.PI * 2.0);
long noiseSeed = rng.nextLong();
@@ -257,11 +257,11 @@ public final class FormationShapeBuilder {
(int) Math.round(Math.sin(phase) * startRadius), footRadius, false, rng);
}
public static void overhang(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, RNG rng) {
public static void overhang(FormationCanvas canvas, Formation f, int height, double baseRadius, RNG rng) {
int steps = Math.max(12, height * 4);
double reach = Math.max(1.0, f.getOverhangReach());
double drop = Math.max(0.0, f.getOverhangDrop());
double phase = Math.toRadians(f.getLeanAzimuth()) + rng.d(-0.18, 0.18);
double reach = Math.max(1.0, f.overhangReach());
double drop = Math.max(0.0, f.overhangDrop());
double phase = Math.toRadians(f.leanAzimuth()) + rng.d(-0.18, 0.18);
double trunkHeight = Math.max(3.0, height * 0.62);
long noiseSeed = rng.nextLong();
@@ -285,12 +285,12 @@ public final class FormationShapeBuilder {
}
}
private static void column(FormationCanvas canvas, IrisFormation f, int height, double baseRadius, double topRadius, int extraBaseX, int extraBaseZ, RNG rng, boolean capTop) {
double lean = Math.toRadians(f.getLean());
double azimuth = Math.toRadians(f.getLeanAzimuth());
double roughness = Math.max(0.0, Math.min(1.0, f.getRoughness()));
double jitter = Math.max(0.0, Math.min(1.0, f.getJitter()));
long noiseSeed = f.getSeed() + 9001L;
private static void column(FormationCanvas canvas, Formation f, int height, double baseRadius, double topRadius, int extraBaseX, int extraBaseZ, RNG rng, boolean capTop) {
double lean = Math.toRadians(f.lean());
double azimuth = Math.toRadians(f.leanAzimuth());
double roughness = Math.max(0.0, Math.min(1.0, f.roughness()));
double jitter = Math.max(0.0, Math.min(1.0, f.jitter()));
long noiseSeed = f.seed() + 9001L;
for (int y = 0; y < height; y++) {
double t = height <= 1 ? 1.0 : (y / (double) (height - 1));
@@ -311,7 +311,7 @@ public final class FormationShapeBuilder {
}
}
private static void ringDisc(FormationCanvas canvas, IrisFormation f, int cx, int y, int cz, double radius, double roughness, double jitter, long noiseSeed, boolean cap, RNG rng) {
private static void ringDisc(FormationCanvas canvas, Formation f, int cx, int y, int cz, double radius, double roughness, double jitter, long noiseSeed, boolean cap, RNG rng) {
int r = (int) Math.ceil(radius) + 1;
for (int x = -r; x <= r; x++) {
for (int z = -r; z <= r; z++) {
@@ -332,7 +332,7 @@ public final class FormationShapeBuilder {
}
}
private static void disc(FormationCanvas canvas, IrisFormation f, int cx, int y, int cz, double radius, boolean cap, RNG rng) {
private static void disc(FormationCanvas canvas, Formation f, int cx, int y, int cz, double radius, boolean cap, RNG rng) {
int r = (int) Math.ceil(radius) + 1;
for (int x = -r; x <= r; x++) {
for (int z = -r; z <= r; z++) {
@@ -347,11 +347,11 @@ public final class FormationShapeBuilder {
}
}
private static void taperedPeak(FormationCanvas canvas, IrisFormation f, int height, double radius,
private static void taperedPeak(FormationCanvas canvas, Formation f, int height, double radius,
int offsetX, int offsetZ, double leanAngle, double leanDistance, RNG rng) {
long noiseSeed = rng.nextLong();
double roughness = Math.max(0.0, Math.min(1.0, f.getRoughness()));
double jitter = Math.max(0.0, Math.min(1.0, f.getJitter()));
double roughness = Math.max(0.0, Math.min(1.0, f.roughness()));
double jitter = Math.max(0.0, Math.min(1.0, f.jitter()));
for (int y = 0; y < height; y++) {
double t = height <= 1 ? 1.0 : y / (double) (height - 1);
int x = offsetX + (int) Math.round(Math.cos(leanAngle) * leanDistance * t * t);
@@ -383,11 +383,11 @@ public final class FormationShapeBuilder {
}
}
private static void ball(FormationCanvas canvas, IrisFormation f, int centerX, int centerY, int centerZ,
private static void ball(FormationCanvas canvas, Formation f, int centerX, int centerY, int centerZ,
double radius, boolean cap, long noiseSeed, RNG rng) {
int extent = (int) Math.ceil(radius);
double roughness = Math.max(0.0, Math.min(1.0, f.getRoughness()));
double jitter = Math.max(0.0, Math.min(1.0, f.getJitter()));
double roughness = Math.max(0.0, Math.min(1.0, f.roughness()));
double jitter = Math.max(0.0, Math.min(1.0, f.jitter()));
for (int x = -extent; x <= extent; x++) {
for (int y = -extent; y <= extent; y++) {
for (int z = -extent; z <= extent; z++) {
@@ -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.engine.object.procedural.formation;
import art.arcane.iris.builtin.objects.formation.Formation;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.ResolvedProceduralPlacement;
import art.arcane.volmlib.util.math.RNG;
/** A rock formation made placeable: its variants are baked by {@link FormationGenerator}. */
public final class ResolvedFormation extends ResolvedProceduralPlacement {
private final Formation settings;
public ResolvedFormation(Formation settings) {
super(new Shape(settings.name(), settings.chance(), settings.density(), settings.seed(), settings.variants(), settings.mode(),
settings.rotation(), settings.clamp(), settings.carvingSupport(), settings.underwater(), settings.translate(),
settings.stiltSettings().orElse(null), settings.vacuumSettings().orElse(null)));
this.settings = settings;
}
@Override
protected void customize(IrisObjectPlacement placement) {
placement.setSurfaceSupportBuffer(settings.surfaceSupportBuffer());
}
@Override
protected IrisObject generate(int index, RNG rng, IrisData data) {
return FormationGenerator.generate(settings, index, rng, data);
}
}
@@ -18,8 +18,10 @@
package art.arcane.iris.engine.object.procedural.fungi;
import art.arcane.iris.engine.object.procedural.fungi.IrisFungus;
import art.arcane.iris.engine.object.procedural.fungi.IrisFungusCapShape;
import com.volmit.block.PaletteSpec;
import java.util.Optional;
import art.arcane.iris.builtin.objects.fungi.FungusCapShape;
import art.arcane.iris.builtin.objects.fungi.Fungus;
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.engine.object.procedural.tree.TreeFunctions;
@@ -31,17 +33,17 @@ public final class FungusCapBuilder {
private FungusCapBuilder() {
}
public static void build(Map<Vector3i, FungusCellRole> roles, IrisFungus fungus, int baseRadius, double cx, int baseY, double cz, long seed) {
int radius = (int) Math.round(baseRadius + Math.max(0.0, fungus.getCapOverhang()));
int thickness = Math.max(1, Math.min(3, fungus.getCapThickness()));
double squish = Math.max(0.0, Math.min(1.0, fungus.getCapSquish()));
double droop = Math.max(0.0, fungus.getCapDroop());
IrisFungusCapShape shape = fungus.getCapShape() == null ? IrisFungusCapShape.DOME : fungus.getCapShape();
public static void build(Map<Vector3i, FungusCellRole> roles, Fungus fungus, int baseRadius, double cx, int baseY, double cz, long seed) {
int radius = (int) Math.round(baseRadius + Math.max(0.0, fungus.capOverhang()));
int thickness = Math.max(1, Math.min(3, fungus.capThickness()));
double squish = Math.max(0.0, Math.min(1.0, fungus.capSquish()));
double droop = Math.max(0.0, fungus.capDroop());
FungusCapShape shape = fungus.capShape() == null ? FungusCapShape.DOME : fungus.capShape();
int icx = (int) Math.round(cx);
int icz = (int) Math.round(cz);
boolean hasGill = blockOrPaletteSet(fungus.getGillBlock(), fungus.getGillPalette());
boolean hasSpot = blockOrPaletteSet(fungus.getSpotBlock(), fungus.getSpotPalette());
boolean hasGill = blockOrPaletteSet(fungus.gillBlock(), fungus.gillPalette());
boolean hasSpot = blockOrPaletteSet(fungus.spotBlock(), fungus.spotPalette());
double apexRise = apexRise(shape, radius) * (1.0 - 0.6 * squish);
double droopReach = Math.tan(Math.toRadians(droop)) * radius;
@@ -68,9 +70,9 @@ public final class FungusCapBuilder {
boolean underside = layer == thickness - 1;
boolean topFace = layer == 0;
if (underside && hasGill && rollNoise(icx + dx, y, icz + dz, seed + 4111L) <= fungus.getGillChance()) {
if (underside && hasGill && rollNoise(icx + dx, y, icz + dz, seed + 4111L) <= fungus.gillChance()) {
role = FungusCellRole.GILL;
} else if (topFace && hasSpot && spotNoise(icx + dx, y, icz + dz, seed + 9311L) <= fungus.getSpotChance()) {
} else if (topFace && hasSpot && spotNoise(icx + dx, y, icz + dz, seed + 9311L) <= fungus.spotChance()) {
role = FungusCellRole.SPOT;
}
@@ -80,7 +82,7 @@ public final class FungusCapBuilder {
}
}
private static double apexRise(IrisFungusCapShape shape, int radius) {
private static double apexRise(FungusCapShape shape, int radius) {
return switch (shape) {
case DOME -> radius * 0.85;
case CONICAL -> radius * 1.4;
@@ -90,7 +92,7 @@ public final class FungusCapBuilder {
};
}
private static double capSurface(IrisFungusCapShape shape, double normalized, double apexRise) {
private static double capSurface(FungusCapShape shape, double normalized, double apexRise) {
double n = Math.max(0.0, Math.min(1.0, normalized));
return switch (shape) {
case DOME -> apexRise * Math.sqrt(Math.max(0.0, 1.0 - n * n));
@@ -109,10 +111,10 @@ public final class FungusCapBuilder {
return TreeFunctions.valueNoise3D(Math.floorDiv(x, 2), y, Math.floorDiv(z, 2), seed);
}
static boolean blockOrPaletteSet(String block, IrisMaterialPalette palette) {
static boolean blockOrPaletteSet(Optional<String> block, Optional<PaletteSpec> palette) {
if (IrisProceduralBlocks.paletteSet(palette)) {
return true;
}
return block != null && !block.isEmpty();
return block.filter(name -> !name.isEmpty()).isPresent();
}
}
@@ -18,8 +18,8 @@
package art.arcane.iris.engine.object.procedural.fungi;
import art.arcane.iris.builtin.objects.fungi.Fungus;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.procedural.fungi.IrisFungus;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.spi.PlatformBlockState;
@@ -33,11 +33,11 @@ public final class FungusGenerator {
private FungusGenerator() {
}
public static IrisObject generate(IrisFungus fungus, int height, RNG rng, IrisData data) {
public static IrisObject generate(Fungus fungus, int height, RNG rng, IrisData data) {
Map<Vector3i, FungusCellRole> roles = new HashMap<>();
long baseSeed = rng.getSeed();
if (fungus.isShelf()) {
if (fungus.shelf()) {
FungusShelfBuilder.build(roles, fungus, rng, baseSeed);
} else {
buildUpright(roles, fungus, height, rng, baseSeed);
@@ -47,7 +47,7 @@ public final class FungusGenerator {
return null;
}
RNG paletteRng = new RNG(fungus.getSeed());
RNG paletteRng = new RNG(fungus.seed());
Map<Vector3i, PlatformBlockState> resolved = new HashMap<>();
for (Map.Entry<Vector3i, FungusCellRole> entry : roles.entrySet()) {
Vector3i pos = entry.getKey();
@@ -61,7 +61,7 @@ public final class FungusGenerator {
return IrisProceduralBlocks.assemble(resolved);
}
private static void buildUpright(Map<Vector3i, FungusCellRole> roles, IrisFungus fungus, int height, RNG rng, long baseSeed) {
private static void buildUpright(Map<Vector3i, FungusCellRole> roles, Fungus fungus, int height, RNG rng, long baseSeed) {
int stemHeight = Math.max(1, height);
Map<Vector3i, PlatformBlockState> stemCells = new HashMap<>();
double[] top = FungusStemBuilder.build(stemCells, fungus, stemHeight, baseSeed);
@@ -76,28 +76,28 @@ public final class FungusGenerator {
FungusCapBuilder.build(roles, fungus, radius, cx, capBaseY, cz, baseSeed + 5557L);
}
private static int pickRadius(IrisFungus fungus, RNG rng) {
int lo = Math.min(fungus.getCapRadiusMin(), fungus.getCapRadiusMax());
int hi = Math.max(fungus.getCapRadiusMin(), fungus.getCapRadiusMax());
private static int pickRadius(Fungus fungus, RNG rng) {
int lo = Math.min(fungus.capRadiusMin(), fungus.capRadiusMax());
int hi = Math.max(fungus.capRadiusMin(), fungus.capRadiusMax());
lo = Math.max(1, lo);
hi = Math.max(lo, hi);
return rng.i(lo, hi + 1);
}
private static PlatformBlockState resolveRole(IrisFungus fungus, FungusCellRole role, IrisData data, Vector3i pos, RNG paletteRng) {
private static PlatformBlockState resolveRole(Fungus fungus, FungusCellRole role, IrisData data, Vector3i pos, RNG paletteRng) {
int x = pos.getBlockX();
int y = pos.getBlockY();
int z = pos.getBlockZ();
return switch (role) {
case STEM -> IrisProceduralBlocks.resolve(fungus.getStem(), fungus.getStemPalette(), data, x, y, z, paletteRng);
case CAP -> IrisProceduralBlocks.resolve(fungus.getCap(), fungus.getCapPalette(), data, x, y, z, paletteRng);
case STEM -> IrisProceduralBlocks.resolve(fungus.stem(), fungus.stemPalette(), data, x, y, z, paletteRng);
case CAP -> IrisProceduralBlocks.resolve(fungus.cap(), fungus.capPalette(), data, x, y, z, paletteRng);
case GILL -> {
PlatformBlockState gill = IrisProceduralBlocks.resolve(fungus.getGillBlock(), fungus.getGillPalette(), data, x, y, z, paletteRng);
yield gill != null ? gill : IrisProceduralBlocks.resolve(fungus.getCap(), fungus.getCapPalette(), data, x, y, z, paletteRng);
PlatformBlockState gill = IrisProceduralBlocks.resolve(fungus.gillBlock(), fungus.gillPalette(), data, x, y, z, paletteRng);
yield gill != null ? gill : IrisProceduralBlocks.resolve(fungus.cap(), fungus.capPalette(), data, x, y, z, paletteRng);
}
case SPOT -> {
PlatformBlockState spot = IrisProceduralBlocks.resolve(fungus.getSpotBlock(), fungus.getSpotPalette(), data, x, y, z, paletteRng);
yield spot != null ? spot : IrisProceduralBlocks.resolve(fungus.getCap(), fungus.getCapPalette(), data, x, y, z, paletteRng);
PlatformBlockState spot = IrisProceduralBlocks.resolve(fungus.spotBlock(), fungus.spotPalette(), data, x, y, z, paletteRng);
yield spot != null ? spot : IrisProceduralBlocks.resolve(fungus.cap(), fungus.capPalette(), data, x, y, z, paletteRng);
}
};
}
@@ -18,7 +18,7 @@
package art.arcane.iris.engine.object.procedural.fungi;
import art.arcane.iris.engine.object.procedural.fungi.IrisFungus;
import art.arcane.iris.builtin.objects.fungi.Fungus;
import art.arcane.iris.engine.object.procedural.tree.TreeFunctions;
import art.arcane.iris.util.common.math.Vector3i;
import art.arcane.volmlib.util.math.RNG;
@@ -29,20 +29,20 @@ public final class FungusShelfBuilder {
private FungusShelfBuilder() {
}
public static void build(Map<Vector3i, FungusCellRole> roles, IrisFungus fungus, RNG rng, long seed) {
int radius = Math.max(1, fungus.getShelfRadius());
public static void build(Map<Vector3i, FungusCellRole> roles, Fungus fungus, RNG rng, long seed) {
int radius = Math.max(1, fungus.shelfRadius());
double azimuth = rng.d(0.0, Math.PI * 2.0);
double fanX = Math.sin(azimuth);
double fanZ = Math.cos(azimuth);
int stubHeight = Math.max(0, Math.min(2, fungus.getStemWidth()));
int stubHeight = Math.max(0, Math.min(2, fungus.stemWidth()));
for (int y = 0; y < stubHeight; y++) {
roles.put(new Vector3i(0, y, 0), FungusCellRole.STEM);
}
int fanY = stubHeight;
boolean hasGill = FungusCapBuilder.blockOrPaletteSet(fungus.getGillBlock(), fungus.getGillPalette());
boolean hasSpot = FungusCapBuilder.blockOrPaletteSet(fungus.getSpotBlock(), fungus.getSpotPalette());
boolean hasGill = FungusCapBuilder.blockOrPaletteSet(fungus.gillBlock(), fungus.gillPalette());
boolean hasSpot = FungusCapBuilder.blockOrPaletteSet(fungus.spotBlock(), fungus.spotPalette());
for (int dx = -radius; dx <= radius; dx++) {
for (int dz = -radius; dz <= radius; dz++) {
@@ -59,12 +59,12 @@ public final class FungusShelfBuilder {
int y = fanY + lift;
FungusCellRole role = FungusCellRole.CAP;
if (hasSpot && spotNoise(dx, y, dz, seed + 9311L) <= fungus.getSpotChance()) {
if (hasSpot && spotNoise(dx, y, dz, seed + 9311L) <= fungus.spotChance()) {
role = FungusCellRole.SPOT;
}
roles.putIfAbsent(new Vector3i(dx, y, dz), role);
if (hasGill && rollNoise(dx, y - 1, dz, seed + 4111L) <= fungus.getGillChance()) {
if (hasGill && rollNoise(dx, y - 1, dz, seed + 4111L) <= fungus.gillChance()) {
roles.putIfAbsent(new Vector3i(dx, y - 1, dz), FungusCellRole.GILL);
}
}
@@ -18,7 +18,7 @@
package art.arcane.iris.engine.object.procedural.fungi;
import art.arcane.iris.engine.object.procedural.fungi.IrisFungus;
import art.arcane.iris.builtin.objects.fungi.Fungus;
import art.arcane.iris.engine.object.procedural.tree.TreeFunctions;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.util.common.math.Vector3i;
@@ -29,15 +29,15 @@ public final class FungusStemBuilder {
private FungusStemBuilder() {
}
public static double[] build(Map<Vector3i, PlatformBlockState> stemCells, IrisFungus fungus, int stemHeight, long seed) {
int width = Math.max(1, Math.min(3, fungus.getStemWidth()));
double maxLean = stemHeight * Math.tan(Math.toRadians(Math.max(0.0, fungus.getStemCurve())));
double leanRad = Math.toRadians(fungus.getStemLeanAzimuth());
public static double[] build(Map<Vector3i, PlatformBlockState> stemCells, Fungus fungus, int stemHeight, long seed) {
int width = Math.max(1, Math.min(3, fungus.stemWidth()));
double maxLean = stemHeight * Math.tan(Math.toRadians(Math.max(0.0, fungus.stemCurve())));
double leanRad = Math.toRadians(fungus.stemLeanAzimuth());
double leanX = Math.sin(leanRad);
double leanZ = Math.cos(leanRad);
double waveAmp = Math.max(0.0, fungus.getStemWaveAmplitude());
double wavePeriods = fungus.getStemWavePeriods() == 0 ? 1.0 : fungus.getStemWavePeriods();
double waveAzimuth = Math.toRadians(fungus.getStemLeanAzimuth() + 90.0);
double waveAmp = Math.max(0.0, fungus.stemWaveAmplitude());
double wavePeriods = fungus.stemWavePeriods() == 0 ? 1.0 : fungus.stemWavePeriods();
double waveAzimuth = Math.toRadians(fungus.stemLeanAzimuth() + 90.0);
double waveX = Math.sin(waveAzimuth);
double waveZ = Math.cos(waveAzimuth);
@@ -0,0 +1,74 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.procedural.fungi;
import art.arcane.iris.builtin.objects.fungi.Fungus;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.ResolvedProceduralPlacement;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
/** A fungus made placeable: its variants are baked by {@link FungusGenerator}. */
public final class ResolvedFungus extends ResolvedProceduralPlacement {
private final Fungus settings;
public ResolvedFungus(Fungus settings) {
super(new Shape(settings.name(), settings.chance(), settings.density(), settings.seed(), settings.variants(), settings.mode(),
settings.rotation(), settings.clamp(), settings.carvingSupport(), settings.underwater(), settings.translate(),
settings.stiltSettings().orElse(null), settings.vacuumSettings().orElse(null)));
this.settings = settings;
}
@Override
protected IrisObject generate(int index, RNG rng, IrisData data) {
throw new UnsupportedOperationException("A fungus bakes its variants itself, from the stem heights");
}
@Override
protected KList<IrisObject> bake(IrisData data) {
KList<IrisObject> baked = new KList<>();
int count = variantCount();
int lo = Math.min(settings.stemHeightMin(), settings.stemHeightMax());
int hi = Math.max(settings.stemHeightMin(), settings.stemHeightMax());
RNG heightRng = new RNG(seed());
for (int i = 0; i < count; i++) {
int height;
if (count == 1 || lo == hi) {
height = heightRng.i(lo, hi + 1);
} else {
double step = (hi - lo) / (double) (count - 1);
double base = lo + step * i;
double jitter = heightRng.d(-step * 0.3, step * 0.3);
height = (int) Math.round(Math.max(lo, Math.min(hi, base + jitter)));
}
IrisObject object = FungusGenerator.generate(settings, Math.max(1, height), variantRng(i), data);
if (object == null || object.getBlocks().isEmpty()) {
continue;
}
object.setLoadKey("procedural/" + getName() + "#" + i);
object.setLoader(data);
baked.add(object);
}
return baked;
}
}
Loaded 100 of 126 files, more files were not shown because too many files have changed in this diff. Show more