mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
Merge branch 'wave3/c'
# Conflicts: # README.md # src/main/java/art/arcane/iris/engine/actuator/TerrainModule.java # src/main/java/art/arcane/iris/engine/mantle/components/CaveCarving.java # src/main/java/art/arcane/iris/engine/object/world/biome/IrisBiome.java # src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimension.java
This commit is contained in:
commit
9b5ced0cc8
50 files changed
+1807
-1047
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,67 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.deposit;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* One deposit ore remap rule, an entry of {@code depositVariants}: within a vertical band, ore blocks are rewritten to
|
||||
* alternate blocks. A value of IrisApi types only; {@code ResolvedDepositVariant} resolves the blocks.
|
||||
*/
|
||||
@Snippet("deposit-variant")
|
||||
@Desc("Remaps ore block ids to alternate block ids within a vertical band. Ores declared at dimension, region, and biome scope can be rewritten at placement time (for example, iron_ore -> deepslate_iron_ore inside a deep carving band, or yourmod:iron -> yourmod:moon_iron inside a lunar biome).")
|
||||
public final class DepositVariant {
|
||||
@Required
|
||||
@MinNumber(-2048)
|
||||
@MaxNumber(8192)
|
||||
@Desc("Inclusive minimum world Y this variant applies at.")
|
||||
private int minHeight = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(-2048)
|
||||
@MaxNumber(8192)
|
||||
@Desc("Inclusive maximum world Y this variant applies at.")
|
||||
private int maxHeight = 0;
|
||||
|
||||
@Required
|
||||
@Desc("Source block id (for example `minecraft:iron_ore`) -> replacement block id (for example `minecraft:deepslate_iron_ore`). Any block id the data loader resolves is accepted, including external/mod blocks. Source match is by material only, so block properties on the source key are ignored.")
|
||||
private Map<String, String> remap = Map.of();
|
||||
|
||||
public DepositVariant() {
|
||||
}
|
||||
|
||||
public int minHeight() {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
public int maxHeight() {
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
public Map<String, String> remap() {
|
||||
return remap == null ? Map.of() : Collections.unmodifiableMap(remap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.deposit;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MinItems;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The deposit ore remap rules one dimension, region or biome declares, written as {@code "depositVariants": [...]}, the list
|
||||
* of {@link DepositVariant}s. The biome's rules apply first, then the region's, then the dimension's; the first matching rule wins.
|
||||
*/
|
||||
@Desc("Deposit ore remap rules. Each entry declares a vertical band and a source->replacement block id map. Applied biome first, then region, then dimension; first matching rule wins.")
|
||||
@Feature(id = "iris:deposit/variants", name = "Deposit variants", key = "depositVariants", root = "variants",
|
||||
targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
|
||||
public final class DepositVariantSettings implements IrisFeature {
|
||||
@MinItems(1)
|
||||
@Desc("Deposit ore remap rules. Each entry declares a vertical band and a source->replacement block id map. Applied biome first, then region, then dimension; first matching rule wins.")
|
||||
private List<DepositVariant> variants = List.of();
|
||||
|
||||
public DepositVariantSettings() {
|
||||
}
|
||||
|
||||
public DepositVariantSettings(List<DepositVariant> variants) {
|
||||
this.variants = List.copyOf(variants);
|
||||
}
|
||||
|
||||
public List<DepositVariant> variants() {
|
||||
return variants == null ? List.of() : Collections.unmodifiableList(variants);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.deposit;
|
||||
|
||||
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 oreDepositFrequencyMultiplier}, written as the bare number. */
|
||||
@Desc("Multiplier applied to the frequency of every ore deposit whose center is inside this biome. A value of 0.4 keeps 40% of ore veins while leaving non-ore deposits unchanged.")
|
||||
@Feature(id = "iris:deposit/ore-frequency", name = "Ore deposit frequency", key = "oreDepositFrequencyMultiplier", root = "multiplier", targets = Target.BIOME)
|
||||
public final class OreFrequencySettings implements IrisFeature {
|
||||
private static final double UNCHANGED = 1D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Multiplier applied to the frequency of every ore deposit whose center is inside this biome. A value of 0.4 keeps 40% of ore veins while leaving non-ore deposits unchanged.")
|
||||
private double multiplier = UNCHANGED;
|
||||
|
||||
public OreFrequencySettings() {
|
||||
}
|
||||
|
||||
public OreFrequencySettings(double multiplier) {
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public double multiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.deposit;
|
||||
|
||||
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 oreDepositSizeMultiplier}, written as the bare number. */
|
||||
@Desc("Multiplier applied to the block count of every ore deposit whose center is inside this biome. Non-ore deposits are unchanged.")
|
||||
@Feature(id = "iris:deposit/ore-size", name = "Ore deposit size", key = "oreDepositSizeMultiplier", root = "multiplier", targets = Target.BIOME)
|
||||
public final class OreSizeSettings implements IrisFeature {
|
||||
private static final double UNCHANGED = 1D;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(16)
|
||||
@Desc("Multiplier applied to the block count of every ore deposit whose center is inside this biome. Non-ore deposits are unchanged.")
|
||||
private double multiplier = UNCHANGED;
|
||||
|
||||
public OreSizeSettings() {
|
||||
}
|
||||
|
||||
public OreSizeSettings(double multiplier) {
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public double multiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/**
|
||||
* A dimension's {@code hideOresForHiddenOre}: whether every ore block the generator would place is replaced with its base
|
||||
* material. Written as the bare boolean.
|
||||
*/
|
||||
@Desc("When true, every ore block the generator would place (terrain ores, deposits, ores inside objects) is replaced with its base material such as stone, deepslate or netherrack, so drop-control plugins like HiddenOre can manage ore rewards themselves")
|
||||
@Feature(id = "iris:terrain/hide-ores", name = "Hide ores", key = "hideOresForHiddenOre", root = "hide", targets = Target.DIMENSION)
|
||||
public final class HideOresSettings implements IrisFeature {
|
||||
@Desc("When true, every ore block the generator would place (terrain ores, deposits, ores inside objects) is replaced with its base material such as stone, deepslate or netherrack, so drop-control plugins like HiddenOre can manage ore rewards themselves")
|
||||
private boolean hide = false;
|
||||
|
||||
public HideOresSettings() {
|
||||
}
|
||||
|
||||
public HideOresSettings(boolean hide) {
|
||||
this.hide = hide;
|
||||
}
|
||||
|
||||
public boolean hide() {
|
||||
return hide;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,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.terrain;
|
||||
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Range;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One ore generator of a dimension, region or biome, an entry of its {@code ores} list: single ore blocks scattered
|
||||
* through the terrain by a noise field, in a vertical band. A value of IrisApi types only; the terrain module resolves
|
||||
* its blocks and builds its noise ({@code ResolvedOre}).
|
||||
*/
|
||||
@Desc("Scatters single ore blocks through terrain by sampling a noise field at every block in a vertical band. Defined on dimensions, regions, or biomes; the most specific level wins.")
|
||||
public final class OreGenerator {
|
||||
private static final double DEFAULT_THRESHOLD = 0.5;
|
||||
private static final double DEFAULT_RANGE_MIN = 30;
|
||||
private static final double DEFAULT_RANGE_MAX = 80;
|
||||
|
||||
@Desc("The ore blocks to place. An empty palette generates nothing, so this must be set for the generator to have any effect.")
|
||||
private PaletteSpec palette = PaletteSpec.of(List.of());
|
||||
|
||||
@Desc("The noise style sampled per block to decide where ore appears. STATIC gives independent random speckle; smoother styles give veiny clusters.")
|
||||
private NoiseStyle chanceStyle = NoiseStyle.of("STATIC");
|
||||
|
||||
@Desc("When true this generator also replaces surface-layer blocks (it runs before layers and fluid); when false it only replaces underground rock.")
|
||||
private boolean generateSurface = false;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Noise cutoff: a block becomes ore when the sampled noise is at or below this value, so higher means more ore. 0 disables, 1 replaces everything in range.")
|
||||
private double threshold = DEFAULT_THRESHOLD;
|
||||
|
||||
@Desc("Vertical band (min, max) this ore can generate in, in engine-local Y where 0 is the bottom of the dimension, not world Y.")
|
||||
private Range range = Range.of(DEFAULT_RANGE_MIN, DEFAULT_RANGE_MAX);
|
||||
|
||||
public OreGenerator() {
|
||||
}
|
||||
|
||||
public PaletteSpec palette() {
|
||||
return palette;
|
||||
}
|
||||
|
||||
public NoiseStyle chanceStyle() {
|
||||
return chanceStyle;
|
||||
}
|
||||
|
||||
public boolean generateSurface() {
|
||||
return generateSurface;
|
||||
}
|
||||
|
||||
public double threshold() {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
public Range range() {
|
||||
return range;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MinItems;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The ore generators one dimension, region or biome declares, written as {@code "ores": [...]}, the list of generators.
|
||||
* Levels stack: a column's ores come from its biome first, then its region, then the dimension. IrisApi types only,
|
||||
* like {@link OreGenerator}.
|
||||
*/
|
||||
@Desc("Collection of ores to be generated")
|
||||
@Feature(id = "iris:terrain/ores", name = "Ores", key = "ores", root = "generators", targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
|
||||
public final class OreSettings implements IrisFeature {
|
||||
@MinItems(1)
|
||||
@Desc("Collection of ores to be generated")
|
||||
private List<OreGenerator> generators = List.of();
|
||||
|
||||
public OreSettings() {
|
||||
}
|
||||
|
||||
public OreSettings(List<OreGenerator> generators) {
|
||||
this.generators = List.copyOf(generators);
|
||||
}
|
||||
|
||||
public List<OreGenerator> generators() {
|
||||
return generators == null ? List.of() : Collections.unmodifiableList(generators);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.HideOresSettings;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
|
||||
/** Whether a dimension hides its ores ({@code hideOresForHiddenOre}): the terrain places none and the perfection pass turns the rest into their base blocks. */
|
||||
public final class HiddenOres {
|
||||
private HiddenOres() {
|
||||
}
|
||||
|
||||
public static boolean in(IrisDimension dimension) {
|
||||
return dimension.getModuleSettings().find(HideOresSettings.class).map(HideOresSettings::hide).orElse(false);
|
||||
}
|
||||
}
|
||||
@@ -19,55 +19,52 @@
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
/**
|
||||
* Builds the noise of every ore generator the world's biomes, regions and dimension declare before generation needs it.
|
||||
* A generator keeps the noise of the first random it is given, so each one is warmed with the random of its place in
|
||||
* A generator keeps the noise of the first seed it is given, so each one is warmed with the seed of its place in
|
||||
* this order: the biomes by key, the regions by key, then the dimension. The order is part of what a world generates.
|
||||
*/
|
||||
final class OreWarmUp {
|
||||
private static final long ROOT_SEED_SALT = 7777L;
|
||||
|
||||
private final Engine engine;
|
||||
private final TerrainOres ores;
|
||||
private final RNG root;
|
||||
private int warmed;
|
||||
|
||||
OreWarmUp(Engine engine) {
|
||||
this(engine, TerrainOres.of(engine));
|
||||
}
|
||||
|
||||
OreWarmUp(Engine engine, TerrainOres ores) {
|
||||
this.engine = engine;
|
||||
this.ores = ores;
|
||||
this.root = new RNG(engine.getSeedManager().getComponent() + ROOT_SEED_SALT);
|
||||
}
|
||||
|
||||
void warm() {
|
||||
LongSupplier seeds = () -> root.nextParallelRNG(warmed++).getSeed();
|
||||
|
||||
KList<IrisBiome> biomes = engine.getAllBiomes();
|
||||
biomes.sort(Comparator.comparing(IrisBiome::getLoadKey));
|
||||
for (IrisBiome biome : biomes) {
|
||||
warmAll(biome.getOres());
|
||||
ores.of(biome).warm(seeds);
|
||||
}
|
||||
|
||||
KList<IrisRegion> regions = engine.getDimension().getAllRegions(engine);
|
||||
regions.sort(Comparator.comparing(IrisRegion::getLoadKey));
|
||||
for (IrisRegion region : regions) {
|
||||
warmAll(region.getOres());
|
||||
ores.of(region).warm(seeds);
|
||||
}
|
||||
|
||||
warmAll(engine.getDimension().getOres());
|
||||
}
|
||||
|
||||
private void warmAll(KList<IrisOreGenerator> ores) {
|
||||
if (ores == null) {
|
||||
return;
|
||||
}
|
||||
for (IrisOreGenerator ore : ores) {
|
||||
if (ore != null) {
|
||||
ore.warm(root.nextParallelRNG(warmed++), engine.getData());
|
||||
}
|
||||
}
|
||||
ores.of(engine.getDimension()).warm(seeds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.OreGenerator;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.common.data.B;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.PaletteSampler;
|
||||
import com.volmit.noise.NoiseFactory;
|
||||
import com.volmit.noise.NoiseSampler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One {@link OreGenerator} made ready for one world: its palette resolved to the platform's blocks and the noise that
|
||||
* decides where it places ore, built from the seed it is warmed with or, when nothing warmed it, from the terrain seed
|
||||
* of its first use. The palette picks with the terrain seed. What the generator describes stays in the settings;
|
||||
* everything that needs the platform, the pack or the world seed is here.
|
||||
*/
|
||||
final class ResolvedOre {
|
||||
private final OreGenerator settings;
|
||||
private final NoiseFactory noise;
|
||||
private final BlockRegistry blockRegistry;
|
||||
private final long terrainSeed;
|
||||
private final List<PlatformBlockState> blocks;
|
||||
private final AtomicCache<NoiseSampler> chance = new AtomicCache<>();
|
||||
private final AtomicCache<PaletteSampler> palette = new AtomicCache<>();
|
||||
|
||||
/**
|
||||
* @param terrainSeed the seed the palette picks with, and the noise is built from when nothing warmed it first
|
||||
* @param blocks the palette as the platform's blocks, each repeated by its weight
|
||||
*/
|
||||
ResolvedOre(OreGenerator settings, NoiseFactory noise, BlockRegistry blockRegistry, long terrainSeed, List<PlatformBlockState> blocks) {
|
||||
this.settings = settings;
|
||||
this.noise = noise;
|
||||
this.blockRegistry = blockRegistry;
|
||||
this.terrainSeed = terrainSeed;
|
||||
this.blocks = List.copyOf(blocks);
|
||||
}
|
||||
|
||||
/** {@code settings} ready for {@code engine}: its blocks resolved through the pack, its picks seeded with the terrain seed. */
|
||||
static ResolvedOre of(OreGenerator settings, Engine engine) {
|
||||
var resources = engine.getData().getPackResources();
|
||||
BlockRegistry registry = resources.blocks();
|
||||
return new ResolvedOre(settings, resources.noise(), registry, engine.getSeedManager().getTerrain(), weighted(registry, settings.palette().palette()));
|
||||
}
|
||||
|
||||
private static List<PlatformBlockState> weighted(BlockRegistry registry, List<BlockSpec> specs) {
|
||||
List<PlatformBlockState> weighted = new ArrayList<>();
|
||||
for (BlockSpec spec : specs) {
|
||||
PlatformBlockState state = B.getState(registry.resolve(spec).key());
|
||||
if (state == null) {
|
||||
continue;
|
||||
}
|
||||
for (int n = 0; n < spec.weight(); n++) {
|
||||
weighted.add(state);
|
||||
}
|
||||
}
|
||||
return weighted;
|
||||
}
|
||||
|
||||
boolean generatesSurface() {
|
||||
return settings.generateSurface();
|
||||
}
|
||||
|
||||
double minY() {
|
||||
return settings.range().min();
|
||||
}
|
||||
|
||||
double maxY() {
|
||||
return settings.range().max();
|
||||
}
|
||||
|
||||
/** Builds the chance noise from {@code seed}, unless it is built already: the first seed it is given is the one it keeps. */
|
||||
void warm(long seed) {
|
||||
chance.aquire(() -> noise.sampler(settings.chanceStyle(), seed));
|
||||
}
|
||||
|
||||
/** The ore block at the position, or null when the position is out of the band, the chance noise is above the threshold or the palette has no block. */
|
||||
PlatformBlockState generate(int x, int y, int z) {
|
||||
if (!settings.range().contains(y)) {
|
||||
return null;
|
||||
}
|
||||
if (settings.palette().palette().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (blocks.size() == 1) {
|
||||
return blocks.getFirst();
|
||||
}
|
||||
PaletteSampler sampler = palette.aquire(() -> blockRegistry.palette(settings.palette(), terrainSeed));
|
||||
return B.getState(sampler.at(x, y, z).key());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* 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.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.OreGenerator;
|
||||
import art.arcane.iris.builtin.terrain.OreSettings;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
/**
|
||||
* The ore generators of one dimension, region or biome made ready ({@link ResolvedOre}), in the order its settings list them
|
||||
* and split into the ones that also replace surface blocks and the ones that only replace rock. A level without ores is
|
||||
* {@link #NONE}.
|
||||
*/
|
||||
final class ResolvedOres {
|
||||
static final ResolvedOres NONE = new ResolvedOres(List.of());
|
||||
|
||||
private final List<ResolvedOre> all;
|
||||
private final List<ResolvedOre> surface;
|
||||
private final List<ResolvedOre> underground;
|
||||
private final YBand surfaceBand;
|
||||
private final YBand undergroundBand;
|
||||
|
||||
ResolvedOres(List<ResolvedOre> all) {
|
||||
this.all = List.copyOf(all);
|
||||
this.surface = this.all.stream().filter(ResolvedOre::generatesSurface).toList();
|
||||
this.underground = this.all.stream().filter(ore -> !ore.generatesSurface()).toList();
|
||||
this.surfaceBand = YBand.of(surface);
|
||||
this.undergroundBand = YBand.of(underground);
|
||||
}
|
||||
|
||||
/** {@code settings} ready for {@code engine}; generators the pack wrote as {@code null} are left out. */
|
||||
static ResolvedOres of(OreSettings settings, Engine engine) {
|
||||
List<ResolvedOre> ores = new ArrayList<>();
|
||||
for (OreGenerator generator : settings.generators()) {
|
||||
if (generator != null) {
|
||||
ores.add(ResolvedOre.of(generator, engine));
|
||||
}
|
||||
}
|
||||
return ores.isEmpty() ? NONE : new ResolvedOres(ores);
|
||||
}
|
||||
|
||||
/** The heights where any surface ore can generate. */
|
||||
YBand surfaceBand() {
|
||||
return surfaceBand;
|
||||
}
|
||||
|
||||
/** The heights where any rock-only ore can generate. */
|
||||
YBand undergroundBand() {
|
||||
return undergroundBand;
|
||||
}
|
||||
|
||||
/** Warms every ore in the order the settings list them, each with the next seed. */
|
||||
void warm(LongSupplier seeds) {
|
||||
for (ResolvedOre ore : all) {
|
||||
ore.warm(seeds.getAsLong());
|
||||
}
|
||||
}
|
||||
|
||||
PlatformBlockState generateSurface(int x, int y, int z) {
|
||||
return firstOre(surface, x, y, z);
|
||||
}
|
||||
|
||||
PlatformBlockState generateUnderground(int x, int y, int z) {
|
||||
return firstOre(underground, x, y, z);
|
||||
}
|
||||
|
||||
private static PlatformBlockState firstOre(List<ResolvedOre> ores, int x, int y, int z) {
|
||||
for (int index = 0; index < ores.size(); index++) {
|
||||
PlatformBlockState ore = ores.get(index).generate(x, y, z);
|
||||
if (ore != null) {
|
||||
return ore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** The lowest and highest height any of a set of ores reaches; empty when there are none. */
|
||||
record YBand(boolean hasOres, double min, double max) {
|
||||
static final YBand EMPTY = new YBand(false, 0, 0);
|
||||
|
||||
static YBand of(List<ResolvedOre> ores) {
|
||||
if (ores.isEmpty()) {
|
||||
return EMPTY;
|
||||
}
|
||||
double min = Double.POSITIVE_INFINITY;
|
||||
double max = Double.NEGATIVE_INFINITY;
|
||||
for (ResolvedOre ore : ores) {
|
||||
min = Math.min(min, ore.minY());
|
||||
max = Math.max(max, ore.maxY());
|
||||
}
|
||||
return new YBand(true, min, max);
|
||||
}
|
||||
|
||||
boolean contains(int y) {
|
||||
return hasOres && y >= min && y <= max;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,15 @@ import art.arcane.iris.builtin.terrain.RockPaletteSettings;
|
||||
import art.arcane.iris.builtin.terrain.SeaLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.SlabSettings;
|
||||
import art.arcane.iris.builtin.terrain.WallSettings;
|
||||
import art.arcane.iris.builtin.terrain.HideOresSettings;
|
||||
import art.arcane.iris.builtin.terrain.OreSettings;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.modules.IrisChunk;
|
||||
import art.arcane.iris.core.modules.IrisPackWorld;
|
||||
import art.arcane.iris.engine.IrisComplex;
|
||||
import art.arcane.iris.engine.UpperDimensionContext;
|
||||
import art.arcane.iris.engine.actuator.ResolvedOres.YBand;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
@@ -83,6 +84,8 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
registry.registerSettings(LockLayersMaxSettings.class);
|
||||
registry.registerSettings(RockPaletteSettings.class);
|
||||
registry.registerSettings(FluidPaletteSettings.class);
|
||||
registry.registerSettings(OreSettings.class);
|
||||
registry.registerSettings(HideOresSettings.class);
|
||||
registry.registerLifecycle(this);
|
||||
}
|
||||
|
||||
@@ -110,16 +113,18 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
private final Engine engine;
|
||||
private final TerrainPalettes palettes;
|
||||
private final BiomeLayers layers;
|
||||
private final TerrainOres ores;
|
||||
private final RNG rng;
|
||||
|
||||
TerrainShaper(Engine engine) {
|
||||
this(engine, TerrainPalettes.of(engine), BiomeLayers.of(engine));
|
||||
this(engine, TerrainPalettes.of(engine), BiomeLayers.of(engine), TerrainOres.of(engine));
|
||||
}
|
||||
|
||||
TerrainShaper(Engine engine, TerrainPalettes palettes, BiomeLayers layers) {
|
||||
TerrainShaper(Engine engine, TerrainPalettes palettes, BiomeLayers layers, TerrainOres ores) {
|
||||
this.engine = engine;
|
||||
this.palettes = palettes;
|
||||
this.layers = layers;
|
||||
this.ores = ores;
|
||||
this.rng = new RNG(engine.getSeedManager().getTerrain());
|
||||
}
|
||||
|
||||
@@ -145,17 +150,16 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
int fluidHeight = dimension.getFluidHeight();
|
||||
int clampedFluidHeight = Math.min(chunkHeight, fluidHeight);
|
||||
boolean bedrockEnabled = dimension.isBedrock();
|
||||
boolean hideOres = dimension.isHideOresForHiddenOre();
|
||||
boolean hideOres = HiddenOres.in(dimension);
|
||||
ChunkedDataCache<IrisBiome> biomeCache = context.getBiome();
|
||||
ChunkedDataCache<IrisRegion> regionCache = context.getRegion();
|
||||
int realX = xf + x;
|
||||
UpperDimensionContext upperContext = engine.getUpperContext();
|
||||
// Dimension-level ore lookups are chunk-invariant; resolving them per column paid
|
||||
// four accessor chains times 256 per chunk for constants.
|
||||
KList<IrisOreGenerator> dimensionSurfaceOres = hideOres ? null : dimension.getSurfaceOreGenerators();
|
||||
KList<IrisOreGenerator> dimensionUndergroundOres = hideOres ? null : dimension.getUndergroundOreGenerators();
|
||||
IrisOreGeneratorBounds dimensionSurfaceOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : dimension.getSurfaceOreGeneratorBounds();
|
||||
IrisOreGeneratorBounds dimensionUndergroundOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : dimension.getUndergroundOreGeneratorBounds();
|
||||
// the settings lookup times 256 per chunk for a constant.
|
||||
ResolvedOres dimensionOres = hideOres ? ResolvedOres.NONE : ores.of(dimension);
|
||||
YBand dimensionSurfaceBand = dimensionOres.surfaceBand();
|
||||
YBand dimensionUndergroundBand = dimensionOres.undergroundBand();
|
||||
|
||||
for (int zf = 0; zf < chunkDepth; zf++) {
|
||||
int realZ = zf + z;
|
||||
@@ -171,16 +175,14 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
PlatformBlockState fluid = palettes.fluidAt(realX, realZ);
|
||||
PlatformBlockState rock = palettes.rockAt(realX, realZ);
|
||||
PlatformBlockState mappedSurfaceBlock = complex.getImageMapRuntime().sampleSurfaceBlock(realX, realZ);
|
||||
KList<IrisOreGenerator> biomeSurfaceOres = hideOres ? null : biome.getSurfaceOreGenerators();
|
||||
KList<IrisOreGenerator> regionSurfaceOres = hideOres ? null : region.getSurfaceOreGenerators();
|
||||
KList<IrisOreGenerator> biomeUndergroundOres = hideOres ? null : biome.getUndergroundOreGenerators();
|
||||
KList<IrisOreGenerator> regionUndergroundOres = hideOres ? null : region.getUndergroundOreGenerators();
|
||||
IrisOreGeneratorBounds biomeSurfaceOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : biome.getSurfaceOreGeneratorBounds();
|
||||
IrisOreGeneratorBounds regionSurfaceOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : region.getSurfaceOreGeneratorBounds();
|
||||
IrisOreGeneratorBounds biomeUndergroundOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : biome.getUndergroundOreGeneratorBounds();
|
||||
IrisOreGeneratorBounds regionUndergroundOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : region.getUndergroundOreGeneratorBounds();
|
||||
boolean hasSurfaceOres = biomeSurfaceOreBounds.hasOres() || regionSurfaceOreBounds.hasOres() || dimensionSurfaceOreBounds.hasOres();
|
||||
boolean hasUndergroundOres = biomeUndergroundOreBounds.hasOres() || regionUndergroundOreBounds.hasOres() || dimensionUndergroundOreBounds.hasOres();
|
||||
ResolvedOres biomeOres = hideOres ? ResolvedOres.NONE : ores.of(biome);
|
||||
ResolvedOres regionOres = hideOres ? ResolvedOres.NONE : ores.of(region);
|
||||
YBand biomeSurfaceBand = biomeOres.surfaceBand();
|
||||
YBand regionSurfaceBand = regionOres.surfaceBand();
|
||||
YBand biomeUndergroundBand = biomeOres.undergroundBand();
|
||||
YBand regionUndergroundBand = regionOres.undergroundBand();
|
||||
boolean hasSurfaceOres = biomeSurfaceBand.hasOres() || regionSurfaceBand.hasOres() || dimensionSurfaceBand.hasOres();
|
||||
boolean hasUndergroundOres = biomeUndergroundBand.hasOres() || regionUndergroundBand.hasOres() || dimensionUndergroundBand.hasOres();
|
||||
KList<PlatformBlockState> blocks = null;
|
||||
KList<PlatformBlockState> fblocks = null;
|
||||
|
||||
@@ -192,14 +194,14 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
|
||||
PlatformBlockState ore = null;
|
||||
if (hasSurfaceOres) {
|
||||
if (biomeSurfaceOreBounds.contains(i)) {
|
||||
ore = generateOres(biomeSurfaceOres, realX, i, realZ, localRng, data);
|
||||
if (biomeSurfaceBand.contains(i)) {
|
||||
ore = biomeOres.generateSurface(realX, i, realZ);
|
||||
}
|
||||
if (ore == null && regionSurfaceOreBounds.contains(i)) {
|
||||
ore = generateOres(regionSurfaceOres, realX, i, realZ, localRng, data);
|
||||
if (ore == null && regionSurfaceBand.contains(i)) {
|
||||
ore = regionOres.generateSurface(realX, i, realZ);
|
||||
}
|
||||
if (ore == null && dimensionSurfaceOreBounds.contains(i)) {
|
||||
ore = generateOres(dimensionSurfaceOres, realX, i, realZ, localRng, data);
|
||||
if (ore == null && dimensionSurfaceBand.contains(i)) {
|
||||
ore = dimensionOres.generateSurface(realX, i, realZ);
|
||||
}
|
||||
}
|
||||
if (ore != null) {
|
||||
@@ -237,14 +239,14 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
}
|
||||
|
||||
if (hasUndergroundOres) {
|
||||
if (biomeUndergroundOreBounds.contains(i)) {
|
||||
ore = generateOres(biomeUndergroundOres, realX, i, realZ, localRng, data);
|
||||
if (biomeUndergroundBand.contains(i)) {
|
||||
ore = biomeOres.generateUnderground(realX, i, realZ);
|
||||
}
|
||||
if (ore == null && regionUndergroundOreBounds.contains(i)) {
|
||||
ore = generateOres(regionUndergroundOres, realX, i, realZ, localRng, data);
|
||||
if (ore == null && regionUndergroundBand.contains(i)) {
|
||||
ore = regionOres.generateUnderground(realX, i, realZ);
|
||||
}
|
||||
if (ore == null && dimensionUndergroundOreBounds.contains(i)) {
|
||||
ore = generateOres(dimensionUndergroundOres, realX, i, realZ, localRng, data);
|
||||
if (ore == null && dimensionUndergroundBand.contains(i)) {
|
||||
ore = dimensionOres.generateUnderground(realX, i, realZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,22 +294,5 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private PlatformBlockState generateOres(KList<IrisOreGenerator> oreGenerators, int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (oreGenerators == null || oreGenerators.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int oreCount = oreGenerators.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = oreGenerators.get(oreIndex);
|
||||
PlatformBlockState ore = oreGenerator.generate(x, y, z, rng, data);
|
||||
if (ore != null) {
|
||||
return ore;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.OreSettings;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* What the terrain module keeps for one world: the ore generators of its dimension, regions and biomes made ready
|
||||
* ({@link ResolvedOres}), built from their {@link OreSettings} when first asked for or ahead of generation by {@link OreWarmUp}.
|
||||
*/
|
||||
final class TerrainOres {
|
||||
private final Engine engine;
|
||||
private final Map<OreSettings, ResolvedOres> resolved = new ConcurrentHashMap<>();
|
||||
|
||||
TerrainOres(Engine engine) {
|
||||
this.engine = engine;
|
||||
}
|
||||
|
||||
/** The ores of the world {@code engine} generates now. */
|
||||
static TerrainOres of(Engine engine) {
|
||||
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
|
||||
* 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,14 +19,18 @@
|
||||
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.terrain.TerrainPalettes;
|
||||
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;
|
||||
@@ -90,7 +94,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();
|
||||
@@ -201,7 +205,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;
|
||||
@@ -297,40 +301,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;
|
||||
}
|
||||
@@ -352,7 +356,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++) {
|
||||
@@ -360,12 +364,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);
|
||||
@@ -405,23 +409,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;
|
||||
}
|
||||
@@ -430,11 +434,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;
|
||||
}
|
||||
@@ -448,7 +452,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;
|
||||
}
|
||||
@@ -456,7 +460,7 @@ public class CaveCarving {
|
||||
}
|
||||
}
|
||||
|
||||
CaveProfile caveProfile = effectiveCaveBiome.getCaveProfile();
|
||||
CaveProfile caveProfile = CaveProfiles.declaredBy(effectiveCaveBiome);
|
||||
if (isProfileEnabled(caveProfile)) {
|
||||
resolved = caveProfile;
|
||||
}
|
||||
@@ -681,7 +685,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];
|
||||
|
||||
+2
-1
@@ -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;
|
||||
@@ -78,6 +79,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
* placement reach of any object the dimension can place.
|
||||
*/
|
||||
public class ObjectPlacing {
|
||||
private static final CaveProfile DEFAULT_CAVE_PROFILE = new CaveProfile();
|
||||
private static final long CAVE_REJECT_LOG_THROTTLE_MS = 5000L;
|
||||
private static final int BEDROCK_CLEARANCE = 6;
|
||||
private static final byte LIQUID_FORCED_AIR = 3;
|
||||
@@ -235,8 +237,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 +386,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 +1321,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;
|
||||
}
|
||||
@@ -1332,7 +1334,7 @@ public class ObjectPlacing {
|
||||
return dimensionProfile;
|
||||
}
|
||||
|
||||
return new CaveProfile();
|
||||
return DEFAULT_CAVE_PROFILE;
|
||||
}
|
||||
|
||||
private CaveAnchorMode resolveAnchorMode(IrisObjectPlacement objectPlacement, CaveProfile caveProfile) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,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;
|
||||
@@ -88,7 +87,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();
|
||||
@@ -180,7 +178,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) {
|
||||
@@ -194,14 +192,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.
|
||||
@@ -415,7 +413,6 @@ public class CaveApplying {
|
||||
int columnIndex,
|
||||
int chunkX,
|
||||
int chunkZ,
|
||||
IrisDimensionCarvingResolver.State resolverState,
|
||||
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache,
|
||||
Map<String, IrisBiome> customBiomeCache
|
||||
) {
|
||||
@@ -444,7 +441,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);
|
||||
@@ -456,7 +453,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,7 +464,6 @@ public class CaveApplying {
|
||||
int columnIndex,
|
||||
int chunkX,
|
||||
int chunkZ,
|
||||
IrisDimensionCarvingResolver.State resolverState,
|
||||
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache,
|
||||
Map<String, IrisBiome> customBiomeCache
|
||||
) {
|
||||
@@ -488,14 +484,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(
|
||||
@@ -507,16 +503,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;
|
||||
}
|
||||
@@ -580,7 +575,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))) {
|
||||
@@ -602,8 +597,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;
|
||||
}
|
||||
@@ -657,10 +652,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) {
|
||||
@@ -675,11 +670,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) {
|
||||
@@ -701,16 +696,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;
|
||||
@@ -733,14 +728,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);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,11 @@ package art.arcane.iris.engine.modifier;
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.builtin.deposit.DepositGenerator;
|
||||
import art.arcane.iris.builtin.deposit.DepositSettings;
|
||||
import art.arcane.iris.builtin.deposit.DepositVariantSettings;
|
||||
import art.arcane.iris.builtin.deposit.OreFrequencySettings;
|
||||
import art.arcane.iris.builtin.deposit.OreSizeSettings;
|
||||
import art.arcane.iris.core.modules.IrisChunk;
|
||||
import com.volmit.FeatureRegistry;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
@@ -48,6 +52,13 @@ public final class DepositModule implements IrisModule {
|
||||
return ModuleInfo.of("iris:deposit", "Deposits", VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(FeatureRegistry registry) {
|
||||
registry.registerSettings(DepositVariantSettings.class);
|
||||
registry.registerSettings(OreFrequencySettings.class);
|
||||
registry.registerSettings(OreSizeSettings.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void install(StageGraph graph) {
|
||||
graph.define(IrisStages.Deposit.ORES)
|
||||
|
||||
@@ -21,12 +21,15 @@ package art.arcane.iris.engine.modifier;
|
||||
import art.arcane.iris.builtin.deposit.DepositGenerator;
|
||||
import art.arcane.iris.builtin.deposit.DepositHeightDistribution;
|
||||
import art.arcane.iris.builtin.deposit.DepositPlacementScope;
|
||||
import art.arcane.iris.builtin.deposit.DepositVariant;
|
||||
import art.arcane.iris.builtin.deposit.DepositVariantSettings;
|
||||
import art.arcane.iris.builtin.deposit.OreFrequencySettings;
|
||||
import art.arcane.iris.builtin.deposit.OreSizeSettings;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
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.terrain.deposit.IrisDepositVariant;
|
||||
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;
|
||||
@@ -52,7 +55,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class DepositPlacer extends EngineAssignedComponent {
|
||||
private final RNG rng;
|
||||
private static final double UNCHANGED_ORE_MULTIPLIER = 1D;
|
||||
|
||||
private final Map<DepositGenerator, ResolvedDeposit> resolved = new ConcurrentHashMap<>();
|
||||
private final Map<DepositVariant, ResolvedDepositVariant> variants = new ConcurrentHashMap<>();
|
||||
|
||||
public DepositPlacer(Engine engine) {
|
||||
super(engine, "Deposit");
|
||||
@@ -95,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;
|
||||
@@ -141,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;
|
||||
@@ -150,13 +154,13 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
|
||||
if (oreDeposit) {
|
||||
if (depositBiome != null) {
|
||||
double frequencyMultiplier = depositBiome.getOreDepositFrequencyMultiplier();
|
||||
double frequencyMultiplier = oreFrequencyMultiplier(depositBiome);
|
||||
if (frequencyMultiplier < 1D
|
||||
&& !passesOreFrequency(frequencyMultiplier, rng.d())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double sizeMultiplier = depositBiome.getOreDepositSizeMultiplier();
|
||||
double sizeMultiplier = oreSizeMultiplier(depositBiome);
|
||||
if (sizeMultiplier != 1D) {
|
||||
IrisObject scaledClump = deposit.clump(rng, sizeMultiplier);
|
||||
int scaledDimension = scaledClump.getW();
|
||||
@@ -204,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);
|
||||
@@ -310,14 +314,14 @@ 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.getDepositVariants(), ore, worldY);
|
||||
PlatformBlockState match = matchDepositVariant(biome, ore, worldY);
|
||||
if (match != null) {
|
||||
return match;
|
||||
}
|
||||
@@ -325,14 +329,14 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
|
||||
IrisRegion region = context.getRegion().get(nx, nz);
|
||||
if (region != null) {
|
||||
PlatformBlockState match = matchDepositVariant(region.getDepositVariants(), ore, worldY);
|
||||
PlatformBlockState match = matchDepositVariant(region, ore, worldY);
|
||||
if (match != null) {
|
||||
return match;
|
||||
}
|
||||
}
|
||||
|
||||
if (dimension != null) {
|
||||
PlatformBlockState match = matchDepositVariant(dimension.getDepositVariants(), ore, worldY);
|
||||
PlatformBlockState match = matchDepositVariant(dimension, ore, worldY);
|
||||
if (match != null) {
|
||||
return match;
|
||||
}
|
||||
@@ -341,17 +345,14 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
return null;
|
||||
}
|
||||
|
||||
private PlatformBlockState matchDepositVariant(java.util.List<IrisDepositVariant> variants, PlatformBlockState ore, int y) {
|
||||
if (variants == null || variants.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (IrisDepositVariant variant : variants) {
|
||||
if (y < variant.getMinHeight() || y > variant.getMaxHeight()) {
|
||||
private PlatformBlockState matchDepositVariant(IrisRegistrant owner, PlatformBlockState ore, int y) {
|
||||
for (DepositVariant declared : variantsOf(owner)) {
|
||||
ResolvedDepositVariant variant = variants.computeIfAbsent(declared, ResolvedDepositVariant::new);
|
||||
if (!variant.appliesAt(y)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlatformBlockState swapped = variant.remapOrNull(ore, getData());
|
||||
PlatformBlockState swapped = variant.remapOrNull(ore);
|
||||
if (swapped != null) {
|
||||
return swapped;
|
||||
}
|
||||
@@ -359,4 +360,16 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<DepositVariant> variantsOf(IrisRegistrant owner) {
|
||||
return owner.getModuleSettings().find(DepositVariantSettings.class).map(DepositVariantSettings::variants).orElse(List.of());
|
||||
}
|
||||
|
||||
private static double oreFrequencyMultiplier(IrisBiome biome) {
|
||||
return biome.getModuleSettings().find(OreFrequencySettings.class).map(OreFrequencySettings::multiplier).orElse(UNCHANGED_ORE_MULTIPLIER);
|
||||
}
|
||||
|
||||
private static double oreSizeMultiplier(IrisBiome biome) {
|
||||
return biome.getModuleSettings().find(OreSizeSettings.class).map(OreSizeSettings::multiplier).orElse(UNCHANGED_ORE_MULTIPLIER);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -229,7 +230,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);
|
||||
@@ -314,7 +315,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
|
||||
|
||||
@@ -20,6 +20,7 @@ package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.core.modules.IrisChunk;
|
||||
import art.arcane.iris.engine.actuator.HiddenOres;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
@@ -68,7 +69,7 @@ public final class PerfectionModule implements IrisModule {
|
||||
IrisDimension dimension = engine.getDimension();
|
||||
PrecisionStopwatch stopwatch = PrecisionStopwatch.start();
|
||||
Hunk<PlatformBlockState> blocks = chunk.blocks();
|
||||
if (dimension.isHideOresForHiddenOre()) {
|
||||
if (HiddenOres.in(dimension)) {
|
||||
hideOres(blocks);
|
||||
}
|
||||
boolean removed;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.deposit.DepositVariant;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.common.data.B;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* One {@link DepositVariant} made ready: its source and replacement block ids resolved to the platform's blocks, built once on
|
||||
* first use. A rule whose source or replacement the platform does not know remaps nothing.
|
||||
*/
|
||||
final class ResolvedDepositVariant {
|
||||
private final DepositVariant settings;
|
||||
private final AtomicCache<Map<String, PlatformBlockState>> remapped = new AtomicCache<>();
|
||||
|
||||
ResolvedDepositVariant(DepositVariant settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
boolean appliesAt(int worldY) {
|
||||
return worldY >= settings.minHeight() && worldY <= settings.maxHeight();
|
||||
}
|
||||
|
||||
/** The block {@code ore} is rewritten to, or null when the rule does not remap its material. */
|
||||
PlatformBlockState remapOrNull(PlatformBlockState ore) {
|
||||
if (ore == null || settings.remap().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return remapped.aquire(this::resolveRemap).get(IrisProceduralBlocks.materialKey(ore));
|
||||
}
|
||||
|
||||
private Map<String, PlatformBlockState> resolveRemap() {
|
||||
Map<String, PlatformBlockState> resolved = new HashMap<>();
|
||||
for (Map.Entry<String, String> entry : settings.remap().entrySet()) {
|
||||
PlatformBlockState source = B.getStateOrNull(entry.getKey(), false);
|
||||
PlatformBlockState target = B.getStateOrNull(entry.getValue(), true);
|
||||
if (source == null || target == null) {
|
||||
continue;
|
||||
}
|
||||
resolved.put(IrisProceduralBlocks.materialKey(source), target);
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+59
-67
@@ -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);
|
||||
}
|
||||
}
|
||||
-84
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
+101
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.terrain.deposit;
|
||||
|
||||
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.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
/**
|
||||
* Ore generation for {@link IrisBiome}. IrisBiome is Gson deserialized from pack JSON, so its
|
||||
* fields stay put and only the behavior lives here. Note that {@code IrisBiome.setOres(KList)}
|
||||
* stays on IrisBiome: it is a hand written Lombok setter override that resets these caches.
|
||||
*/
|
||||
public final class IrisBiomeOres {
|
||||
private IrisBiomeOres() {
|
||||
}
|
||||
|
||||
public static PlatformBlockState generateOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data, boolean surface) {
|
||||
KList<IrisOreGenerator> localOres = surface ? getSurfaceOres(biome) : getUndergroundOres(biome);
|
||||
return generateOres(localOres, x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public static PlatformBlockState generateSurfaceOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data) {
|
||||
return generateOres(getSurfaceOres(biome), x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public static PlatformBlockState generateUndergroundOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data) {
|
||||
return generateOres(getUndergroundOres(biome), x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public static boolean hasSurfaceOres(IrisBiome biome) {
|
||||
return !getSurfaceOres(biome).isEmpty();
|
||||
}
|
||||
|
||||
public static boolean hasUndergroundOres(IrisBiome biome) {
|
||||
return !getUndergroundOres(biome).isEmpty();
|
||||
}
|
||||
|
||||
public static KList<IrisOreGenerator> getSurfaceOreGenerators(IrisBiome biome) {
|
||||
return getOres(biome, true);
|
||||
}
|
||||
|
||||
public static KList<IrisOreGenerator> getUndergroundOreGenerators(IrisBiome biome) {
|
||||
return getOres(biome, false);
|
||||
}
|
||||
|
||||
public static IrisOreGeneratorBounds getSurfaceOreGeneratorBounds(IrisBiome biome) {
|
||||
// getIfPresent fast path: aquire allocates a capturing lambda even on a hit, and this
|
||||
// runs per column on the terrain hot path.
|
||||
IrisOreGeneratorBounds cached = biome.getSurfaceOreBoundsCache().getIfPresent();
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
return biome.getSurfaceOreBoundsCache().aquire(() -> IrisOreGeneratorBounds.of(getSurfaceOres(biome)));
|
||||
}
|
||||
|
||||
public static IrisOreGeneratorBounds getUndergroundOreGeneratorBounds(IrisBiome biome) {
|
||||
IrisOreGeneratorBounds cached = biome.getUndergroundOreBoundsCache().getIfPresent();
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
return biome.getUndergroundOreBoundsCache().aquire(() -> IrisOreGeneratorBounds.of(getUndergroundOres(biome)));
|
||||
}
|
||||
|
||||
private static KList<IrisOreGenerator> getSurfaceOres(IrisBiome biome) {
|
||||
return getOres(biome, true);
|
||||
}
|
||||
|
||||
private static KList<IrisOreGenerator> getUndergroundOres(IrisBiome biome) {
|
||||
return getOres(biome, false);
|
||||
}
|
||||
|
||||
private static KList<IrisOreGenerator> getOres(IrisBiome biome, boolean surface) {
|
||||
AtomicCache<KList<IrisOreGenerator>> oreCache = surface ? biome.getSurfaceOreCache() : biome.getUndergroundOreCache();
|
||||
KList<IrisOreGenerator> cached = oreCache.getIfPresent();
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
return oreCache.aquire(() -> {
|
||||
KList<IrisOreGenerator> filtered = new KList<>();
|
||||
KList<IrisOreGenerator> localOres = biome.getOres();
|
||||
int oreCount = localOres.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = localOres.get(oreIndex);
|
||||
if (oreGenerator.isGenerateSurface() == surface) {
|
||||
filtered.add(oreGenerator);
|
||||
}
|
||||
}
|
||||
|
||||
return filtered;
|
||||
});
|
||||
}
|
||||
|
||||
private static PlatformBlockState generateOres(KList<IrisOreGenerator> localOres, int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (localOres.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int oreCount = localOres.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = localOres.get(oreIndex);
|
||||
PlatformBlockState ore = oreGenerator.generate(x, y, z, rng, data);
|
||||
if (ore != null) {
|
||||
return ore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.terrain.deposit;
|
||||
|
||||
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.common.data.B;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("deposit-variant")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Remaps ore block ids to alternate block ids within a vertical band. Ores declared at dimension, region, and biome scope can be rewritten at placement time (for example, iron_ore -> deepslate_iron_ore inside a deep carving band, or yourmod:iron -> yourmod:moon_iron inside a lunar biome).")
|
||||
@Data
|
||||
public class IrisDepositVariant {
|
||||
private final transient AtomicCache<KMap<String, PlatformBlockState>> resolved = new AtomicCache<>();
|
||||
|
||||
@Required
|
||||
@MinNumber(-2048)
|
||||
@MaxNumber(8192)
|
||||
@Desc("Inclusive minimum world Y this variant applies at.")
|
||||
private int minHeight = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(-2048)
|
||||
@MaxNumber(8192)
|
||||
@Desc("Inclusive maximum world Y this variant applies at.")
|
||||
private int maxHeight = 0;
|
||||
|
||||
@Required
|
||||
@Desc("Source block id (for example `minecraft:iron_ore`) -> replacement block id (for example `minecraft:deepslate_iron_ore`). Any block id the data loader resolves is accepted, including external/mod blocks. Source match is by material only, so block properties on the source key are ignored.")
|
||||
private KMap<String, String> remap = new KMap<>();
|
||||
|
||||
public PlatformBlockState remapOrNull(PlatformBlockState ore, IrisData rdata) {
|
||||
if (ore == null || remap == null || remap.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
KMap<String, PlatformBlockState> map = resolved.aquire(() -> buildResolved(rdata));
|
||||
return map.get(IrisProceduralBlocks.materialKey(ore));
|
||||
}
|
||||
|
||||
private KMap<String, PlatformBlockState> buildResolved(IrisData rdata) {
|
||||
KMap<String, PlatformBlockState> out = new KMap<>();
|
||||
|
||||
for (java.util.Map.Entry<String, String> entry : remap.entrySet()) {
|
||||
PlatformBlockState source = B.getStateOrNull(entry.getKey(), false);
|
||||
PlatformBlockState target = B.getStateOrNull(entry.getValue(), true);
|
||||
|
||||
if (source == null || target == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
out.put(IrisProceduralBlocks.materialKey(source), target);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.terrain.deposit;
|
||||
|
||||
import art.arcane.iris.engine.object.material.IrisMaterialPalette;
|
||||
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.core.loader.IrisData;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import art.arcane.iris.util.project.noise.CNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Scatters single ore blocks through terrain by sampling a noise field at every block in a vertical band. Defined on dimensions, regions, or biomes; the most specific level wins.")
|
||||
@Data
|
||||
public class IrisOreGenerator {
|
||||
@Desc("The ore blocks to place. An empty palette generates nothing, so this must be set for the generator to have any effect.")
|
||||
private IrisMaterialPalette palette = new IrisMaterialPalette().qclear();
|
||||
@Desc("The noise style sampled per block to decide where ore appears. STATIC gives independent random speckle; smoother styles give veiny clusters.")
|
||||
private IrisGeneratorStyle chanceStyle = new IrisGeneratorStyle(NoiseStyle.STATIC);
|
||||
@Desc("When true this generator also replaces surface-layer blocks (it runs before layers and fluid); when false it only replaces underground rock.")
|
||||
private boolean generateSurface = false;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Noise cutoff: a block becomes ore when the sampled noise is at or below this value, so higher means more ore. 0 disables, 1 replaces everything in range.")
|
||||
private double threshold = 0.5;
|
||||
@Desc("Vertical band (min, max) this ore can generate in, in engine-local Y where 0 is the bottom of the dimension, not world Y.")
|
||||
private IrisRange range = new IrisRange(30, 80);
|
||||
|
||||
private transient AtomicCache<CNG> chanceCache = new AtomicCache<>();
|
||||
|
||||
public void warm(RNG rng, IrisData data) {
|
||||
chanceCache.aquire(() -> chanceStyle.create(rng, data));
|
||||
palette.getLayerGenerator(rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState generate(int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (!range.contains(y)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (palette.getPalette().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CNG chance = chanceCache.aquire(() -> chanceStyle.create(rng, data));
|
||||
|
||||
if (chance.noise(x, y, z) > threshold) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return palette.get(rng, x, y, z, data);
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
package art.arcane.iris.engine.object.terrain.deposit;
|
||||
|
||||
import art.arcane.iris.engine.object.value.IrisRange;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
|
||||
public final class IrisOreGeneratorBounds {
|
||||
public static final IrisOreGeneratorBounds EMPTY = new IrisOreGeneratorBounds(false, 0D, 0D);
|
||||
|
||||
private final boolean hasOres;
|
||||
private final double min;
|
||||
private final double max;
|
||||
|
||||
private IrisOreGeneratorBounds(boolean hasOres, double min, double max) {
|
||||
this.hasOres = hasOres;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public static IrisOreGeneratorBounds of(KList<IrisOreGenerator> ores) {
|
||||
if (ores == null || ores.isEmpty()) {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
double min = Double.POSITIVE_INFINITY;
|
||||
double max = Double.NEGATIVE_INFINITY;
|
||||
int oreCount = ores.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = ores.get(oreIndex);
|
||||
IrisRange range = oreGenerator.getRange();
|
||||
min = Math.min(min, range.getMin());
|
||||
max = Math.max(max, range.getMax());
|
||||
}
|
||||
|
||||
return new IrisOreGeneratorBounds(true, min, max);
|
||||
}
|
||||
|
||||
public boolean hasOres() {
|
||||
return hasOres;
|
||||
}
|
||||
|
||||
public boolean contains(int y) {
|
||||
return hasOres && y >= min && y <= max;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+3
-3
@@ -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);
|
||||
}
|
||||
|
||||
+11
-11
@@ -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;
|
||||
@@ -29,10 +27,6 @@ import art.arcane.iris.engine.object.noise.NoiseStyle;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.engine.object.procedural.IrisProceduralObjects;
|
||||
import art.arcane.iris.engine.object.structure.IrisStructurePlacement;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisBiomeOres;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisDepositVariant;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
||||
import art.arcane.iris.engine.object.value.IRare;
|
||||
import art.arcane.iris.engine.object.world.biome.custom.IrisBiomeCustom;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
@@ -76,7 +70,7 @@ import java.util.Objects;
|
||||
* Represents a biome in a pack. This type is Gson deserialized straight out of user pack JSON, so
|
||||
* the field block and the transient {@link AtomicCache} block below are load bearing and must not
|
||||
* move. Behavior lives in the same-package companions:
|
||||
* {@link IrisBiomeDerivatives}, {@link IrisBiomeOres},
|
||||
* {@link IrisBiomeDerivatives},
|
||||
* {@link IrisBiomeColorRenderer} and {@link IrisBiomeGenLinks}.
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@@ -104,12 +98,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private transient volatile SeededBiomeGenerator recentBiomeGenerator;
|
||||
private final transient AtomicCache<IrisBiome> realCarveBiome = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<IrisBiome>> realChildren = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<IrisOreGenerator>> surfaceOreCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<IrisOreGenerator>> undergroundOreCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<IrisOreGeneratorBounds> surfaceOreBoundsCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<IrisOreGeneratorBounds> undergroundOreBoundsCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<Biome> derivativeResolved = new AtomicCache<>();
|
||||
private final transient AtomicCache<Biome> vanillaDerivativeResolved = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<Biome>> biomeScatterResolved = new AtomicCache<>();
|
||||
@@ -136,8 +125,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
private KList<IrisBlockDrops> blockDrops = new KList<>();
|
||||
@Desc("Reference loot tables in this area")
|
||||
private IrisLootReference loot = new IrisLootReference();
|
||||
@Desc("Profile-driven 3D cave configuration")
|
||||
private CaveProfile caveProfile = new CaveProfile();
|
||||
@MinNumber(1)
|
||||
@MaxNumber(512)
|
||||
@Desc("The rarity of this biome (integer)")
|
||||
@@ -170,13 +157,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;
|
||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
||||
@Desc("Objects define what schematics (iob files) iris will place in this biome")
|
||||
private KList<IrisObjectPlacement> objects = new KList<>();
|
||||
@@ -185,52 +165,13 @@ 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());
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Multiplier applied to the frequency of every ore deposit whose center is inside this biome. A value of 0.4 keeps 40% of ore veins while leaving non-ore deposits unchanged.")
|
||||
private double oreDepositFrequencyMultiplier = 1D;
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(16)
|
||||
@Desc("Multiplier applied to the block count of every ore deposit whose center is inside this biome. Non-ore deposits are unchanged.")
|
||||
private double oreDepositSizeMultiplier = 1D;
|
||||
@ArrayType(min = 1, type = IrisDepositVariant.class)
|
||||
@Desc("Deposit ore remap rules scoped to this biome. Each entry declares a vertical band and a source->replacement block id map. Applied before regional and dimension rules; first matching biome rule wins.")
|
||||
private KList<IrisDepositVariant> depositVariants = new KList<>();
|
||||
private transient volatile InferredType inferredType;
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private final transient EnumMap<InferredType, IrisBiome> inferredVariants = new EnumMap<>(InferredType.class);
|
||||
@Desc("Collection of ores to be generated")
|
||||
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
||||
private KList<IrisOreGenerator> ores = new KList<>();
|
||||
|
||||
public PlatformBlockState generateOres(int x, int y, int z, RNG rng, IrisData data, boolean surface) {
|
||||
return IrisBiomeOres.generateOres(this, x, y, z, rng, data, surface);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateSurfaceOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
return IrisBiomeOres.generateSurfaceOres(this, x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateUndergroundOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
return IrisBiomeOres.generateUndergroundOres(this, x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public boolean hasSurfaceOres() {
|
||||
return IrisBiomeOres.hasSurfaceOres(this);
|
||||
}
|
||||
|
||||
public boolean hasUndergroundOres() {
|
||||
return IrisBiomeOres.hasUndergroundOres(this);
|
||||
}
|
||||
|
||||
public synchronized IrisBiome setInferredType(InferredType inferredType) {
|
||||
this.inferredType = inferredType;
|
||||
@@ -274,34 +215,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
return variant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hand written override of the Lombok setter. It must stay here because it invalidates the ore
|
||||
* caches that {@link IrisBiomeOres} reads.
|
||||
*/
|
||||
public void setOres(KList<IrisOreGenerator> ores) {
|
||||
this.ores = ores == null ? new KList<>() : ores;
|
||||
surfaceOreCache.reset();
|
||||
undergroundOreCache.reset();
|
||||
surfaceOreBoundsCache.reset();
|
||||
undergroundOreBoundsCache.reset();
|
||||
}
|
||||
|
||||
public KList<IrisOreGenerator> getSurfaceOreGenerators() {
|
||||
return IrisBiomeOres.getSurfaceOreGenerators(this);
|
||||
}
|
||||
|
||||
public KList<IrisOreGenerator> getUndergroundOreGenerators() {
|
||||
return IrisBiomeOres.getUndergroundOreGenerators(this);
|
||||
}
|
||||
|
||||
public IrisOreGeneratorBounds getSurfaceOreGeneratorBounds() {
|
||||
return IrisBiomeOres.getSurfaceOreGeneratorBounds(this);
|
||||
}
|
||||
|
||||
public IrisOreGeneratorBounds getUndergroundOreGeneratorBounds() {
|
||||
return IrisBiomeOres.getUndergroundOreGeneratorBounds(this);
|
||||
}
|
||||
|
||||
public Biome getDerivative() {
|
||||
Biome cached = derivativeResolved.getIfPresent();
|
||||
|
||||
@@ -367,19 +280,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;
|
||||
@@ -33,10 +31,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.terrain.deposit.IrisDepositVariant;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
||||
import art.arcane.iris.engine.object.value.IrisRange;
|
||||
import art.arcane.iris.engine.object.world.IrisEnvironment;
|
||||
import art.arcane.iris.engine.object.world.IrisWorldBoundary;
|
||||
@@ -47,7 +41,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;
|
||||
@@ -86,7 +79,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;
|
||||
@@ -112,11 +104,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<>();
|
||||
private final transient AtomicCache<KList<IrisOreGenerator>> surfaceOreCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<IrisOreGenerator>> undergroundOreCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<IrisOreGeneratorBounds> surfaceOreBoundsCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<IrisOreGeneratorBounds> undergroundOreBoundsCache = new AtomicCache<>();
|
||||
@MinNumber(2)
|
||||
@Required
|
||||
@Desc("The human readable name of this dimension")
|
||||
@@ -175,15 +162,6 @@ public class IrisDimension extends IrisRegistrant {
|
||||
private boolean debugSmartBore = false;
|
||||
@Desc("Generate decorations or not")
|
||||
private boolean decorate = true;
|
||||
@Desc("When true, every ore block the generator would place (terrain ores, deposits, ores inside objects) is replaced with its base material such as stone, deepslate or netherrack, so drop-control plugins like HiddenOre can manage ore rewards themselves")
|
||||
private boolean hideOresForHiddenOre = false;
|
||||
@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)
|
||||
@@ -268,15 +246,9 @@ public class IrisDimension extends IrisRegistrant {
|
||||
private boolean useMantle = true;
|
||||
@Desc("Prevent Leaf decay as if placed in creative mode")
|
||||
private boolean preventLeafDecay = false;
|
||||
@ArrayType(min = 1, type = IrisDepositVariant.class)
|
||||
@Desc("Dimension-wide deposit ore remap rules. Each entry declares a vertical band and a source->replacement block id map. Applied after biome and region rules; first matching dimension rule wins.")
|
||||
private KList<IrisDepositVariant> depositVariants = new KList<>();
|
||||
@ArrayType(min = 1, type = IrisShapedGeneratorStyle.class)
|
||||
@Desc("Overlay additional noise on top of the interoplated terrain.")
|
||||
private KList<IrisShapedGeneratorStyle> overlayNoise = new KList<>();
|
||||
@Desc("Collection of ores to be generated")
|
||||
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
||||
private KList<IrisOreGenerator> ores = new KList<>();
|
||||
@Desc("Dimension-wide Iris structure placements, independent of biome/region placements")
|
||||
@ArrayType(type = IrisStructurePlacement.class, min = 1)
|
||||
private KList<IrisStructurePlacement> structures = new KList<>();
|
||||
@@ -302,122 +274,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 PlatformBlockState generateOres(int x, int y, int z, RNG rng, IrisData data, boolean surface) {
|
||||
KList<IrisOreGenerator> localOres = surface ? getSurfaceOres() : getUndergroundOres();
|
||||
return generateOres(localOres, x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateSurfaceOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
return generateOres(getSurfaceOres(), x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateUndergroundOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
return generateOres(getUndergroundOres(), x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public boolean hasSurfaceOres() {
|
||||
return !getSurfaceOres().isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasUndergroundOres() {
|
||||
return !getUndergroundOres().isEmpty();
|
||||
}
|
||||
|
||||
private PlatformBlockState generateOres(KList<IrisOreGenerator> localOres, int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (localOres.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int oreCount = localOres.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = localOres.get(oreIndex);
|
||||
PlatformBlockState ore = oreGenerator.generate(x, y, z, rng, data);
|
||||
if (ore != null) {
|
||||
return ore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setOres(KList<IrisOreGenerator> ores) {
|
||||
this.ores = ores == null ? new KList<>() : ores;
|
||||
surfaceOreCache.reset();
|
||||
undergroundOreCache.reset();
|
||||
surfaceOreBoundsCache.reset();
|
||||
undergroundOreBoundsCache.reset();
|
||||
}
|
||||
|
||||
public KList<IrisOreGenerator> getSurfaceOreGenerators() {
|
||||
return getOres(true);
|
||||
}
|
||||
|
||||
public KList<IrisOreGenerator> getUndergroundOreGenerators() {
|
||||
return getOres(false);
|
||||
}
|
||||
|
||||
public IrisOreGeneratorBounds getSurfaceOreGeneratorBounds() {
|
||||
return surfaceOreBoundsCache.aquire(() -> IrisOreGeneratorBounds.of(getSurfaceOres()));
|
||||
}
|
||||
|
||||
public IrisOreGeneratorBounds getUndergroundOreGeneratorBounds() {
|
||||
return undergroundOreBoundsCache.aquire(() -> IrisOreGeneratorBounds.of(getUndergroundOres()));
|
||||
}
|
||||
|
||||
private KList<IrisOreGenerator> getSurfaceOres() {
|
||||
return getOres(true);
|
||||
}
|
||||
|
||||
private KList<IrisOreGenerator> getUndergroundOres() {
|
||||
return getOres(false);
|
||||
}
|
||||
|
||||
private KList<IrisOreGenerator> getOres(boolean surface) {
|
||||
AtomicCache<KList<IrisOreGenerator>> oreCache = surface ? surfaceOreCache : undergroundOreCache;
|
||||
return oreCache.aquire(() -> {
|
||||
KList<IrisOreGenerator> filtered = new KList<>();
|
||||
KList<IrisOreGenerator> localOres = ores;
|
||||
int oreCount = localOres.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = localOres.get(oreIndex);
|
||||
if (oreGenerator.isGenerateSurface() == surface) {
|
||||
filtered.add(oreGenerator);
|
||||
}
|
||||
}
|
||||
|
||||
return filtered;
|
||||
});
|
||||
}
|
||||
|
||||
public int getFluidHeight() {
|
||||
return fluidHeight - (int) dimensionHeight.getMin();
|
||||
}
|
||||
@@ -539,17 +395,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)) {
|
||||
@@ -569,20 +417,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;
|
||||
@@ -26,16 +25,12 @@ import art.arcane.iris.engine.object.loot.IrisLootReference;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.engine.object.procedural.IrisProceduralObjects;
|
||||
import art.arcane.iris.engine.object.structure.IrisStructurePlacement;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisDepositVariant;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
||||
import art.arcane.iris.engine.object.value.IRare;
|
||||
import art.arcane.iris.engine.object.world.biome.InferredType;
|
||||
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;
|
||||
@@ -77,10 +72,6 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
||||
private final transient AtomicCache<KList<IrisBiome>> realShoreBiomes = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<IrisBiome>> realCaveBiomes = new AtomicCache<>();
|
||||
private final transient AtomicCache<Color> cacheColor = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<IrisOreGenerator>> surfaceOreCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<IrisOreGenerator>> undergroundOreCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<IrisOreGeneratorBounds> surfaceOreBoundsCache = new AtomicCache<>();
|
||||
private final transient AtomicCache<IrisOreGeneratorBounds> undergroundOreBoundsCache = new AtomicCache<>();
|
||||
@MinNumber(2)
|
||||
@Required
|
||||
@Desc("The name of the region")
|
||||
@@ -130,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)
|
||||
@@ -149,100 +138,8 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@Desc("A list of root-level cave biomes in this region, used for carved cave interiors. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> caveBiomes = new KList<>();
|
||||
@ArrayType(min = 1, type = IrisDepositVariant.class)
|
||||
@Desc("Deposit ore remap rules scoped to this region. Each entry declares a vertical band and a source->replacement block id map. Applied after biome rules but before dimension rules; first matching region rule wins.")
|
||||
private KList<IrisDepositVariant> depositVariants = new KList<>();
|
||||
@Desc("A color for visualizing this region with a color. I.e. #F13AF5. This will show up on the map.")
|
||||
private String color = null;
|
||||
@Desc("Collection of ores to be generated")
|
||||
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
||||
private KList<IrisOreGenerator> ores = new KList<>();
|
||||
|
||||
public PlatformBlockState generateOres(int x, int y, int z, RNG rng, IrisData data, boolean surface) {
|
||||
KList<IrisOreGenerator> localOres = surface ? getSurfaceOres() : getUndergroundOres();
|
||||
return generateOres(localOres, x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateSurfaceOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
return generateOres(getSurfaceOres(), x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateUndergroundOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
return generateOres(getUndergroundOres(), x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public boolean hasSurfaceOres() {
|
||||
return !getSurfaceOres().isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasUndergroundOres() {
|
||||
return !getUndergroundOres().isEmpty();
|
||||
}
|
||||
|
||||
private PlatformBlockState generateOres(KList<IrisOreGenerator> localOres, int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (localOres.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int oreCount = localOres.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = localOres.get(oreIndex);
|
||||
PlatformBlockState ore = oreGenerator.generate(x, y, z, rng, data);
|
||||
if (ore != null) {
|
||||
return ore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setOres(KList<IrisOreGenerator> ores) {
|
||||
this.ores = ores == null ? new KList<>() : ores;
|
||||
surfaceOreCache.reset();
|
||||
undergroundOreCache.reset();
|
||||
surfaceOreBoundsCache.reset();
|
||||
undergroundOreBoundsCache.reset();
|
||||
}
|
||||
|
||||
public KList<IrisOreGenerator> getSurfaceOreGenerators() {
|
||||
return getOres(true);
|
||||
}
|
||||
|
||||
public KList<IrisOreGenerator> getUndergroundOreGenerators() {
|
||||
return getOres(false);
|
||||
}
|
||||
|
||||
public IrisOreGeneratorBounds getSurfaceOreGeneratorBounds() {
|
||||
return surfaceOreBoundsCache.aquire(() -> IrisOreGeneratorBounds.of(getSurfaceOres()));
|
||||
}
|
||||
|
||||
public IrisOreGeneratorBounds getUndergroundOreGeneratorBounds() {
|
||||
return undergroundOreBoundsCache.aquire(() -> IrisOreGeneratorBounds.of(getUndergroundOres()));
|
||||
}
|
||||
|
||||
private KList<IrisOreGenerator> getSurfaceOres() {
|
||||
return getOres(true);
|
||||
}
|
||||
|
||||
private KList<IrisOreGenerator> getUndergroundOres() {
|
||||
return getOres(false);
|
||||
}
|
||||
|
||||
private KList<IrisOreGenerator> getOres(boolean surface) {
|
||||
AtomicCache<KList<IrisOreGenerator>> oreCache = surface ? surfaceOreCache : undergroundOreCache;
|
||||
return oreCache.aquire(() -> {
|
||||
KList<IrisOreGenerator> filtered = new KList<>();
|
||||
KList<IrisOreGenerator> localOres = ores;
|
||||
int oreCount = localOres.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = localOres.get(oreIndex);
|
||||
if (oreGenerator.isGenerateSurface() == surface) {
|
||||
filtered.add(oreGenerator);
|
||||
}
|
||||
}
|
||||
|
||||
return filtered;
|
||||
});
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
@@ -315,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());
|
||||
}
|
||||
@@ -412,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());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user