mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
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:
1 parent
6617cc3957
commit
cff492ada8
32 files changed
+927
-356
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user