Caves and floating islands are settings of iris:carve and iris:floating

caveProfile (CaveProfile is the feature, held by dimension, region and biome), carving (CarvingSettings of CarvingEntry),
carvingEnabled, carvingBiome and caveMinDepthBelowSurface are iris:carve settings; floatingChildBiomes and
mergeFloatingChildBiomes are iris:floating settings, all under the keys and shapes packs always wrote. CarvingEntry is
IrisApi-typed; ResolvedCarvingEntry, CarvingBands (the world's bands) and CarvingResolver (was IrisDimensionCarvingResolver)
hold the behaviour, CaveProfiles and FloatingChildren read the settings. iris:carve provides CaveBiomes (CaveBiomeBands).
CarvingBiomeSettings, CarvingSettings and FloatingChildSettings implement LinkedBiomes, so the biome tree and the biomes a
dimension reaches learn of the biomes they name without reading the classes. IrisBiome, IrisRegion and IrisDimension lose the
fields, the carving entry index and getRealCarvingBiome; IrisDimensionCarvingEntry is deleted. CaveApplying and DepositPlacer
no longer thread a resolver state through the cave biome lookup.
This commit is contained in:
piexel committed 2026-10-10 08:51:28 +02:00
1 parent 6617cc3957
commit cff492ada8
32 files changed
+927 -356

No files matched your search

+14 -2
View File
@@ -49,8 +49,8 @@ only: `DepositSettings` holds `DepositGenerator`s (blocks as `BlockSpec`, its en
`art.arcane.iris.builtin.deposit`), and packs write `"deposits": [...]`, as they always have (`@Feature(key = "deposits", root = "generators")`: the key holds the one option's list). What needs Iris (resolving the
palette, ore checks, clump shapes per world seed) lives in the module's own code, `ResolvedDeposit`.
Settings that live inside a class of Iris's own, such as an object placement's clamp, stilt, vacuum and edit settings, its slope condition,
a cave profile, a floating child biome or a procedural coral, are module-owned classes too (`art.arcane.iris.builtin.validate`,
Settings that live inside a class of Iris's own, such as an object placement's clamp, stilt, vacuum and edit settings, its slope condition
or a procedural coral, are module-owned classes too (`art.arcane.iris.builtin.validate`,
`.stilt`, `.vacuum`, `.blocks`, `.prepare`, `.carve`, `.floating`, `.objects.*`). The module registers each with
`registry.registerHeldType(...)` so studio describes it from the module's own annotations; packs write the same JSON as before. Behaviour
that needs Iris (noise built from the styles, blocks resolved through the pack, baked object variants) lives in `Resolved*` classes beside the
@@ -64,6 +64,18 @@ seed is the world's decorator seed, its biome's key and its place in the biome's
them ahead of generation; `iris:terrain` and `iris:objects` warm their ore generators, placements and procedural
objects the same way.
Caves, floating islands and ores are settings of their modules too, written under the keys they always had. `iris:carve` owns
`caveProfile` (dimension, region, biome; an object, or a `snippet/cave-profile/...` reference), `carving` (dimension; a list of bands) and
`carvingEnabled` (dimension; a boolean), `carvingBiome` (biome; a biome key) and `caveMinDepthBelowSurface` (biome; a number). `iris:floating`
owns `floatingChildBiomes` (biome; a list) and `mergeFloatingChildBiomes` (biome; a boolean). `iris:terrain` owns `ores` (dimension, region,
biome; a list of generators) and `hideOresForHiddenOre` (dimension; a boolean); `iris:deposit` owns `depositVariants` (dimension, region, biome; a list)
and `oreDepositFrequencyMultiplier` and `oreDepositSizeMultiplier` (biome; numbers). Behaviour that needs Iris lives in the `Resolved*` classes beside the
workers: `ResolvedOre`/`ResolvedOres` (blocks and chance noise per world, `TerrainOres` the world's state), `ResolvedDepositVariant`,
`ResolvedCarvingEntry`/`CarvingBands`/`CarvingResolver` (the band for a position) and `ResolvedFloatingChild`. The settings that name biomes
(`carvingBiome`, a band's biome, a floating child's target and carving) implement `LinkedBiomes`, which is how Iris's biome tree and the biomes a
dimension reaches learn of them without reading the settings classes; and `iris:carve` provides the `CaveBiomes` service
(`CaveBiomeBands`), which Iris asks for the dimension's carving band at a position and for a biome's minimum cave depth.
Packs write each settings feature under the short key it declares: `deposits` (dimension, region, biome; a list), `decorators`
(biome; a list) and `importedStructures` (dimension; an object of `disabled`, `adjustments` and the rest). The feature ids
(`iris:deposit`, `iris:decorant`, `iris:structure`) stay the modules' identity in the stage graph and logs. A key is unique
@@ -0,0 +1,54 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.carve;
import com.volmit.FeatureAttachment.Target;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.LinkedBiomes;
import com.volmit.config.Ref;
import com.volmit.config.Reference;
import java.util.Set;
/** A biome's {@code carvingBiome}, written as the biome key: it registers that biome with the pack's layout and is not applied as a substitute under carvings. */
@Desc("Registers the referenced biome with this pack's reachable biome set. It is NOT applied as a substitute under carvings; cave biomes come from the region's caveBiomes list.")
@Feature(id = "iris:carve/biome", name = "Carving biome", key = "carvingBiome", root = "biome", targets = Target.BIOME)
public final class CarvingBiomeSettings implements IrisFeature, LinkedBiomes {
@Ref(Reference.PACK_BIOME)
@Desc("Registers the referenced biome with this pack's reachable biome set. It is NOT applied as a substitute under carvings; cave biomes come from the region's caveBiomes list.")
private String biome = "";
public CarvingBiomeSettings() {
}
public CarvingBiomeSettings(String biome) {
this.biome = biome;
}
public String biome() {
return biome == null ? "" : biome;
}
@Override
public Set<String> treeBiomes() {
return Set.of(biome());
}
}
@@ -0,0 +1,43 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.carve;
import com.volmit.FeatureAttachment.Target;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** A dimension's {@code carvingEnabled}, written as the bare boolean. */
@Desc("Enable or disable all carving for this dimension")
@Feature(id = "iris:carve/enabled", name = "Carving enabled", key = "carvingEnabled", root = "enabled", targets = Target.DIMENSION)
public final class CarvingEnabledSettings implements IrisFeature {
@Desc("Enable or disable all carving for this dimension")
private boolean enabled = true;
public CarvingEnabledSettings() {
}
public CarvingEnabledSettings(boolean enabled) {
this.enabled = enabled;
}
public boolean enabled() {
return enabled;
}
}
@@ -0,0 +1,103 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.carve;
import com.volmit.config.Desc;
import com.volmit.config.Range;
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;
/**
* One dimension-level cave biome override, an entry of {@code carving}: a pack biome that replaces the cave biome within a band
* of world Y, optionally split into child entries by a noise pattern. IrisApi types only; {@code CarvingResolver} picks
* the entry for a position.
*/
@Snippet("dimension-carving-entry")
@Desc("Dimension-level cave biome override with absolute world Y bounds.")
public final class CarvingEntry {
private static final double DEFAULT_WORLD_Y_MIN = -64;
private static final double DEFAULT_WORLD_Y_MAX = 320;
private static final double DEFAULT_CHILD_SHRINK_FACTOR = 1.5;
private static final int DEFAULT_CHILD_RECURSION_DEPTH = 3;
@Desc("Stable id for this carving entry")
private String id = "";
@Desc("Enable or disable this carving entry")
private boolean enabled = true;
@Ref(Reference.PACK_BIOME)
@Desc("Cave biome to apply when world Y falls within worldYRange")
private String biome = "";
@Desc("Absolute world Y bounds where this carving entry applies")
private Range worldYRange = Range.of(DEFAULT_WORLD_Y_MIN, DEFAULT_WORLD_Y_MAX);
@Desc("If this carving entry has child carving entries, this controls how small those child carving patches are.")
private double childShrinkFactor = DEFAULT_CHILD_SHRINK_FACTOR;
@Desc("If this carving entry has child carving entries, this controls the shape pattern used to pick them.")
private NoiseStyle childStyle = NoiseStyle.of("CELLULAR_IRIS_DOUBLE");
@Desc("Child carving entry ids. Child ids can point back to parent ids to create cycles; recursion is bounded by childRecursionDepth.")
private List<String> children = List.of();
@Desc("Maximum recursion depth when resolving child carving entries from this entry.")
private int childRecursionDepth = DEFAULT_CHILD_RECURSION_DEPTH;
public CarvingEntry() {
}
public String id() {
return id == null ? "" : id;
}
public boolean enabled() {
return enabled;
}
public String biome() {
return biome == null ? "" : biome;
}
public Range worldYRange() {
return worldYRange;
}
public double childShrinkFactor() {
return childShrinkFactor;
}
public NoiseStyle childStyle() {
return childStyle;
}
public List<String> children() {
return children == null ? List.of() : Collections.unmodifiableList(children);
}
public int childRecursionDepth() {
return childRecursionDepth;
}
}
@@ -0,0 +1,80 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.carve;
import com.volmit.FeatureAttachment.Target;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.LinkedBiomes;
import com.volmit.config.MinItems;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
/**
* The cave biome overrides a dimension declares, written as {@code "carving": [...]}, the list of {@link CarvingEntry}s.
* The biome of every enabled entry takes part in the pack's layout like any biome the dimension reaches.
*/
@Desc("Dimension-level cave biome carving overrides with absolute world Y ranges")
@Feature(id = "iris:carve/bands", name = "Cave biome bands", key = "carving", root = "entries", targets = Target.DIMENSION)
public final class CarvingSettings implements IrisFeature, LinkedBiomes {
@MinItems(1)
@Desc("Dimension-level cave biome carving overrides with absolute world Y ranges")
private List<CarvingEntry> entries = List.of();
public CarvingSettings() {
}
public CarvingSettings(List<CarvingEntry> entries) {
this.entries = List.copyOf(entries);
}
public List<CarvingEntry> entries() {
return entries == null ? List.of() : Collections.unmodifiableList(entries);
}
/**
* The biome key {@code reference} stands for: the biome of the entry with that id, ignoring surrounding blanks, or
* {@code reference} itself when no entry has the id. When several entries share an id the last one counts.
*/
public String biomeOf(String reference) {
CarvingEntry entry = null;
for (CarvingEntry candidate : entries()) {
if (candidate != null && !candidate.id().isBlank() && candidate.id().trim().equals(reference)) {
entry = candidate;
}
}
return entry == null ? reference : entry.biome();
}
@Override
public Set<String> usedBiomes(Collection<IrisFeature> dimension) {
Set<String> biomes = new LinkedHashSet<>();
for (CarvingEntry entry : entries()) {
if (entry != null && entry.enabled()) {
biomes.add(entry.biome());
}
}
return biomes;
}
}
@@ -0,0 +1,47 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.carve;
import com.volmit.FeatureAttachment.Target;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinNumber;
/** A biome's {@code caveMinDepthBelowSurface}, written as the bare number of blocks. */
@Desc("Minimum depth below terrain surface required before this cave biome can be selected.")
@Feature(id = "iris:carve/min-depth", name = "Cave minimum depth", key = "caveMinDepthBelowSurface", root = "depth", targets = Target.BIOME)
public final class CaveDepthSettings implements IrisFeature {
@MinNumber(0)
@MaxNumber(256)
@Desc("Minimum depth below terrain surface required before this cave biome can be selected.")
private int depth = 0;
public CaveDepthSettings() {
}
public CaveDepthSettings(int depth) {
this.depth = depth;
}
public int depth() {
return depth;
}
}
@@ -19,7 +19,10 @@
package art.arcane.iris.builtin.carve;
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
import com.volmit.FeatureAttachment.Target;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.MaxNumber;
import com.volmit.config.MinItems;
import com.volmit.config.MinNumber;
@@ -35,11 +38,13 @@ 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.
* cave fluid may sit and how objects find anchors in them. A level that writes none has no profile, which is the
* same as one that is not {@code enabled}. IrisApi types only; the carving module builds the noise.
*/
@Snippet("cave-profile")
@Desc("Represents a configurable 3D cave profile.")
public final class CaveProfile {
@Feature(id = "iris:carve/profile", name = "Cave profile", key = "caveProfile", targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
public final class CaveProfile implements IrisFeature {
@Desc("Enable profile-driven cave carving.")
private boolean enabled = false;
@@ -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.floating;
import art.arcane.iris.builtin.carve.CarvingSettings;
import com.volmit.FeatureAttachment.Target;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
import com.volmit.config.LinkedBiomes;
import com.volmit.config.MinItems;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
/**
* The floating child biomes one biome declares, written as {@code "floatingChildBiomes": [...]}, the list of
* {@link FloatingChildBiome}s. The target biome of every child, and the biome its {@code carving} names, take part in the
* pack's layout like any biome a dimension reaches.
*/
@Desc("Floating child biomes that procedurally generate above this biome's terrain. Each entry references a target biome whose layers, decorators, and objects drive the floating island's visual design, while the config here drives size, shape, altitude, rarity, and water level. Multiple entries are supported and selected by rarity per column unless mergeFloatingChildBiomes is enabled.")
@Feature(id = "iris:floating/children", name = "Floating child biomes", key = "floatingChildBiomes", root = "children", targets = Target.BIOME)
public final class FloatingChildSettings implements IrisFeature, LinkedBiomes {
@MinItems(1)
@Desc("Floating child biomes that procedurally generate above this biome's terrain. Each entry references a target biome whose layers, decorators, and objects drive the floating island's visual design, while the config here drives size, shape, altitude, rarity, and water level. Multiple entries are supported and selected by rarity per column unless mergeFloatingChildBiomes is enabled.")
private List<FloatingChildBiome> children = List.of();
public FloatingChildSettings() {
}
public FloatingChildSettings(List<FloatingChildBiome> children) {
this.children = List.copyOf(children);
}
public List<FloatingChildBiome> children() {
return children == null ? List.of() : Collections.unmodifiableList(children);
}
@Override
public Set<String> usedBiomes(Collection<IrisFeature> dimension) {
CarvingSettings carving = dimension.stream().filter(CarvingSettings.class::isInstance).map(CarvingSettings.class::cast).findFirst().orElse(null);
Set<String> biomes = new LinkedHashSet<>();
for (FloatingChildBiome child : children()) {
if (child != null) {
biomes.add(child.biome());
biomes.add(carving == null ? child.carving() : carving.biomeOf(child.carving()));
}
}
return biomes;
}
}
@@ -0,0 +1,43 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.floating;
import com.volmit.FeatureAttachment.Target;
import com.volmit.IrisFeature;
import com.volmit.config.Desc;
import com.volmit.config.Feature;
/** A biome's {@code mergeFloatingChildBiomes}, written as the bare boolean. */
@Desc("When true, every floating child entry is sampled independently and their solid masks are unioned, so multiple floating islands can stack, overlap, and collide instead of the picker choosing only one child per column.")
@Feature(id = "iris:floating/merge", name = "Merge floating child biomes", key = "mergeFloatingChildBiomes", root = "merge", targets = Target.BIOME)
public final class MergeFloatingChildrenSettings implements IrisFeature {
@Desc("When true, every floating child entry is sampled independently and their solid masks are unioned, so multiple floating islands can stack, overlap, and collide instead of the picker choosing only one child per column.")
private boolean merge = false;
public MergeFloatingChildrenSettings() {
}
public MergeFloatingChildrenSettings(boolean merge) {
this.merge = merge;
}
public boolean merge() {
return merge;
}
}
@@ -105,13 +105,21 @@ final class ResolvedOre {
if (settings.palette().palette().isEmpty()) {
return null;
}
NoiseSampler sampler = chance.aquire(() -> noise.sampler(settings.chanceStyle(), terrainSeed));
if (sampler.sample(x, y, z) > settings.threshold()) {
if (chanceNoise().sample(x, y, z) > settings.threshold()) {
return null;
}
return pick(x, y, z);
}
/** The chance noise, which this runs per block of the terrain, so a built one is read without creating a supplier. */
private NoiseSampler chanceNoise() {
NoiseSampler built = chance.getIfPresent();
if (built != null) {
return built;
}
return chance.aquire(() -> noise.sampler(settings.chanceStyle(), terrainSeed));
}
private PlatformBlockState pick(int x, int y, int z) {
if (blocks.isEmpty()) {
return null;
@@ -42,12 +42,19 @@ final class TerrainOres {
return engine.getGeneration().state(TerrainOres.class, TerrainOres::new);
}
/** The ore generators {@code owner}, a dimension, region or biome, declares; {@link ResolvedOres#NONE} when it declares none. */
/**
* The ore generators {@code owner}, a dimension, region or biome, declares; {@link ResolvedOres#NONE} when it declares none. The
* terrain asks this for two owners per column, so a resolved set is read without taking the map's lock.
*/
ResolvedOres of(IrisRegistrant owner) {
OreSettings settings = owner.getModuleSettings().find(OreSettings.class).orElse(null);
if (settings == null) {
return ResolvedOres.NONE;
}
ResolvedOres existing = resolved.get(settings);
if (existing != null) {
return existing;
}
return resolved.computeIfAbsent(settings, declared -> ResolvedOres.of(declared, engine));
}
}
@@ -19,13 +19,17 @@
package art.arcane.iris.engine.mantle.components;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.core.modules.IrisValues;
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.terrain.carving.CaveProfiles;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingEntry;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
import art.arcane.iris.engine.object.terrain.carving.ResolvedCarvingEntry;
import art.arcane.iris.engine.modifier.CaveBiomeBands;
import art.arcane.iris.engine.object.terrain.carving.CarvingBands;
import art.arcane.iris.engine.object.terrain.carving.CarvingResolver;
import art.arcane.iris.engine.object.world.region.IrisRegion;
import art.arcane.iris.engine.object.value.IrisRange;
import art.arcane.iris.spi.PlatformBlockState;
@@ -89,7 +93,7 @@ public class CaveCarving {
/** Carves the caves of the chunk at chunk coordinates {@code x}, {@code z} into {@code writer}. */
public void carve(MantleWriter writer, int x, int z, ChunkContext context) {
IrisComplex complex = context.getComplex();
IrisDimensionCarvingResolver.State resolverState = new IrisDimensionCarvingResolver.State();
CarvingResolver.State resolverState = new CarvingResolver.State();
BlendScratch blendScratch = BLEND_SCRATCH.get();
int[] chunkSurfaceHeights = prepareChunkSurfaceHeights(x, z, context, blendScratch.chunkSurfaceHeights);
PrecisionStopwatch resolveStopwatch = PrecisionStopwatch.start();
@@ -200,7 +204,7 @@ public class CaveCarving {
}
}
private List<WeightedProfile> resolveWeightedProfiles(int chunkX, int chunkZ, IrisComplex complex, IrisDimensionCarvingResolver.State resolverState) {
private List<WeightedProfile> resolveWeightedProfiles(int chunkX, int chunkZ, IrisComplex complex, CarvingResolver.State resolverState) {
BlendScratch blendScratch = BLEND_SCRATCH.get();
CaveProfile[] profileField = blendScratch.profileField;
Map<CaveProfile, double[]> columnProfileWeights = blendScratch.columnProfileWeights;
@@ -296,40 +300,40 @@ public class CaveCarving {
return resolvedProfiles;
}
private List<WeightedProfile> resolveDimensionCarvingProfiles(int chunkX, int chunkZ, IrisDimensionCarvingResolver.State resolverState, BlendScratch blendScratch) {
private List<WeightedProfile> resolveDimensionCarvingProfiles(int chunkX, int chunkZ, CarvingResolver.State resolverState, BlendScratch blendScratch) {
List<WeightedProfile> weightedProfiles = new ArrayList<>();
List<IrisDimensionCarvingEntry> entries = engine.getDimension().getCarving();
if (entries == null || entries.isEmpty()) {
List<ResolvedCarvingEntry> entries = CarvingBands.of(engine).entries();
if (entries.isEmpty()) {
return weightedProfiles;
}
Map<IrisDimensionCarvingEntry, IrisDimensionCarvingEntry[]> dimensionColumnPlans = blendScratch.dimensionColumnPlans;
Map<ResolvedCarvingEntry, ResolvedCarvingEntry[]> dimensionColumnPlans = blendScratch.dimensionColumnPlans;
dimensionColumnPlans.clear();
for (IrisDimensionCarvingEntry entry : entries) {
if (entry == null || !entry.isEnabled()) {
for (ResolvedCarvingEntry entry : entries) {
if (!entry.enabled()) {
continue;
}
IrisBiome rootBiome = IrisDimensionCarvingResolver.resolveEntryBiome(engine, entry, resolverState);
IrisBiome rootBiome = CarvingResolver.resolveEntryBiome(engine, entry, resolverState);
if (rootBiome == null) {
continue;
}
IrisDimensionCarvingEntry[] columnPlan = dimensionColumnPlans.computeIfAbsent(entry, key -> new IrisDimensionCarvingEntry[CHUNK_AREA]);
ResolvedCarvingEntry[] columnPlan = dimensionColumnPlans.computeIfAbsent(entry, key -> new ResolvedCarvingEntry[CHUNK_AREA]);
buildDimensionColumnPlan(columnPlan, chunkX, chunkZ, entry, resolverState);
Map<CaveProfile, double[]> rootProfileColumnWeights = new IdentityHashMap<>();
List<CaveProfile> rootProfileOrder = new ArrayList<>();
IrisRange worldYRange = entry.getWorldYRange();
IrisRange worldYRange = entry.worldYRange() == null ? null : IrisValues.range(entry.worldYRange());
for (int columnIndex = 0; columnIndex < CHUNK_AREA; columnIndex++) {
IrisDimensionCarvingEntry resolvedEntry = columnPlan[columnIndex];
IrisBiome resolvedBiome = IrisDimensionCarvingResolver.resolveEntryBiome(engine, resolvedEntry, resolverState);
ResolvedCarvingEntry resolvedEntry = columnPlan[columnIndex];
IrisBiome resolvedBiome = CarvingResolver.resolveEntryBiome(engine, resolvedEntry, resolverState);
if (resolvedBiome == null) {
continue;
}
CaveProfile profile = resolvedBiome.getCaveProfile();
CaveProfile profile = CaveProfiles.declaredBy(resolvedBiome);
if (!isProfileEnabled(profile)) {
continue;
}
@@ -351,7 +355,7 @@ public class CaveCarving {
return weightedProfiles;
}
private void buildDimensionColumnPlan(IrisDimensionCarvingEntry[] columnPlan, int chunkX, int chunkZ, IrisDimensionCarvingEntry entry, IrisDimensionCarvingResolver.State resolverState) {
private void buildDimensionColumnPlan(ResolvedCarvingEntry[] columnPlan, int chunkX, int chunkZ, ResolvedCarvingEntry entry, CarvingResolver.State resolverState) {
int baseX = PowerOfTwoCoordinates.chunkToBlock(chunkX);
int baseZ = PowerOfTwoCoordinates.chunkToBlock(chunkZ);
for (int localX = 0; localX < CHUNK_SIZE; localX++) {
@@ -359,12 +363,12 @@ public class CaveCarving {
for (int localZ = 0; localZ < CHUNK_SIZE; localZ++) {
int worldZ = baseZ + localZ;
int columnIndex = PowerOfTwoCoordinates.packLocal16(localX, localZ);
columnPlan[columnIndex] = IrisDimensionCarvingResolver.resolveFromRoot(engine, entry, worldX, worldZ, resolverState);
columnPlan[columnIndex] = CarvingResolver.resolveFromRoot(engine, entry, worldX, worldZ, resolverState);
}
}
}
private void fillProfileField(CaveProfile[] profileField, int chunkX, int chunkZ, IrisComplex complex, IrisDimensionCarvingResolver.State resolverState, BlendScratch blendScratch) {
private void fillProfileField(CaveProfile[] profileField, int chunkX, int chunkZ, IrisComplex complex, CarvingResolver.State resolverState, BlendScratch blendScratch) {
int startX = PowerOfTwoCoordinates.chunkToBlock(chunkX) - BLEND_RADIUS;
int startZ = PowerOfTwoCoordinates.chunkToBlock(chunkZ) - BLEND_RADIUS;
prefillProfileFieldSamples(startX, startZ, complex, blendScratch);
@@ -404,23 +408,23 @@ public class CaveCarving {
IrisRegion region,
IrisBiome surfaceBiome,
IrisBiome caveBiome,
IrisDimensionCarvingResolver.State resolverState
CarvingResolver.State resolverState
) {
CaveProfile resolved = null;
CaveProfile dimensionProfile = engine.getDimension().getCaveProfile();
CaveProfile dimensionProfile = CaveProfiles.declaredBy(engine.getDimension());
if (isProfileEnabled(dimensionProfile)) {
resolved = dimensionProfile;
}
if (region != null) {
CaveProfile regionProfile = region.getCaveProfile();
CaveProfile regionProfile = CaveProfiles.declaredBy(region);
if (isProfileEnabled(regionProfile)) {
resolved = regionProfile;
}
}
if (surfaceBiome != null) {
CaveProfile surfaceProfile = surfaceBiome.getCaveProfile();
CaveProfile surfaceProfile = CaveProfiles.declaredBy(surfaceBiome);
if (isProfileEnabled(surfaceProfile)) {
resolved = surfaceProfile;
}
@@ -429,11 +433,11 @@ public class CaveCarving {
int roundedSurfaceY = (int) Math.round(surfaceHeight);
int sampleY = Math.max(1, roundedSurfaceY - 56);
int worldY = sampleY + engine.getWorld().minHeight();
IrisDimensionCarvingEntry rootCarvingEntry = IrisDimensionCarvingResolver.resolveRootEntry(engine, worldY, resolverState);
ResolvedCarvingEntry rootCarvingEntry = CarvingResolver.resolveRootEntry(engine, worldY, resolverState);
IrisBiome resolvedCarvingBiome = null;
if (rootCarvingEntry != null) {
IrisDimensionCarvingEntry resolvedCarvingEntry = IrisDimensionCarvingResolver.resolveFromRoot(engine, rootCarvingEntry, worldX, worldZ, resolverState);
resolvedCarvingBiome = IrisDimensionCarvingResolver.resolveEntryBiome(engine, resolvedCarvingEntry, resolverState);
ResolvedCarvingEntry resolvedCarvingEntry = CarvingResolver.resolveFromRoot(engine, rootCarvingEntry, worldX, worldZ, resolverState);
resolvedCarvingBiome = CarvingResolver.resolveEntryBiome(engine, resolvedCarvingEntry, resolverState);
if (resolvedCarvingBiome != null) {
caveBiome = resolvedCarvingBiome;
}
@@ -447,7 +451,7 @@ public class CaveCarving {
if (depthBelowSurface <= 0) {
effectiveCaveBiome = surfaceBiome;
} else {
int minDepth = Math.max(0, caveBiome.getCaveMinDepthBelowSurface());
int minDepth = Math.max(0, CaveBiomeBands.minDepthBelowSurface(caveBiome));
if (depthBelowSurface < minDepth) {
effectiveCaveBiome = surfaceBiome;
}
@@ -455,7 +459,7 @@ public class CaveCarving {
}
}
CaveProfile caveProfile = effectiveCaveBiome.getCaveProfile();
CaveProfile caveProfile = CaveProfiles.declaredBy(effectiveCaveBiome);
if (isProfileEnabled(caveProfile)) {
resolved = caveProfile;
}
@@ -680,7 +684,7 @@ public class CaveCarving {
private final CaveProfile[] kernelProfiles = new CaveProfile[KERNEL_SIZE];
private final double[] kernelProfileWeights = new double[KERNEL_SIZE];
private final IdentityHashMap<CaveProfile, double[]> columnProfileWeights = new IdentityHashMap<>();
private final IdentityHashMap<IrisDimensionCarvingEntry, IrisDimensionCarvingEntry[]> dimensionColumnPlans = new IdentityHashMap<>();
private final IdentityHashMap<ResolvedCarvingEntry, ResolvedCarvingEntry[]> dimensionColumnPlans = new IdentityHashMap<>();
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];
@@ -23,6 +23,7 @@ import art.arcane.iris.engine.data.cache.Cache;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.mantle.EngineMantle;
import art.arcane.iris.engine.modifier.FloatingIslands;
import art.arcane.iris.engine.object.terrain.floating.FloatingChildren;
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;
@@ -56,7 +57,7 @@ final class FloatingIslandSampleResolver implements IslandObjectPlacer.SamplePro
return sampleCache.get(key);
}
IrisBiome parent = parent(x, z);
if (parent == null || parent.getFloatingChildBiomes() == null || parent.getFloatingChildBiomes().isEmpty()) {
if (parent == null || FloatingChildren.declaredBy(parent).isEmpty()) {
resolvedSamples.add(key);
return null;
}
@@ -543,8 +543,8 @@ public class FloatingObjectPlacing {
try {
IrisData data = engine.getData();
for (IrisBiome biome : engine.getDimension().getReachableBiomes(engine)) {
List<FloatingChildBiome> settings = biome.getFloatingChildBiomes();
if (settings == null || settings.isEmpty()) {
List<FloatingChildBiome> settings = FloatingChildren.declaredBy(biome);
if (settings.isEmpty()) {
continue;
}
for (ResolvedFloatingChild entry : FloatingChildren.of(engine).of(settings)) {
@@ -25,6 +25,7 @@ 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.terrain.carving.CaveProfiles;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.IrisObjectVacuum;
import art.arcane.iris.core.IrisSettings;
@@ -235,8 +236,8 @@ public class ObjectPlacing {
int rejected = 0;
int nullObjects = 0;
int errors = 0;
CaveProfile biomeCaveProfile = resolveCaveProfile(caveBiome.getCaveProfile(), region.getCaveProfile());
CaveProfile regionCaveProfile = resolveCaveProfile(region.getCaveProfile(), caveBiome.getCaveProfile());
CaveProfile biomeCaveProfile = resolveCaveProfile(CaveProfiles.declaredBy(caveBiome), CaveProfiles.declaredBy(region));
CaveProfile regionCaveProfile = resolveCaveProfile(CaveProfiles.declaredBy(region), CaveProfiles.declaredBy(caveBiome));
CaveAnchorCache caveAnchorCache = new CaveAnchorCache();
for (IrisObjectPlacement i : surfaceBiome.getSurfaceObjects()) {
@@ -384,12 +385,12 @@ public class ObjectPlacing {
@ChunkCoordinates
private void placeProceduralObjects(MantleWriter writer, RNG rng, int x, int z, IrisBiome surfaceBiome, IrisBiome caveBiome, IrisRegion region) {
CaveProfile surfaceCaveProfile = resolveCaveProfile(surfaceBiome.getCaveProfile(), region.getCaveProfile());
CaveProfile regionCaveProfile = resolveCaveProfile(region.getCaveProfile(), caveBiome == null ? null : caveBiome.getCaveProfile());
CaveProfile surfaceCaveProfile = resolveCaveProfile(CaveProfiles.declaredBy(surfaceBiome), CaveProfiles.declaredBy(region));
CaveProfile regionCaveProfile = resolveCaveProfile(CaveProfiles.declaredBy(region), caveBiome == null ? null : CaveProfiles.declaredBy(caveBiome));
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) {
CaveProfile caveProfile = resolveCaveProfile(caveBiome.getCaveProfile(), region.getCaveProfile());
CaveProfile caveProfile = resolveCaveProfile(CaveProfiles.declaredBy(caveBiome), CaveProfiles.declaredBy(region));
placeProceduralFrom(writer, rng, x, z, caveBiome.getProceduralObjects(), caveBiome.getName(), caveProfile, caveBiome.getLoadKey());
}
}
@@ -1319,7 +1320,7 @@ public class ObjectPlacing {
}
private CaveProfile resolveCaveProfile(CaveProfile preferred, CaveProfile secondary) {
CaveProfile dimensionProfile = engine.getDimension().getCaveProfile();
CaveProfile dimensionProfile = CaveProfiles.declaredBy(engine.getDimension());
if (preferred != null && preferred.enabled()) {
return preferred;
}
@@ -18,7 +18,10 @@
package art.arcane.iris.engine.modifier;
import art.arcane.iris.builtin.carve.CaveFieldModule;
import art.arcane.iris.builtin.carve.CarvingBiomeSettings;
import art.arcane.iris.builtin.carve.CarvingEnabledSettings;
import art.arcane.iris.builtin.carve.CarvingSettings;
import art.arcane.iris.builtin.carve.CaveDepthSettings;
import art.arcane.iris.builtin.carve.CaveProfile;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.IrisStages;
@@ -28,6 +31,7 @@ import art.arcane.iris.engine.mantle.components.CaveCarving;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import com.volmit.IrisModule;
import com.volmit.ModuleInfo;
import com.volmit.service.CaveBiomes;
import com.volmit.stage.ChunkStageContext;
import com.volmit.stage.MantleStageContext;
import com.volmit.stage.StageGraph;
@@ -51,8 +55,12 @@ public final class CarveModule implements IrisModule {
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(CaveProfile.class);
registry.registerHeldType(CaveFieldModule.class);
registry.registerSettings(CaveProfile.class);
registry.registerSettings(CarvingSettings.class);
registry.registerSettings(CarvingEnabledSettings.class);
registry.registerSettings(CarvingBiomeSettings.class);
registry.registerSettings(CaveDepthSettings.class);
registry.registerService(CaveBiomes.class, new CaveBiomeBands());
}
@Override
@@ -83,6 +91,6 @@ public final class CarveModule implements IrisModule {
* also does: Iris then skips this stage's mantle pass like any disabled component.
*/
private static boolean carves(IrisDimension dimension) {
return dimension.isCarvingEnabled();
return dimension.getModuleSettings().find(CarvingEnabledSettings.class).map(CarvingEnabledSettings::enabled).orElse(true);
}
}
@@ -26,7 +26,6 @@ import art.arcane.iris.engine.decorator.IrisSurfaceDecorator;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.world.biome.InferredType;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
import art.arcane.iris.util.project.context.ChunkContext;
import art.arcane.iris.util.common.data.B;
import art.arcane.volmlib.util.documentation.ChunkCoordinates;
@@ -82,7 +81,6 @@ public class CaveApplying {
public void apply(int x, int z, Hunk<PlatformBlockState> output, boolean multicore, ChunkContext context) {
PrecisionStopwatch caveStopwatch = PrecisionStopwatch.start();
Mantle<Matter> mantle = engine.getMantle().getMantle();
IrisDimensionCarvingResolver.State resolverState = new IrisDimensionCarvingResolver.State();
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache = new Long2ObjectOpenHashMap<>(2048);
IrisCarveScratch scratch = SCRATCH.get();
scratch.reset();
@@ -174,7 +172,7 @@ public class CaveApplying {
int worldZ = rz + chunkBlockZ;
String customBiome = cavern.getCustomBiome();
IrisBiome biome = customBiome.isEmpty()
? resolveCaveBiome(caveBiomeCache, worldX, yy, worldZ, resolverState)
? resolveCaveBiome(caveBiomeCache, worldX, yy, worldZ)
: resolveCustomBiome(customBiomeCache, customBiome);
if (biome != null) {
@@ -188,14 +186,14 @@ public class CaveApplying {
});
for (int columnIndex = 0; columnIndex < 256; columnIndex++) {
processColumnFromMask(output, mantleChunk, mantle, columnMasks[columnIndex], columnIndex, x, z, resolverState, caveBiomeCache, customBiomeCache);
processColumnFromMask(output, mantleChunk, mantle, columnMasks[columnIndex], columnIndex, x, z, caveBiomeCache, customBiomeCache);
}
for (int columnIndex = 0; columnIndex < 256; columnIndex++) {
if (boundaryMasks[columnIndex].isEmpty() || !columnMasks[columnIndex].isEmpty()) {
continue;
}
processBoundaryColumnFromMask(output, boundaryMasks[columnIndex], walls, columnIndex, x, z, resolverState, caveBiomeCache, customBiomeCache);
processBoundaryColumnFromMask(output, boundaryMasks[columnIndex], walls, columnIndex, x, z, caveBiomeCache, customBiomeCache);
}
// Surface-break carving must not leave an ore cap suspended across the opening.
@@ -409,7 +407,6 @@ public class CaveApplying {
int columnIndex,
int chunkX,
int chunkZ,
IrisDimensionCarvingResolver.State resolverState,
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache,
Map<String, IrisBiome> customBiomeCache
) {
@@ -438,7 +435,7 @@ public class CaveApplying {
zone.ceiling = buf;
} else {
if (zone.isValid(engine)) {
processZone(output, mc, mantle, zone, rx, rz, worldX, worldZ, resolverState, caveBiomeCache, customBiomeCache);
processZone(output, mc, mantle, zone, rx, rz, worldX, worldZ, caveBiomeCache, customBiomeCache);
}
zone = new CaveZone();
zone.setFloor(y);
@@ -450,7 +447,7 @@ public class CaveApplying {
}
if (zone.isValid(engine)) {
processZone(output, mc, mantle, zone, rx, rz, worldX, worldZ, resolverState, caveBiomeCache, customBiomeCache);
processZone(output, mc, mantle, zone, rx, rz, worldX, worldZ, caveBiomeCache, customBiomeCache);
}
}
@@ -461,7 +458,6 @@ public class CaveApplying {
int columnIndex,
int chunkX,
int chunkZ,
IrisDimensionCarvingResolver.State resolverState,
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache,
Map<String, IrisBiome> customBiomeCache
) {
@@ -482,14 +478,14 @@ public class CaveApplying {
if (y == zoneCeiling + 1) {
zoneCeiling = y;
} else {
paintBoundaryZone(output, walls, rx, rz, worldX, worldZ, zoneFloor, zoneCeiling, resolverState, caveBiomeCache, customBiomeCache);
paintBoundaryZone(output, walls, rx, rz, worldX, worldZ, zoneFloor, zoneCeiling, caveBiomeCache, customBiomeCache);
zoneFloor = y;
zoneCeiling = y;
}
y = boundaryMask.nextSetBit(y + 1);
}
paintBoundaryZone(output, walls, rx, rz, worldX, worldZ, zoneFloor, zoneCeiling, resolverState, caveBiomeCache, customBiomeCache);
paintBoundaryZone(output, walls, rx, rz, worldX, worldZ, zoneFloor, zoneCeiling, caveBiomeCache, customBiomeCache);
}
private void paintBoundaryZone(
@@ -501,16 +497,15 @@ public class CaveApplying {
int worldZ,
int zoneFloor,
int zoneCeiling,
IrisDimensionCarvingResolver.State resolverState,
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache,
Map<String, IrisBiome> customBiomeCache
) {
IrisBiome floorBiome = resolveCaveBoundaryBiome(
walls.get(rx, zoneFloor, rz), worldX, zoneFloor, worldZ,
resolverState, caveBiomeCache, customBiomeCache);
caveBiomeCache, customBiomeCache);
IrisBiome ceilingBiome = resolveCaveBoundaryBiome(
walls.get(rx, zoneCeiling, rz), worldX, zoneCeiling, worldZ,
resolverState, caveBiomeCache, customBiomeCache);
caveBiomeCache, customBiomeCache);
if (floorBiome == null && ceilingBiome == null) {
return;
}
@@ -574,7 +569,7 @@ public class CaveApplying {
return (h & 15L) == 0L;
}
private void processZone(Hunk<PlatformBlockState> output, MantleChunk<Matter> mc, Mantle<Matter> mantle, CaveZone zone, int rx, int rz, int xx, int zz, IrisDimensionCarvingResolver.State resolverState, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
private void processZone(Hunk<PlatformBlockState> output, MantleChunk<Matter> mc, Mantle<Matter> mantle, CaveZone zone, int rx, int rz, int xx, int zz, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
int maxY = output.getHeight();
if (zone.ceiling + 1 < maxY && B.isDecorant(output.getRaw(rx, zone.ceiling + 1, rz))) {
@@ -596,8 +591,8 @@ public class CaveApplying {
mantle.set(xx, zone.floor, zz, MarkerMatter.CAVE_FLOOR);
}
IrisBiome floorBiome = resolveCaveBoundaryBiome(mc, rx, zone.floor, rz, xx, zz, resolverState, caveBiomeCache, customBiomeCache);
IrisBiome ceilingBiome = resolveCaveBoundaryBiome(mc, rx, zone.ceiling, rz, xx, zz, resolverState, caveBiomeCache, customBiomeCache);
IrisBiome floorBiome = resolveCaveBoundaryBiome(mc, rx, zone.floor, rz, xx, zz, caveBiomeCache, customBiomeCache);
IrisBiome ceilingBiome = resolveCaveBoundaryBiome(mc, rx, zone.ceiling, rz, xx, zz, caveBiomeCache, customBiomeCache);
if (floorBiome == null && ceilingBiome == null) {
return;
}
@@ -651,10 +646,10 @@ public class CaveApplying {
}
}
IrisBiome resolveCaveBoundaryBiome(MantleChunk<Matter> mantleChunk, int x, int y, int z, int worldX, int worldZ, IrisDimensionCarvingResolver.State resolverState, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
IrisBiome resolveCaveBoundaryBiome(MantleChunk<Matter> mantleChunk, int x, int y, int z, int worldX, int worldZ, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
MatterCavern cavern = dataIfPresent(mantleChunk, x, y, z, MatterCavern.class);
return resolveCaveBoundaryBiome(
cavern, worldX, y, worldZ, resolverState, caveBiomeCache, customBiomeCache);
cavern, worldX, y, worldZ, caveBiomeCache, customBiomeCache);
}
private static <T> T dataIfPresent(MantleChunk<Matter> mantleChunk, int x, int y, int z, Class<T> type) {
@@ -669,11 +664,11 @@ public class CaveApplying {
return matter.<T>getSlice(type).get(x & 15, y & 15, z & 15);
}
IrisBiome resolveCaveBoundaryBiome(MatterCavern cavern, int worldX, int y, int worldZ, IrisDimensionCarvingResolver.State resolverState, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
IrisBiome resolveCaveBoundaryBiome(MatterCavern cavern, int worldX, int y, int worldZ, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
if (cavern != null && !cavern.getCustomBiome().isEmpty()) {
return resolveCustomBiome(customBiomeCache, cavern.getCustomBiome());
}
return resolveCaveBiome(caveBiomeCache, worldX, y, worldZ, resolverState);
return resolveCaveBiome(caveBiomeCache, worldX, y, worldZ);
}
static boolean canReplaceCaveFloorLayer(Hunk<PlatformBlockState> output, int x, int y, int z, PlatformBlockState layer) {
@@ -695,16 +690,16 @@ public class CaveApplying {
return state != null && state.hasGravity();
}
private IrisBiome resolveCaveBiome(Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, int x, int y, int z, IrisDimensionCarvingResolver.State resolverState) {
IrisBiome center = sampleCaveBiome(caveBiomeCache, x, y, z, resolverState);
private IrisBiome resolveCaveBiome(Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, int x, int y, int z) {
IrisBiome center = sampleCaveBiome(caveBiomeCache, x, y, z);
if (center == null) {
return null;
}
IrisBiome xPos = sampleCaveBiome(caveBiomeCache, x + CAVE_BIOME_BLEND_RADIUS, y, z, resolverState);
IrisBiome xNeg = sampleCaveBiome(caveBiomeCache, x - CAVE_BIOME_BLEND_RADIUS, y, z, resolverState);
IrisBiome zPos = sampleCaveBiome(caveBiomeCache, x, y, z + CAVE_BIOME_BLEND_RADIUS, resolverState);
IrisBiome zNeg = sampleCaveBiome(caveBiomeCache, x, y, z - CAVE_BIOME_BLEND_RADIUS, resolverState);
IrisBiome xPos = sampleCaveBiome(caveBiomeCache, x + CAVE_BIOME_BLEND_RADIUS, y, z);
IrisBiome xNeg = sampleCaveBiome(caveBiomeCache, x - CAVE_BIOME_BLEND_RADIUS, y, z);
IrisBiome zPos = sampleCaveBiome(caveBiomeCache, x, y, z + CAVE_BIOME_BLEND_RADIUS);
IrisBiome zNeg = sampleCaveBiome(caveBiomeCache, x, y, z - CAVE_BIOME_BLEND_RADIUS);
if (xPos == center && xNeg == center && zPos == center && zNeg == center) {
return center;
@@ -727,14 +722,14 @@ public class CaveApplying {
return zNeg != null ? zNeg : center;
}
private IrisBiome sampleCaveBiome(Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, int x, int y, int z, IrisDimensionCarvingResolver.State resolverState) {
private IrisBiome sampleCaveBiome(Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, int x, int y, int z) {
long key = BlockPosition.toLong(x, y, z);
IrisBiome cachedBiome = caveBiomeCache.get(key);
if (cachedBiome != null) {
return cachedBiome;
}
IrisBiome resolvedBiome = engine.getCaveBiome(x, y, z, resolverState);
IrisBiome resolvedBiome = engine.getCaveBiome(x, y, z);
if (resolvedBiome != null) {
caveBiomeCache.put(key, resolvedBiome);
}
@@ -0,0 +1,61 @@
/*
* 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.modifier;
import art.arcane.iris.builtin.carve.CaveDepthSettings;
import art.arcane.iris.core.modules.IrisPackWorld;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.terrain.carving.CarvingResolver;
import art.arcane.iris.engine.object.terrain.carving.ResolvedCarvingEntry;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import com.volmit.service.CaveBiomes;
import com.volmit.world.PackWorld;
import java.util.Optional;
/**
* What the carve module tells the host about cave biomes ({@link CaveBiomes}): the biome of the dimension's carving band at a
* position, and how far below the surface a biome's caves begin.
*/
public final class CaveBiomeBands implements CaveBiomes {
@Override
public Optional<String> overriddenBiome(PackWorld world, int x, int y, int z) {
Engine engine = IrisPackWorld.of(world).engine();
ResolvedCarvingEntry rootEntry = CarvingResolver.resolveRootEntry(engine, y + engine.getWorld().minHeight(), null);
if (rootEntry == null) {
return Optional.empty();
}
ResolvedCarvingEntry entry = CarvingResolver.resolveFromRoot(engine, rootEntry, x, z, null);
if (CarvingResolver.resolveEntryBiome(engine, entry, null) == null) {
return Optional.empty();
}
return Optional.of(entry.biomeKey().trim());
}
@Override
public int minDepthBelowSurface(PackWorld world, String biomeKey) {
IrisBiome biome = IrisPackWorld.of(world).engine().getData().getBiomeLoader().load(biomeKey);
return biome == null ? 0 : minDepthBelowSurface(biome);
}
/** How many blocks below the surface {@code biome}'s caves begin, as its {@code caveMinDepthBelowSurface} says; 0 where it says none. */
public static int minDepthBelowSurface(IrisBiome biome) {
return biome.getModuleSettings().find(CaveDepthSettings.class).map(CaveDepthSettings::depth).orElse(0);
}
}
@@ -30,7 +30,6 @@ import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.framework.EngineAssignedComponent;
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.IrisDimensionCarvingResolver;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
import art.arcane.iris.engine.object.world.region.IrisRegion;
@@ -102,7 +101,6 @@ public class DepositPlacer extends EngineAssignedComponent {
}
public void generate(DepositGenerator k, MantleChunk chunk, Hunk<PlatformBlockState> data, RNG rng, int cx, int cz, boolean safe, HeightMap he, ChunkContext context) {
IrisDimensionCarvingResolver.State carvingState = new IrisDimensionCarvingResolver.State();
ResolvedDeposit deposit = resolved(k);
if (k.spawnChance() < rng.d())
return;
@@ -148,8 +146,7 @@ public class DepositPlacer extends EngineAssignedComponent {
boolean oreDeposit = deposit.isOre();
IrisBiome surfaceBiome = context.getBiome().get(x, z);
IrisBiome depositBiome = oreDeposit || k.usesCaveBiomeFilter()
? getEngine().getCaveBiome(
(cx << 4) + x, biomeY, (cz << 4) + z, carvingState)
? getEngine().getCaveBiome((cx << 4) + x, biomeY, (cz << 4) + z)
: null;
if (!deposit.matchesBiome(surfaceBiome, depositBiome)) {
continue;
@@ -211,7 +208,7 @@ public class DepositPlacer extends EngineAssignedComponent {
if (chunk.get(nx, ny, nz, MatterCavern.class) == null) {
PlatformBlockState ore = clump.getBlocks().get(j);
PlatformBlockState remapped = resolveDepositVariant(
cx, cz, nx, ny, nz, ore, dimension, context, carvingState);
cx, cz, nx, ny, nz, ore, dimension, context);
PlatformBlockState finalBlock = remapped != null
? remapped
: B.toDeepSlateOre(current, ore);
@@ -317,12 +314,12 @@ public class DepositPlacer extends EngineAssignedComponent {
return Math.max(minimum, Math.min(center, maximum));
}
private PlatformBlockState resolveDepositVariant(int cx, int cz, int nx, int localY, int nz, PlatformBlockState ore, IrisDimension dimension, ChunkContext context, IrisDimensionCarvingResolver.State carvingState) {
private PlatformBlockState resolveDepositVariant(int cx, int cz, int nx, int localY, int nz, PlatformBlockState ore, IrisDimension dimension, ChunkContext context) {
int worldX = (cx << 4) + nx;
int worldZ = (cz << 4) + nz;
int worldY = absoluteWorldY(getEngine().getMinHeight(), localY);
IrisBiome biome = getEngine().getCaveBiome(worldX, localY, worldZ, carvingState);
IrisBiome biome = getEngine().getCaveBiome(worldX, localY, worldZ);
if (biome != null) {
PlatformBlockState match = matchDepositVariant(biome, ore, worldY);
if (match != null) {
@@ -19,6 +19,7 @@
package art.arcane.iris.engine.modifier;
import art.arcane.iris.engine.object.terrain.floating.FloatingChildren;
import art.arcane.iris.engine.object.terrain.floating.ResolvedFloatingChild;
import art.arcane.iris.builtin.floating.FloatingBottomPaletteMode;
import art.arcane.iris.builtin.prepare.SlopeClip;
@@ -225,7 +226,7 @@ public class FloatingIslands {
int wx = x + xf;
int wz = z + zf;
IrisBiome parent = boundarySampler.parent(wx, wz);
if (parent == null || parent.getFloatingChildBiomes() == null || parent.getFloatingChildBiomes().isEmpty()) {
if (parent == null || FloatingChildren.declaredBy(parent).isEmpty()) {
continue;
}
FloatingIslandSample sample = FloatingIslandSample.sampleMemoized(parent, wx, wz, chunkHeight, baseSeed, data, engine, boundarySampler);
@@ -310,7 +311,7 @@ public class FloatingIslands {
int wx = x + xf;
int wz = z + zf;
IrisBiome parent = boundarySampler.parent(wx, wz);
if (parent == null || parent.getFloatingChildBiomes() == null || parent.getFloatingChildBiomes().isEmpty()) {
if (parent == null || FloatingChildren.declaredBy(parent).isEmpty()) {
continue;
}
FloatingIslandSample sample = FloatingIslandSample.sampleMemoized(parent, wx, wz, chunkHeight, baseSeed, data, engine, boundarySampler);
@@ -18,7 +18,8 @@
package art.arcane.iris.engine.modifier;
import art.arcane.iris.builtin.floating.FloatingChildBiome;
import art.arcane.iris.builtin.floating.FloatingChildSettings;
import art.arcane.iris.builtin.floating.MergeFloatingChildrenSettings;
import com.volmit.FeatureRegistry;
import art.arcane.iris.builtin.IrisStages;
import art.arcane.iris.core.modules.IrisChunk;
@@ -50,7 +51,8 @@ public final class FloatingModule implements IrisModule {
@Override
public void register(FeatureRegistry registry) {
registry.registerHeldType(FloatingChildBiome.class);
registry.registerSettings(FloatingChildSettings.class);
registry.registerSettings(MergeFloatingChildrenSettings.class);
}
@Override
@@ -0,0 +1,71 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.terrain.carving;
import art.arcane.iris.builtin.carve.CarvingEntry;
import art.arcane.iris.builtin.carve.CarvingSettings;
import art.arcane.iris.engine.framework.Engine;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* What the carve module keeps for one world: the cave biome bands its dimension declares ({@link CarvingSettings}) made ready
* ({@link ResolvedCarvingEntry}), in the order the dimension lists them, and by id.
*/
public final class CarvingBands {
private final List<ResolvedCarvingEntry> entries;
private final Map<String, ResolvedCarvingEntry> index;
CarvingBands(List<CarvingEntry> declared) {
this.entries = declared.stream().filter(Objects::nonNull).map(ResolvedCarvingEntry::new).toList();
this.index = indexById(entries);
}
CarvingBands(Engine engine) {
this(engine.getDimension().getModuleSettings().find(CarvingSettings.class).map(CarvingSettings::entries).orElse(List.of()));
}
/** The bands of the world {@code engine} generates now. */
public static CarvingBands of(Engine engine) {
return engine.getGeneration().state(CarvingBands.class, CarvingBands::new);
}
/** Every declared entry, enabled or not. */
public List<ResolvedCarvingEntry> entries() {
return entries;
}
/** The entries by their trimmed ids; entries without an id are not in it, and the last of several with one id is. */
public Map<String, ResolvedCarvingEntry> index() {
return index;
}
private static Map<String, ResolvedCarvingEntry> indexById(List<ResolvedCarvingEntry> entries) {
Map<String, ResolvedCarvingEntry> index = new HashMap<>();
for (ResolvedCarvingEntry entry : entries) {
if (!entry.id().isBlank()) {
index.put(entry.id().trim(), entry);
}
}
return Map.copyOf(index);
}
}
@@ -1,14 +1,13 @@
package art.arcane.iris.engine.object.terrain.carving;
import art.arcane.iris.engine.object.value.IRare;
import art.arcane.iris.engine.object.value.IrisRange;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.util.project.interpolation.IrisInterpolation;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.iris.util.project.noise.CNG;
import com.volmit.config.Range;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -17,36 +16,40 @@ import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
public final class IrisDimensionCarvingResolver {
/**
* Picks the dimension's carving entry for a position: the last enabled root entry whose world Y band holds the height,
* then, through the entries' children, the one a noise pattern selects at the column. The state a caller passes (or, when
* it passes none, the thread's) keeps the picks and the entries' biomes, so a caller resolving many positions reuses them.
*/
public final class CarvingResolver {
private static final int MAX_CHILD_DEPTH = 32;
private static final long CHILD_SEED_SALT = 0x9E3779B97F4A7C15L;
private static final ThreadLocal<WeakReference<State>> THREAD_STATE =
ThreadLocal.withInitial(() -> new WeakReference<>(null));
private IrisDimensionCarvingResolver() {
private CarvingResolver() {
}
public static IrisDimensionCarvingEntry resolveRootEntry(Engine engine, int worldY) {
public static ResolvedCarvingEntry resolveRootEntry(Engine engine, int worldY) {
return resolveRootEntry(engine, worldY, threadState());
}
public static IrisDimensionCarvingEntry resolveRootEntry(Engine engine, int worldY, State state) {
public static ResolvedCarvingEntry resolveRootEntry(Engine engine, int worldY, State state) {
State resolvedState = state == null ? threadState() : state;
resolvedState.bind(engine);
if (resolvedState.rootEntriesByWorldY.containsKey(worldY)) {
return resolvedState.rootEntriesByWorldY.get(worldY);
}
IrisDimension dimension = engine.getDimension();
List<IrisDimensionCarvingEntry> entries = dimension.getCarving();
if (entries == null || entries.isEmpty()) {
List<ResolvedCarvingEntry> entries = resolvedState.bands.entries();
if (entries.isEmpty()) {
resolvedState.rootEntriesByWorldY.put(worldY, null);
return null;
}
IrisDimensionCarvingEntry resolved = null;
for (IrisDimensionCarvingEntry entry : entries) {
ResolvedCarvingEntry resolved = null;
for (ResolvedCarvingEntry entry : entries) {
if (!isRootCandidate(engine, entry, worldY, resolvedState)) {
continue;
}
@@ -58,11 +61,11 @@ public final class IrisDimensionCarvingResolver {
return resolved;
}
public static IrisDimensionCarvingEntry resolveFromRoot(Engine engine, IrisDimensionCarvingEntry rootEntry, int worldX, int worldZ) {
public static ResolvedCarvingEntry resolveFromRoot(Engine engine, ResolvedCarvingEntry rootEntry, int worldX, int worldZ) {
return resolveFromRoot(engine, rootEntry, worldX, worldZ, threadState());
}
public static IrisDimensionCarvingEntry resolveFromRoot(Engine engine, IrisDimensionCarvingEntry rootEntry, int worldX, int worldZ, State state) {
public static ResolvedCarvingEntry resolveFromRoot(Engine engine, ResolvedCarvingEntry rootEntry, int worldX, int worldZ, State state) {
State resolvedState = state == null ? threadState() : state;
resolvedState.bind(engine);
if (rootEntry == null) {
@@ -74,22 +77,22 @@ public final class IrisDimensionCarvingResolver {
return null;
}
int remainingDepth = clampDepth(rootEntry.getChildRecursionDepth());
int remainingDepth = clampDepth(rootEntry.childRecursionDepth());
if (remainingDepth <= 0) {
return rootEntry;
}
Map<String, IrisDimensionCarvingEntry> entryIndex = resolveEntryIndex(engine, resolvedState);
IrisDimensionCarvingEntry current = rootEntry;
Map<String, ResolvedCarvingEntry> entryIndex = resolvedState.bands.index();
ResolvedCarvingEntry current = rootEntry;
int depth = remainingDepth;
while (depth > 0) {
IrisDimensionCarvingEntry selected = selectChild(engine, current, worldX, worldZ, entryIndex, resolvedState);
ResolvedCarvingEntry selected = selectChild(engine, current, worldX, worldZ, entryIndex, resolvedState);
if (selected == null || selected == current) {
break;
}
depth--;
int childDepthLimit = clampDepth(selected.getChildRecursionDepth());
int childDepthLimit = clampDepth(selected.childRecursionDepth());
if (childDepthLimit < depth) {
depth = childDepthLimit;
}
@@ -99,17 +102,17 @@ public final class IrisDimensionCarvingResolver {
return current;
}
public static IrisBiome resolveEntryBiome(Engine engine, IrisDimensionCarvingEntry entry) {
public static IrisBiome resolveEntryBiome(Engine engine, ResolvedCarvingEntry entry) {
return resolveEntryBiome(engine, entry, null);
}
public static IrisBiome resolveEntryBiome(Engine engine, IrisDimensionCarvingEntry entry, State state) {
public static IrisBiome resolveEntryBiome(Engine engine, ResolvedCarvingEntry entry, State state) {
if (entry == null) {
return null;
}
if (state == null) {
return entry.getRealBiome(engine.getData());
return entry.realBiome(engine.getData());
}
state.bind(engine);
@@ -117,17 +120,17 @@ public final class IrisDimensionCarvingResolver {
return state.biomeCache.get(entry);
}
IrisBiome biome = entry.getRealBiome(engine.getData());
IrisBiome biome = entry.realBiome(engine.getData());
state.biomeCache.put(entry, biome);
return biome;
}
private static boolean isRootCandidate(Engine engine, IrisDimensionCarvingEntry entry, int worldY, State state) {
if (entry == null || !entry.isEnabled()) {
private static boolean isRootCandidate(Engine engine, ResolvedCarvingEntry entry, int worldY, State state) {
if (entry == null || !entry.enabled()) {
return false;
}
IrisRange worldYRange = entry.getWorldYRange();
Range worldYRange = entry.worldYRange();
if (worldYRange != null && !worldYRange.contains(worldY)) {
return false;
}
@@ -135,16 +138,16 @@ public final class IrisDimensionCarvingResolver {
return resolveEntryBiome(engine, entry, state) != null;
}
private static IrisDimensionCarvingEntry selectChild(
private static ResolvedCarvingEntry selectChild(
Engine engine,
IrisDimensionCarvingEntry parent,
ResolvedCarvingEntry parent,
int worldX,
int worldZ,
Map<String, IrisDimensionCarvingEntry> entryIndex,
Map<String, ResolvedCarvingEntry> entryIndex,
State state
) {
KList<String> children = parent.getChildren();
if (children == null || children.isEmpty()) {
List<String> children = parent.children();
if (children.isEmpty()) {
return parent;
}
@@ -164,7 +167,7 @@ public final class IrisDimensionCarvingResolver {
}
long seed = resolveChildSeed(engine, state);
CNG childGenerator = parent.getChildrenGenerator(seed, engine.getData());
CNG childGenerator = parent.childrenGenerator(seed, engine.getData());
double sample = childGenerator.noiseFast2D(worldX, worldZ);
int selectedIndex = (int) Math.round(IrisInterpolation.lerp(0, selectionPlan.maxIndex, sample));
CarvingChoice selected = selectionPlan.get(selectedIndex);
@@ -177,31 +180,28 @@ public final class IrisDimensionCarvingResolver {
private static ParentSelectionPlan buildSelectionPlan(
Engine engine,
IrisDimensionCarvingEntry parent,
ResolvedCarvingEntry parent,
IrisBiome parentBiome,
Map<String, IrisDimensionCarvingEntry> entryIndex,
Map<String, ResolvedCarvingEntry> entryIndex,
State state
) {
List<CarvingChoice> options = new ArrayList<>();
KList<String> children = parent.getChildren();
if (children != null) {
for (String childId : children) {
if (childId == null || childId.isBlank()) {
continue;
}
IrisDimensionCarvingEntry child = entryIndex.get(childId.trim());
if (child == null || !child.isEnabled()) {
continue;
}
IrisBiome childBiome = resolveEntryBiome(engine, child, state);
if (childBiome == null) {
continue;
}
options.add(new CarvingChoice(child, rarity(childBiome)));
for (String childId : parent.children()) {
if (childId == null || childId.isBlank()) {
continue;
}
ResolvedCarvingEntry child = entryIndex.get(childId.trim());
if (child == null || !child.enabled()) {
continue;
}
IrisBiome childBiome = resolveEntryBiome(engine, child, state);
if (childBiome == null) {
continue;
}
options.add(new CarvingChoice(child, rarity(childBiome)));
}
options.add(new CarvingChoice(parent, rarity(parentBiome)));
@@ -260,14 +260,6 @@ public final class IrisDimensionCarvingResolver {
return Math.min(depth, MAX_CHILD_DEPTH);
}
private static Map<String, IrisDimensionCarvingEntry> resolveEntryIndex(Engine engine, State state) {
if (state.entryIndex == null) {
state.entryIndex = engine.getDimension().getCarvingEntryIndex();
}
return state.entryIndex;
}
private static long resolveChildSeed(Engine engine, State state) {
if (state.childSeed == null) {
state.childSeed = engine.getSeedManager().getCarve() ^ CHILD_SEED_SALT;
@@ -288,13 +280,13 @@ public final class IrisDimensionCarvingResolver {
}
public static final class State {
private final Map<Integer, IrisDimensionCarvingEntry> rootEntriesByWorldY = new HashMap<>();
private final Map<IrisDimensionCarvingEntry, ParentSelectionPlan> selectionPlans = new IdentityHashMap<>();
private final Map<IrisDimensionCarvingEntry, IrisBiome> biomeCache = new IdentityHashMap<>();
private final Map<Integer, ResolvedCarvingEntry> rootEntriesByWorldY = new HashMap<>();
private final Map<ResolvedCarvingEntry, ParentSelectionPlan> selectionPlans = new IdentityHashMap<>();
private final Map<ResolvedCarvingEntry, IrisBiome> biomeCache = new IdentityHashMap<>();
private WeakReference<Engine> engineIdentity;
private WeakReference<IrisDimension> dimensionIdentity;
private WeakReference<IrisData> dataIdentity;
private Map<String, IrisDimensionCarvingEntry> entryIndex;
private CarvingBands bands;
private Long childSeed;
private void bind(Engine engine) {
@@ -308,10 +300,10 @@ public final class IrisDimensionCarvingResolver {
engineIdentity = new WeakReference<>(engine);
dimensionIdentity = new WeakReference<>(dimension);
dataIdentity = new WeakReference<>(data);
bands = CarvingBands.of(engine);
rootEntriesByWorldY.clear();
selectionPlans.clear();
biomeCache.clear();
entryIndex = null;
childSeed = null;
}
@@ -359,10 +351,10 @@ public final class IrisDimensionCarvingResolver {
}
private static final class CarvingChoice implements IRare {
private final IrisDimensionCarvingEntry entry;
private final ResolvedCarvingEntry entry;
private final int rarity;
private CarvingChoice(IrisDimensionCarvingEntry entry, int rarity) {
private CarvingChoice(ResolvedCarvingEntry entry, int rarity) {
this.entry = entry;
this.rarity = rarity;
}
@@ -0,0 +1,33 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.object.terrain.carving;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.core.loader.IrisRegistrant;
/** The cave profiles dimensions, regions and biomes declare ({@code caveProfile}). */
public final class CaveProfiles {
private CaveProfiles() {
}
/** The profile {@code owner}, a dimension, region or biome, declares; null when it declares none, which is as good as one that is not enabled. */
public static CaveProfile declaredBy(IrisRegistrant owner) {
return owner.getModuleSettings().find(CaveProfile.class).orElse(null);
}
}
@@ -1,84 +0,0 @@
package art.arcane.iris.engine.object.terrain.carving;
import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
import art.arcane.iris.engine.object.noise.NoiseStyle;
import art.arcane.iris.engine.object.value.IrisRange;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
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.DependsOn;
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.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Snippet("dimension-carving-entry")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Dimension-level cave biome override with absolute world Y bounds.")
@Data
public class IrisDimensionCarvingEntry {
private final transient AtomicCache<IrisBiome> realBiome = new AtomicCache<>(true);
private final transient Map<Long, CNG> childGenerators = new ConcurrentHashMap<>();
@Desc("Stable id for this carving entry")
private String id = "";
@Desc("Enable or disable this carving entry")
private boolean enabled = true;
@RegistryListResource(IrisBiome.class)
@Desc("Cave biome to apply when world Y falls within worldYRange")
private String biome = "";
@Desc("Absolute world Y bounds where this carving entry applies")
private IrisRange worldYRange = new IrisRange(-64, 320);
@DependsOn({"children"})
@Desc("If this carving entry has child carving entries, this controls how small those child carving patches are.")
private double childShrinkFactor = 1.5;
@DependsOn({"children"})
@Desc("If this carving entry has child carving entries, this controls the shape pattern used to pick them.")
private IrisGeneratorStyle childStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@ArrayType(min = 1, type = String.class)
@Desc("Child carving entry ids. Child ids can point back to parent ids to create cycles; recursion is bounded by childRecursionDepth.")
private KList<String> children = new KList<>();
@Desc("Maximum recursion depth when resolving child carving entries from this entry.")
private int childRecursionDepth = 3;
public IrisBiome getRealBiome(IrisData data) {
return realBiome.aquire(() -> {
String biomeKey = getBiome();
if (biomeKey == null || biomeKey.isBlank()) {
return null;
}
return data.getBiomeLoader().load(biomeKey.trim());
});
}
public CNG getChildrenGenerator(long seed, IrisData data) {
String entryId = getId();
long idHash = entryId == null ? 0L : entryId.trim().hashCode();
long generatorSeed = seed ^ (idHash << 32) ^ 2137L;
return childGenerators.computeIfAbsent(generatorSeed, key -> {
double scale = Math.max(0.0001D, getChildShrinkFactor());
RNG random = new RNG(key);
return getChildStyle().create(random.nextParallelRNG(2137), data).bake().scale(scale).bake();
});
}
}
@@ -0,0 +1,101 @@
/*
* 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.terrain.carving;
import art.arcane.iris.builtin.carve.CarvingEntry;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.modules.IrisValues;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.util.project.noise.CNG;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.config.Range;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* One {@link CarvingEntry} made ready for one world: the biome it names, loaded from the pack when first asked for, and the
* noise that splits it into child entries, built once per seed. What the entry describes stays in the settings.
*/
public final class ResolvedCarvingEntry {
private static final long CHILD_GENERATOR_SALT = 2137L;
private static final int CHILD_GENERATOR_SIGNATURE = 2137;
private static final double MIN_CHILD_SCALE = 0.0001D;
private final CarvingEntry settings;
private final IrisGeneratorStyle childStyle;
private final AtomicCache<IrisBiome> realBiome = new AtomicCache<>(true);
private final Map<Long, CNG> childGenerators = new ConcurrentHashMap<>();
ResolvedCarvingEntry(CarvingEntry settings) {
this.settings = settings;
this.childStyle = IrisValues.generatorStyle(settings.childStyle());
}
public String id() {
return settings.id();
}
public boolean enabled() {
return settings.enabled();
}
/** The biome key the entry names, as the pack wrote it. */
public String biomeKey() {
return settings.biome();
}
public Range worldYRange() {
return settings.worldYRange();
}
public List<String> children() {
return settings.children();
}
public int childRecursionDepth() {
return settings.childRecursionDepth();
}
/** The pack biome the entry names; null when it names none or the pack has no such biome. */
public IrisBiome realBiome(IrisData data) {
return realBiome.aquire(() -> {
String biomeKey = settings.biome();
if (biomeKey.isBlank()) {
return null;
}
return data.getBiomeLoader().load(biomeKey.trim());
});
}
/** The noise that picks between the entry and its children, seeded by {@code seed} and the entry's id. */
public CNG childrenGenerator(long seed, IrisData data) {
long idHash = settings.id().trim().hashCode();
long generatorSeed = seed ^ (idHash << 32) ^ CHILD_GENERATOR_SALT;
return childGenerators.computeIfAbsent(generatorSeed, key -> {
double scale = Math.max(MIN_CHILD_SCALE, settings.childShrinkFactor());
RNG random = new RNG(key);
return childStyle.create(random.nextParallelRNG(CHILD_GENERATOR_SIGNATURE), data).bake().scale(scale).bake();
});
}
}
@@ -19,8 +19,11 @@
package art.arcane.iris.engine.object.terrain.floating;
import art.arcane.iris.builtin.floating.FloatingChildBiome;
import art.arcane.iris.builtin.floating.FloatingChildSettings;
import art.arcane.iris.builtin.floating.MergeFloatingChildrenSettings;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import java.util.List;
import java.util.Map;
@@ -46,6 +49,16 @@ public final class FloatingChildren {
return engine.getGeneration().state(FloatingChildren.class, FloatingChildren::new);
}
/** The floating children {@code biome} declares, in the order it lists them; none when it declares none. */
public static List<FloatingChildBiome> declaredBy(IrisBiome biome) {
return biome.getModuleSettings().find(FloatingChildSettings.class).map(FloatingChildSettings::children).orElse(List.of());
}
/** Whether {@code biome} samples every floating child on its own and unions their islands instead of picking one per column. */
public static boolean merges(IrisBiome biome) {
return biome.getModuleSettings().find(MergeFloatingChildrenSettings.class).map(MergeFloatingChildrenSettings::merge).orElse(false);
}
public ResolvedFloatingChild of(FloatingChildBiome settings) {
return resolved.computeIfAbsent(settings, ResolvedFloatingChild::new);
}
@@ -196,8 +196,8 @@ public final class FloatingIslandSample {
}
public static FloatingIslandSample sample(IrisBiome parent, int wx, int wz, int chunkHeight, long baseSeed, IrisData data, Engine engine, FloatingIslandBoundarySampler boundarySampler) {
List<FloatingChildBiome> settings = parent.getFloatingChildBiomes();
if (settings == null || settings.isEmpty()) {
List<FloatingChildBiome> settings = FloatingChildren.declaredBy(parent);
if (settings.isEmpty()) {
return reject(REJECT_NO_ENTRIES);
}
KList<ResolvedFloatingChild> entries = new KList<>(FloatingChildren.of(data).of(settings));
@@ -208,7 +208,7 @@ public final class FloatingIslandSample {
int boundaryFieldWidth = maximumEdgeFieldWidth(entries, baseSeed, data, parent);
int parentBoundaryDistance = boundarySampler.edgeDistance(parent, wx, wz, boundaryFieldWidth);
if (parent.isMergeFloatingChildBiomes()) {
if (FloatingChildren.merges(parent)) {
return sampleMerged(parent, entries, wx, wz, chunkHeight, baseSeed, data, engine, boundarySampler,
parentBoundaryDistance, boundaryFieldWidth);
}
@@ -18,20 +18,22 @@
package art.arcane.iris.engine.object.terrain.floating;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.builtin.floating.FloatingChildBiome;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.modules.IrisValues;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.terrain.carving.CaveProfiles;
import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.prefab.IrisObjectScale;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingEntry;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
import art.arcane.iris.engine.object.terrain.carving.ResolvedCarvingEntry;
import art.arcane.iris.engine.object.terrain.carving.CarvingBands;
import art.arcane.iris.engine.object.terrain.carving.CarvingResolver;
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.util.project.noise.CNG;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
@@ -137,11 +139,12 @@ public final class ResolvedFloatingChild implements IRare {
return carvingProfileSamplerCache.aquire(() -> {
IrisBiome resolved = resolveCarvingBiome(settings.carving(), engine, data);
if (resolved == null || resolved.getCaveProfile() == null || !resolved.getCaveProfile().enabled()) {
CaveProfile profile = resolved == null ? null : CaveProfiles.declaredBy(resolved);
if (profile == null || !profile.enabled()) {
return null;
}
return new IrisCaveProfileSampler(engine, resolved.getCaveProfile());
return new IrisCaveProfileSampler(engine, profile);
});
}
@@ -155,12 +158,9 @@ public final class ResolvedFloatingChild implements IRare {
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);
}
ResolvedCarvingEntry entry = CarvingBands.of(engine).index().get(carving);
if (entry != null) {
return CarvingResolver.resolveEntryBiome(engine, entry);
}
if (data.getBiomeLoader() == null) {
@@ -18,8 +18,6 @@
package art.arcane.iris.engine.object.world.biome;
import art.arcane.iris.builtin.floating.FloatingChildBiome;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.engine.object.entity.IrisEffect;
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
import art.arcane.iris.engine.object.loot.IrisBlockDrops;
@@ -104,7 +102,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
private transient volatile SeededBiomeGenerator recentBiomeGenerator;
private final transient AtomicCache<Integer> maxHeight = new AtomicCache<>();
private final transient AtomicCache<Integer> maxWithObjectHeight = new AtomicCache<>();
private final transient AtomicCache<IrisBiome> realCarveBiome = new AtomicCache<>();
private final transient AtomicCache<KList<IrisBiome>> realChildren = new AtomicCache<>();
private final transient AtomicCache<KList<CNG>> layerHeightGenerators = new AtomicCache<>();
private final transient AtomicCache<KList<CNG>> layerSeaHeightGenerators = new AtomicCache<>();
@@ -138,8 +135,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
private boolean lockLayers = false;
@Desc("The max layers to iterate below the surface for locked layer biomes (mesa).")
private int lockLayersMax = 7;
@Desc("Profile-driven 3D cave configuration")
private CaveProfile caveProfile = new CaveProfile();
@MinNumber(1)
@MaxNumber(512)
@Desc("The rarity of this biome (integer)")
@@ -172,13 +167,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
@ArrayType(min = 1, type = String.class)
@Desc("List any biome names (file names without.json) here as children. Portions of this biome can sometimes morph into their children. Iris supports cyclic relationships such as A > B > A > B. Iris will stop checking 4 biomes down the tree.")
private KList<String> children = new KList<>();
@RegistryListResource(IrisBiome.class)
@Desc("Registers the referenced biome with this pack's reachable biome set. It is NOT applied as a substitute under carvings; cave biomes come from the region's caveBiomes list.")
private String carvingBiome = "";
@MinNumber(0)
@MaxNumber(256)
@Desc("Minimum depth below terrain surface required before this cave biome can be selected.")
private int caveMinDepthBelowSurface = 0;
@Desc("The default slab if iris decides to place a slab in this biome. Default is no slab.")
private IrisBiomePaletteLayer slab = new IrisBiomePaletteLayer().zero();
@Desc("The default wall if iris decides to place a wall higher than 2 blocks (steep hills or possibly cliffs)")
@@ -201,11 +189,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
@ArrayType(min = 1, type = IrisStructurePlacement.class)
@Desc("Structures define jigsaw or vanilla/datapack structures iris will place in this biome")
private KList<IrisStructurePlacement> structures = new KList<>();
@ArrayType(min = 1, type = FloatingChildBiome.class)
@Desc("Floating child biomes that procedurally generate above this biome's terrain. Each entry references a target biome whose layers, decorators, and objects drive the floating island's visual design, while the config here drives size, shape, altitude, rarity, and water level. Multiple entries are supported and selected by rarity per column unless mergeFloatingChildBiomes is enabled.")
private KList<FloatingChildBiome> floatingChildBiomes = new KList<>();
@Desc("When true, every floating child entry is sampled independently and their solid masks are unioned, so multiple floating islands can stack, overlap, and collide instead of the picker choosing only one child per column.")
private boolean mergeFloatingChildBiomes = false;
@ArrayType(min = 1, type = IrisBiomeGeneratorLink.class)
@Desc("Generators for this biome. Multiple generators with different interpolation sizes will mix with other biomes how you would expect. This defines your biome height relative to the fluid height. Use negative for oceans.")
private KList<IrisBiomeGeneratorLink> generators = new KList<IrisBiomeGeneratorLink>().qadd(new IrisBiomeGeneratorLink());
@@ -321,19 +304,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
return IrisBiomeGenLinks.getGenLink(this, loadKey);
}
public IrisBiome getRealCarvingBiome(IrisData data) {
return realCarveBiome.aquire(() ->
{
IrisBiome biome = data.getBiomeLoader().load(getCarvingBiome());
if (biome == null) {
biome = this;
}
return biome;
});
}
public KList<IrisObjectPlacement> getSurfaceObjects() {
return getSurfaceObjectsCache().aquire(() ->
{
@@ -18,8 +18,6 @@
package art.arcane.iris.engine.object.world.dimension;
import art.arcane.iris.builtin.floating.FloatingChildBiome;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.engine.object.decoration.IrisImportedFeatureControl;
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
import art.arcane.iris.engine.object.image.IrisImageMap;
@@ -34,7 +32,6 @@ import art.arcane.iris.engine.object.noise.NoiseStyle;
import art.arcane.iris.engine.object.procedural.tree.IrisTreeSettings;
import art.arcane.iris.engine.object.runtime.StudioMode;
import art.arcane.iris.engine.object.structure.IrisStructurePlacement;
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingEntry;
import art.arcane.iris.engine.object.value.IrisRange;
import art.arcane.iris.engine.object.world.IrisEnvironment;
import art.arcane.iris.engine.object.world.IrisWorldBoundary;
@@ -45,7 +42,6 @@ import art.arcane.iris.engine.object.world.region.IrisRegion;
import art.arcane.iris.core.IrisDatapackCompiler.DimensionHeight;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.core.loader.IrisRegistrant;
import art.arcane.iris.core.nms.datapack.DataVersion;
import art.arcane.iris.core.nms.datapack.IDataFixer;
@@ -84,7 +80,6 @@ import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Locale;
@@ -110,7 +105,6 @@ public class IrisDimension extends IrisRegistrant {
private final transient AtomicCache<Double> cosr = new AtomicCache<>();
private final transient AtomicCache<Double> rad = new AtomicCache<>();
private final transient AtomicCache<Boolean> featuresUsed = new AtomicCache<>();
private final transient AtomicCache<Map<String, IrisDimensionCarvingEntry>> carvingEntryIndex = new AtomicCache<>();
@MinNumber(2)
@Required
@Desc("The human readable name of this dimension")
@@ -175,13 +169,6 @@ public class IrisDimension extends IrisRegistrant {
private boolean postProcessingSlabs = true;
@Desc("Add painted walls in post processing")
private boolean postProcessingWalls = true;
@Desc("Enable or disable all carving for this dimension")
private boolean carvingEnabled = true;
@ArrayType(type = IrisDimensionCarvingEntry.class, min = 1)
@Desc("Dimension-level cave biome carving overrides with absolute world Y ranges")
private KList<IrisDimensionCarvingEntry> carving = new KList<>();
@Desc("Profile-driven 3D cave configuration")
private CaveProfile caveProfile = new CaveProfile();
@Desc("Refuse to place surface objects and trees over carved surface openings.")
private boolean requireObjectSurfaceSupport = true;
@MinNumber(0)
@@ -298,36 +285,6 @@ public class IrisDimension extends IrisRegistrant {
return (int) getDimensionHeight().getMin();
}
public Map<String, IrisDimensionCarvingEntry> getCarvingEntryIndex() {
return carvingEntryIndex.aquire(() -> {
Map<String, IrisDimensionCarvingEntry> index = new HashMap<>();
KList<IrisDimensionCarvingEntry> entries = getCarving();
if (entries == null || entries.isEmpty()) {
return index;
}
for (IrisDimensionCarvingEntry entry : entries) {
if (entry == null) {
continue;
}
String entryId = entry.getId();
if (entryId == null || entryId.isBlank()) {
continue;
}
index.put(entryId.trim(), entry);
}
return index;
});
}
public void setCarving(KList<IrisDimensionCarvingEntry> carving) {
this.carving = carving == null ? new KList<>() : carving;
carvingEntryIndex.reset();
}
public int getFluidHeight() {
return fluidHeight - (int) dimensionHeight.getMin();
}
@@ -449,17 +406,9 @@ public class IrisDimension extends IrisRegistrant {
}
}
KList<IrisDimensionCarvingEntry> carvingEntries = getCarving();
if (carvingEntries != null) {
for (IrisDimensionCarvingEntry entry : carvingEntries) {
if (entry != null && entry.isEnabled()) {
addReachableBiomeKey(pending, entry.getBiome());
}
}
}
addReachableBiomeKeys(pending, getModuleSettings().usedBiomes(getModuleSettings()));
Set<String> visited = new HashSet<>();
Map<String, IrisDimensionCarvingEntry> carvingEntryIndex = getCarvingEntryIndex();
while (!pending.isEmpty()) {
String biomeKey = pending.removeFirst();
if (!visited.add(biomeKey)) {
@@ -479,20 +428,8 @@ public class IrisDimension extends IrisRegistrant {
visited.add(loadKey);
biomes.put(loadKey, biome);
addReachableBiomeKeys(pending, biome.getChildren());
addReachableBiomeKey(pending, biome.getCarvingBiome());
KList<FloatingChildBiome> floatingChildren = biome.getFloatingChildBiomes();
if (floatingChildren == null) {
continue;
}
for (FloatingChildBiome floatingChild : floatingChildren) {
if (floatingChild != null) {
addReachableBiomeKey(pending, floatingChild.biome());
String carvingReference = floatingChild.carving();
IrisDimensionCarvingEntry carvingEntry = carvingEntryIndex.get(carvingReference);
addReachableBiomeKey(pending,
carvingEntry == null ? carvingReference : carvingEntry.getBiome());
}
}
addReachableBiomeKeys(pending, biome.getModuleSettings().treeBiomes());
addReachableBiomeKeys(pending, biome.getModuleSettings().usedBiomes(getModuleSettings()));
}
return biomes.v();
@@ -18,7 +18,6 @@
package art.arcane.iris.engine.object.world.region;
import art.arcane.iris.builtin.carve.CaveProfile;
import art.arcane.iris.engine.object.entity.IrisEffect;
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
import art.arcane.iris.engine.object.loot.IrisBlockDrops;
@@ -32,7 +31,6 @@ import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.framework.render.RenderType;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.core.loader.IrisRegistrant;
import art.arcane.iris.engine.data.cache.AtomicCache;
import art.arcane.iris.engine.object.annotations.ArrayType;
@@ -123,8 +121,6 @@ public class IrisRegion extends IrisRegistrant implements IRare {
@MinNumber(0.0001)
@Desc("How large cave biomes are in this region")
private double caveBiomeZoom = 1;
@Desc("Profile-driven 3D cave configuration")
private CaveProfile caveProfile = new CaveProfile();
@RegistryListResource(IrisBiome.class)
@Required
@ArrayType(min = 1, type = String.class)
@@ -216,7 +212,7 @@ public class IrisRegion extends IrisRegistrant implements IRare {
continue;
}
names.add(biome.getCarvingBiome());
names.addAll(biome.getModuleSettings().treeBiomes());
b.put(biome.getLoadKey(), biome);
names.addAll(biome.getChildren());
}
@@ -313,7 +309,7 @@ public class IrisRegion extends IrisRegistrant implements IRare {
continue;
}
names.add(biome.getCarvingBiome());
names.addAll(biome.getModuleSettings().treeBiomes());
b.put(biome.getLoadKey(), biome);
names.addAll(biome.getChildren());
}