mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-03 11:41:37 +00:00
Floating settings as module-owned IrisApi types: FloatingChildBiome and its enums; ResolvedFloatingChild holds the noise and object resolution
This commit is contained in:
1 parent
f7d11e5cf0
commit
feaa1e88c4
14 files changed
+635
-316
No files matched your search
+2
-2
@@ -16,9 +16,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package art.arcane.iris.engine.object.terrain.floating;
|
package art.arcane.iris.builtin.floating;
|
||||||
|
|
||||||
import art.arcane.iris.engine.object.annotations.Desc;
|
import com.volmit.config.Desc;
|
||||||
|
|
||||||
@Desc("Controls how floating-child island underside blocks choose their palette.")
|
@Desc("Controls how floating-child island underside blocks choose their palette.")
|
||||||
public enum FloatingBottomPaletteMode {
|
public enum FloatingBottomPaletteMode {
|
||||||
+216
-196
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
* Iris is a World Generator for Minecraft Servers
|
||||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,148 +16,44 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package art.arcane.iris.engine.object.terrain.floating;
|
package art.arcane.iris.builtin.floating;
|
||||||
|
|
||||||
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
|
|
||||||
import art.arcane.iris.engine.object.noise.IrisGeneratorStyle;
|
|
||||||
import art.arcane.iris.engine.object.noise.NoiseStyle;
|
|
||||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||||
import art.arcane.iris.engine.object.prefab.IrisObjectScale;
|
|
||||||
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
||||||
import art.arcane.iris.engine.object.terrain.carving.IrisCaveProfileSampler;
|
import com.volmit.config.Desc;
|
||||||
import art.arcane.iris.engine.object.value.IRare;
|
import com.volmit.config.MaxNumber;
|
||||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
import com.volmit.config.MinItems;
|
||||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
import com.volmit.config.MinNumber;
|
||||||
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingEntry;
|
import com.volmit.config.Ref;
|
||||||
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
|
import com.volmit.config.Reference;
|
||||||
import art.arcane.iris.core.loader.IrisData;
|
import com.volmit.config.Snippet;
|
||||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
import com.volmit.noise.NoiseStyle;
|
||||||
import art.arcane.iris.engine.framework.Engine;
|
|
||||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
|
||||||
import art.arcane.iris.engine.object.annotations.Desc;
|
|
||||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
|
||||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
|
||||||
import art.arcane.iris.engine.object.annotations.RegistryListBlockType;
|
|
||||||
import art.arcane.iris.engine.object.annotations.RegistryListResource;
|
|
||||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
|
||||||
import art.arcane.iris.util.project.noise.CNG;
|
|
||||||
import art.arcane.volmlib.util.collection.KList;
|
|
||||||
import art.arcane.volmlib.util.math.RNG;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A floating island above a biome's terrain, an entry of the biome's {@code floatingChildBiomes}: where its footprint
|
||||||
|
* is, how high it floats, how its top, underside and walls are shaped, and which objects, decorators and water it
|
||||||
|
* gets. Noise and options are IrisApi types; the object placements and palette layers the island hosts are
|
||||||
|
* Iris's own classes, which the host describes itself, so this class leaves the pack module jar only when those
|
||||||
|
* become settings of modules.
|
||||||
|
*/
|
||||||
@Snippet("floating-child-biome")
|
@Snippet("floating-child-biome")
|
||||||
@Accessors(chain = true)
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
@Desc("Declares a floating biome layer above this biome's terrain. A 2D footprint noise decides which columns are part of the island (threshold + style control blankets, swirls, scattered blobs). The top profile is driven by the target biome's own terrain generators (so a mountains biome produces real peaks, desert produces real dunes). The bottom tail hanging below is a separately configurable noise (pick VASCULAR for drippy roots, FRACTAL_RM_SIMPLEX for crystalline spikes, PERLIN for smooth rounded bowls).")
|
@Desc("Declares a floating biome layer above this biome's terrain. A 2D footprint noise decides which columns are part of the island (threshold + style control blankets, swirls, scattered blobs). The top profile is driven by the target biome's own terrain generators (so a mountains biome produces real peaks, desert produces real dunes). The bottom tail hanging below is a separately configurable noise (pick VASCULAR for drippy roots, FRACTAL_RM_SIMPLEX for crystalline spikes, PERLIN for smooth rounded bowls).")
|
||||||
@Data
|
public final class FloatingChildBiome {
|
||||||
public class IrisFloatingChildBiomes implements IRare {
|
public static final int DEFAULT_EDGE_TAPER_WIDTH = 10;
|
||||||
private final transient AtomicCache<IrisBiome> resolvedBiome = new AtomicCache<>();
|
public static final double DEFAULT_EDGE_TAPER_EXPONENT = 1.0D;
|
||||||
private final transient AtomicCache<CNG> footprintCache = new AtomicCache<>();
|
private static final NoiseStyle DEFAULT_BOTTOM_STYLE = NoiseStyle.of("SIMPLEX");
|
||||||
private final transient AtomicCache<FloatingIslandEdgeProfile> edgeTaperProfileCache = new AtomicCache<>();
|
private static final NoiseStyle DEFAULT_TOP_SHAPE_STYLE = NoiseStyle.of("SIMPLEX");
|
||||||
private final transient AtomicCache<CNG> pickerCache = new AtomicCache<>();
|
private static final NoiseStyle DEFAULT_ALTITUDE_STYLE = NoiseStyle.of("SIMPLEX");
|
||||||
private final transient AtomicCache<CNG> altitudeCache = new AtomicCache<>();
|
private static final NoiseStyle DEFAULT_PICKER_STYLE = NoiseStyle.of("SIMPLEX");
|
||||||
private final transient AtomicCache<CNG> topShapeCache = new AtomicCache<>();
|
private static final NoiseStyle DEFAULT_EDGE_TAPER_VARIATION_STYLE = NoiseStyle.of("SIMPLEX").withZoom(0.18D);
|
||||||
private final transient AtomicCache<CNG> bottomCache = new AtomicCache<>();
|
private static final NoiseStyle DEFAULT_FOOTPRINT_STYLE = NoiseStyle.of("SIMPLEX");
|
||||||
private final transient AtomicCache<CNG> wallWarpCache = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<CNG> carveCache = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<IrisCaveProfileSampler> carvingProfileSamplerCache = new AtomicCache<>(true);
|
|
||||||
private final transient AtomicCache<IrisObjectScale> shrinkScaleCache = new AtomicCache<>();
|
|
||||||
|
|
||||||
public CNG getFootprintCng(long baseSeed, IrisData data) {
|
@Ref(Reference.PACK_BIOME)
|
||||||
return footprintCache.aquire(() -> getFootprintStyle().create(new RNG(baseSeed ^ 0xF007B17DL), data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public FloatingIslandEdgeProfile getEdgeTaperProfile(long baseSeed, IrisData data) {
|
|
||||||
return edgeTaperProfileCache.aquire(() -> {
|
|
||||||
int width = FloatingIslandEdgeProfile.clampWidth(getEdgeTaperWidth());
|
|
||||||
double amplitude = FloatingIslandEdgeProfile.clampVariationAmplitude(
|
|
||||||
getEdgeTaperVariationAmplitude(), width);
|
|
||||||
IrisGeneratorStyle style = getEdgeTaperVariationStyle();
|
|
||||||
CNG variation = amplitude > 0.0D && style != null
|
|
||||||
? style.create(new RNG(baseSeed ^ 0xED6E7A9E5L), data)
|
|
||||||
: null;
|
|
||||||
return new FloatingIslandEdgeProfile(width, getEdgeTaperExponent(), amplitude, variation);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNG getPickerCng(long baseSeed, IrisData data) {
|
|
||||||
return pickerCache.aquire(() -> getPickerStyle().create(new RNG(baseSeed ^ 0x91C4E72DL), data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNG getAltitudeCng(long baseSeed, IrisData data) {
|
|
||||||
return altitudeCache.aquire(() -> getAltitudeStyle().create(new RNG(baseSeed ^ 0xA17DEBBL), data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNG getTopShapeCng(long baseSeed, IrisData data) {
|
|
||||||
return topShapeCache.aquire(() -> getTopShapeStyle().create(new RNG(baseSeed ^ 0x70970601DEFL), data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNG getBottomCng(long baseSeed, IrisData data) {
|
|
||||||
return bottomCache.aquire(() -> getBottomStyle().create(new RNG(baseSeed ^ 0xB0770075CAFEL), data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNG getWallWarpCng(long baseSeed, IrisData data) {
|
|
||||||
IrisGeneratorStyle style = getWallWarpStyle();
|
|
||||||
if (style == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return wallWarpCache.aquire(() -> style.create(new RNG(baseSeed ^ 0xA117BA17E0FL), data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNG getCarveCng(long baseSeed, IrisData data) {
|
|
||||||
IrisGeneratorStyle style = getCarveStyle();
|
|
||||||
if (style == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return carveCache.aquire(() -> style.create(new RNG(baseSeed ^ 0xCA5EC1EE5EL), data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public IrisCaveProfileSampler getCarvingProfileSampler(Engine engine, IrisData data) {
|
|
||||||
if (!hasCarvingReference()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return carvingProfileSamplerCache.aquire(() -> {
|
|
||||||
IrisBiome resolved = resolveCarvingBiome(carving, engine, data);
|
|
||||||
if (resolved == null || resolved.getCaveProfile() == null || !resolved.getCaveProfile().enabled()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new IrisCaveProfileSampler(engine, resolved.getCaveProfile());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasCarvingReference() {
|
|
||||||
return carving != null && !carving.isBlank();
|
|
||||||
}
|
|
||||||
|
|
||||||
static IrisBiome resolveCarvingBiome(String carving, Engine engine, IrisData data) {
|
|
||||||
if (carving == null || carving.isBlank() || engine == null || data == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisDimension dimension = engine.getDimension();
|
|
||||||
if (dimension != null && dimension.getCarvingEntryIndex() != null) {
|
|
||||||
IrisDimensionCarvingEntry entry = dimension.getCarvingEntryIndex().get(carving);
|
|
||||||
if (entry != null) {
|
|
||||||
return IrisDimensionCarvingResolver.resolveEntryBiome(engine, entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.getBiomeLoader() == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return data.getBiomeLoader().load(carving);
|
|
||||||
}
|
|
||||||
|
|
||||||
@RegistryListResource(IrisBiome.class)
|
|
||||||
@Desc("The target biome whose visual design (layers, palette, decorators, surface objects, derivative, and — when topShapeMode=BIOME — generator profile) drives the floating island. Leave empty to reuse the parent biome (self).")
|
@Desc("The target biome whose visual design (layers, palette, decorators, surface objects, derivative, and — when topShapeMode=BIOME — generator profile) drives the floating island. Leave empty to reuse the parent biome (self).")
|
||||||
private String biome = "";
|
private String biome = "";
|
||||||
|
|
||||||
@@ -167,7 +63,7 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
private int rarity = 1;
|
private int rarity = 1;
|
||||||
|
|
||||||
@Desc("2D noise that decides which columns are part of this island. Set feature size via the style's own zoom field (e.g. {\"style\":\"CELLULAR\",\"zoom\":0.3} for ~30-block shards, {\"style\":\"SIMPLEX\",\"zoom\":1.0} for ~100-block blobs). Pick SIMPLEX for smooth blobs, CELLULAR for angular shards, VASCULAR for vein/branch strips, FRACTAL_FBM_SIMPLEX for large irregular blanket regions. Fracture (domain warp) this to get swirly silhouettes.")
|
@Desc("2D noise that decides which columns are part of this island. Set feature size via the style's own zoom field (e.g. {\"style\":\"CELLULAR\",\"zoom\":0.3} for ~30-block shards, {\"style\":\"SIMPLEX\",\"zoom\":1.0} for ~100-block blobs). Pick SIMPLEX for smooth blobs, CELLULAR for angular shards, VASCULAR for vein/branch strips, FRACTAL_FBM_SIMPLEX for large irregular blanket regions. Fracture (domain warp) this to get swirly silhouettes.")
|
||||||
private IrisGeneratorStyle footprintStyle = NoiseStyle.SIMPLEX.style();
|
private NoiseStyle footprintStyle = DEFAULT_FOOTPRINT_STYLE;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(1)
|
@MaxNumber(1)
|
||||||
@@ -177,15 +73,15 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
@MinNumber(2)
|
@MinNumber(2)
|
||||||
@MaxNumber(32)
|
@MaxNumber(32)
|
||||||
@Desc("Width in blocks of the rounded transition from the floating island contour to its full thickness. Smaller values make a tighter edge; larger values make a broader rounded underside.")
|
@Desc("Width in blocks of the rounded transition from the floating island contour to its full thickness. Smaller values make a tighter edge; larger values make a broader rounded underside.")
|
||||||
private int edgeTaperWidth = FloatingIslandEdgeProfile.DEFAULT_WIDTH;
|
private int edgeTaperWidth = DEFAULT_EDGE_TAPER_WIDTH;
|
||||||
|
|
||||||
@MinNumber(0.25)
|
@MinNumber(0.25)
|
||||||
@MaxNumber(4)
|
@MaxNumber(4)
|
||||||
@Desc("Shape exponent for the rounded edge. Values below 1 fill into a softer, fuller curve; values above 1 keep the rim thinner before rising into the island interior.")
|
@Desc("Shape exponent for the rounded edge. Values below 1 fill into a softer, fuller curve; values above 1 keep the rim thinner before rising into the island interior.")
|
||||||
private double edgeTaperExponent = FloatingIslandEdgeProfile.DEFAULT_EXPONENT;
|
private double edgeTaperExponent = DEFAULT_EDGE_TAPER_EXPONENT;
|
||||||
|
|
||||||
@Desc("Broad 2D noise that organically varies the rounded edge without changing the island footprint. Low-frequency SIMPLEX or PERLIN styles give coherent natural contours; high-frequency or cellular styles can look speckled.")
|
@Desc("Broad 2D noise that organically varies the rounded edge without changing the island footprint. Low-frequency SIMPLEX or PERLIN styles give coherent natural contours; high-frequency or cellular styles can look speckled.")
|
||||||
private IrisGeneratorStyle edgeTaperVariationStyle = NoiseStyle.SIMPLEX.style().zoomed(0.18D);
|
private NoiseStyle edgeTaperVariationStyle = DEFAULT_EDGE_TAPER_VARIATION_STYLE;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(8)
|
@MaxNumber(8)
|
||||||
@@ -193,10 +89,10 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
private double edgeTaperVariationAmplitude = 0.0D;
|
private double edgeTaperVariationAmplitude = 0.0D;
|
||||||
|
|
||||||
@Desc("Picker noise used when multiple floating child entries exist. Samples once per column to deterministically choose which entry's footprint is tested there. Use a large style zoom (e.g. zoom: 4 for ~400-block regions) so each entry owns broad coherent areas.")
|
@Desc("Picker noise used when multiple floating child entries exist. Samples once per column to deterministically choose which entry's footprint is tested there. Use a large style zoom (e.g. zoom: 4 for ~400-block regions) so each entry owns broad coherent areas.")
|
||||||
private IrisGeneratorStyle pickerStyle = NoiseStyle.SIMPLEX.style();
|
private NoiseStyle pickerStyle = DEFAULT_PICKER_STYLE;
|
||||||
|
|
||||||
@Desc("Altitude noise — varies the base platform Y across one island so it isn't a flat plane. Use a large style zoom (e.g. zoom: 2 for ~200-block altitude patches) so an island sits at roughly one altitude.")
|
@Desc("Altitude noise — varies the base platform Y across one island so it isn't a flat plane. Use a large style zoom (e.g. zoom: 2 for ~200-block altitude patches) so an island sits at roughly one altitude.")
|
||||||
private IrisGeneratorStyle altitudeStyle = NoiseStyle.SIMPLEX.style();
|
private NoiseStyle altitudeStyle = DEFAULT_ALTITUDE_STYLE;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(2032)
|
@MaxNumber(2032)
|
||||||
@@ -223,7 +119,7 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
private int maxTopHeight = 40;
|
private int maxTopHeight = 40;
|
||||||
|
|
||||||
@Desc("Used only when topShapeMode=NOISE. 2D noise driving the top heightmap. Set feature scale via the style's zoom field (small zoom = rugged peaks, large zoom = broad rolling shapes).")
|
@Desc("Used only when topShapeMode=NOISE. 2D noise driving the top heightmap. Set feature scale via the style's zoom field (small zoom = rugged peaks, large zoom = broad rolling shapes).")
|
||||||
private IrisGeneratorStyle topShapeStyle = NoiseStyle.SIMPLEX.style();
|
private NoiseStyle topShapeStyle = DEFAULT_TOP_SHAPE_STYLE;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(1)
|
@MaxNumber(1)
|
||||||
@@ -231,7 +127,7 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
private double topShapeAmp = 1.0;
|
private double topShapeAmp = 1.0;
|
||||||
|
|
||||||
@Desc("2D noise driving the bottom tail hanging below the island base. VASCULAR = drippy organic roots. FRACTAL_RM_SIMPLEX = crystalline spikes. CELLULAR = jagged chunks. PERLIN = smooth rounded bowl. SIMPLEX = gentle lobes. Set feature scale via the style's zoom field.")
|
@Desc("2D noise driving the bottom tail hanging below the island base. VASCULAR = drippy organic roots. FRACTAL_RM_SIMPLEX = crystalline spikes. CELLULAR = jagged chunks. PERLIN = smooth rounded bowl. SIMPLEX = gentle lobes. Set feature scale via the style's zoom field.")
|
||||||
private IrisGeneratorStyle bottomStyle = NoiseStyle.SIMPLEX.style();
|
private NoiseStyle bottomStyle = DEFAULT_BOTTOM_STYLE;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(512)
|
@MaxNumber(512)
|
||||||
@@ -251,9 +147,9 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
@Desc("Controls the material palette near the island underside. DEPTH keeps the old top-down depth behavior. MIRROR_TOP uses the target biome's shallow/top palette from the underside upward. CUSTOM uses bottomPalette near the underside while keeping the target biome palette near the top.")
|
@Desc("Controls the material palette near the island underside. DEPTH keeps the old top-down depth behavior. MIRROR_TOP uses the target biome's shallow/top palette from the underside upward. CUSTOM uses bottomPalette near the underside while keeping the target biome palette near the top.")
|
||||||
private FloatingBottomPaletteMode bottomPaletteMode = FloatingBottomPaletteMode.DEPTH;
|
private FloatingBottomPaletteMode bottomPaletteMode = FloatingBottomPaletteMode.DEPTH;
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
@MinItems(1)
|
||||||
@Desc("Custom palette layers used near the underside when bottomPaletteMode=CUSTOM. The layer format is the same as normal biome layers.")
|
@Desc("Custom palette layers used near the underside when bottomPaletteMode=CUSTOM. The layer format is the same as normal biome layers.")
|
||||||
private KList<IrisBiomePaletteLayer> bottomPalette = new KList<>();
|
private List<IrisBiomePaletteLayer> bottomPalette = List.of();
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(512)
|
@MaxNumber(512)
|
||||||
@@ -261,7 +157,7 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
private int maxThickness = 96;
|
private int maxThickness = 96;
|
||||||
|
|
||||||
@Desc("Optional 3D noise that shifts the footprint's XZ sample position per Y layer — naturalizes the walls so they stop looking like a straight extrusion of the 2D footprint. Leave null to disable and keep straight vertical walls. Good defaults: {\"style\":\"SIMPLEX\",\"zoom\":0.25} for gentle undulation, {\"style\":\"FRACTAL_FBM_SIMPLEX\",\"zoom\":0.4} for craggier walls.")
|
@Desc("Optional 3D noise that shifts the footprint's XZ sample position per Y layer — naturalizes the walls so they stop looking like a straight extrusion of the 2D footprint. Leave null to disable and keep straight vertical walls. Good defaults: {\"style\":\"SIMPLEX\",\"zoom\":0.25} for gentle undulation, {\"style\":\"FRACTAL_FBM_SIMPLEX\",\"zoom\":0.4} for craggier walls.")
|
||||||
private IrisGeneratorStyle wallWarpStyle = null;
|
private NoiseStyle wallWarpStyle;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(64)
|
@MaxNumber(64)
|
||||||
@@ -269,7 +165,7 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
private double wallWarpAmplitude = 6.0;
|
private double wallWarpAmplitude = 6.0;
|
||||||
|
|
||||||
@Desc("Optional 3D noise that swiss-cheeses the island interior by marking individual blocks as air when the noise exceeds carveThreshold. Leave null to keep the island solid. Good defaults: {\"style\":\"CELLULAR\",\"zoom\":0.3} for bubble pockets, {\"style\":\"VASCULAR\",\"zoom\":0.25} for wormy tunnels.")
|
@Desc("Optional 3D noise that swiss-cheeses the island interior by marking individual blocks as air when the noise exceeds carveThreshold. Leave null to keep the island solid. Good defaults: {\"style\":\"CELLULAR\",\"zoom\":0.3} for bubble pockets, {\"style\":\"VASCULAR\",\"zoom\":0.25} for wormy tunnels.")
|
||||||
private IrisGeneratorStyle carveStyle = null;
|
private NoiseStyle carveStyle;
|
||||||
|
|
||||||
@Desc("Optional carving biome key or dimension carving entry id whose caveProfile drives floating-island internal air pockets. Dimension carving ids resolve first; biome keys such as carving/mushroom resolve second. When set, this overrides carveStyle while carveThreshold remains a final tuning bias.")
|
@Desc("Optional carving biome key or dimension carving entry id whose caveProfile drives floating-island internal air pockets. Dimension carving ids resolve first; biome keys such as carving/mushroom resolve second. When set, this overrides carveStyle while carveThreshold remains a final tuning bias.")
|
||||||
private String carving = "";
|
private String carving = "";
|
||||||
@@ -283,7 +179,7 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
private Integer localFluidHeight = null;
|
private Integer localFluidHeight = null;
|
||||||
|
|
||||||
@Desc("Block used for the internal water pool when localFluidHeight is positive.")
|
@Desc("Block used for the internal water pool when localFluidHeight is positive.")
|
||||||
@RegistryListBlockType
|
@Ref(Reference.BLOCK)
|
||||||
private String fluidBlock = "minecraft:water";
|
private String fluidBlock = "minecraft:water";
|
||||||
|
|
||||||
@Desc("When true, the target biome's decorators apply to the island's top surface.")
|
@Desc("When true, the target biome's decorators apply to the island's top surface.")
|
||||||
@@ -297,13 +193,13 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
@Desc("Uniform shrink factor applied to every object placed on this floating island (inherited, extra, and free-floating). 1.0 = native size, 0.5 = half size, 0.25 = quarter. Useful for making small floating biomes feel believable.")
|
@Desc("Uniform shrink factor applied to every object placed on this floating island (inherited, extra, and free-floating). 1.0 = native size, 0.5 = half size, 0.25 = quarter. Useful for making small floating biomes feel believable.")
|
||||||
private double objectShrinkFactor = 1.0;
|
private double objectShrinkFactor = 1.0;
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
@MinItems(1)
|
||||||
@Desc("Additional object placements anchored to the island top.")
|
@Desc("Additional object placements anchored to the island top.")
|
||||||
private KList<IrisObjectPlacement> extraObjects = new KList<>();
|
private List<IrisObjectPlacement> extraObjects = List.of();
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
@MinItems(1)
|
||||||
@Desc("Additional object placements that float freely in air, independent of the island. Forced to ObjectPlaceMode.FLOATING.")
|
@Desc("Additional object placements that float freely in air, independent of the island. Forced to ObjectPlaceMode.FLOATING.")
|
||||||
private KList<IrisObjectPlacement> floatingObjects = new KList<>();
|
private List<IrisObjectPlacement> floatingObjects = List.of();
|
||||||
|
|
||||||
@Desc("Visualization color for this floating child in Iris Studio.")
|
@Desc("Visualization color for this floating child in Iris Studio.")
|
||||||
private String color = null;
|
private String color = null;
|
||||||
@@ -314,63 +210,187 @@ public class IrisFloatingChildBiomes implements IRare {
|
|||||||
@Desc("Controls how bottomObjectOverrides are combined. INHERIT_ONLY (default) = no bottom objects placed (there is no inherited bottom set). MERGE = same as REPLACE for bottom (no inherited source). REPLACE = uses bottomObjectOverrides list only.")
|
@Desc("Controls how bottomObjectOverrides are combined. INHERIT_ONLY (default) = no bottom objects placed (there is no inherited bottom set). MERGE = same as REPLACE for bottom (no inherited source). REPLACE = uses bottomObjectOverrides list only.")
|
||||||
private OverrideMode bottomObjectMode = OverrideMode.INHERIT_ONLY;
|
private OverrideMode bottomObjectMode = OverrideMode.INHERIT_ONLY;
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
@MinItems(1)
|
||||||
@Desc("Object placements that override or supplement the inherited surface objects on the island TOP. Behaviour depends on topObjectMode. INHERIT_ONLY = this list is ignored. MERGE = appended after inherited. REPLACE = used instead of inherited.")
|
@Desc("Object placements that override or supplement the inherited surface objects on the island TOP. Behaviour depends on topObjectMode. INHERIT_ONLY = this list is ignored. MERGE = appended after inherited. REPLACE = used instead of inherited.")
|
||||||
private KList<IrisObjectPlacement> topObjectOverrides = new KList<>();
|
private List<IrisObjectPlacement> topObjectOverrides = List.of();
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
@MinItems(1)
|
||||||
@Desc("Object placements anchored to the island BOTTOM face. Each entry is auto-inverted 180 degrees around the X axis and placed flush against the lowest solid face of the island, so objects appear to hang upside-down from the underside. WARNING: directional blocks (stairs, doors, slabs) will not render correctly when flipped — use non-directional content (logs, leaves, stone, mycelium, ice, glass) for bottom placements.")
|
@Desc("Object placements anchored to the island BOTTOM face. Each entry is auto-inverted 180 degrees around the X axis and placed flush against the lowest solid face of the island, so objects appear to hang upside-down from the underside. WARNING: directional blocks (stairs, doors, slabs) will not render correctly when flipped — use non-directional content (logs, leaves, stone, mycelium, ice, glass) for bottom placements.")
|
||||||
private KList<IrisObjectPlacement> bottomObjectOverrides = new KList<>();
|
private List<IrisObjectPlacement> bottomObjectOverrides = List.of();
|
||||||
|
|
||||||
public KList<IrisObjectPlacement> resolveTopObjects(IrisBiome target) {
|
public FloatingChildBiome() {
|
||||||
KList<IrisObjectPlacement> surfaceObjects = (inheritObjects && target != null) ? target.getSurfaceObjects() : new KList<>();
|
|
||||||
return resolveTopObjectsFromSurface(surfaceObjects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KList<IrisObjectPlacement> resolveTopObjectsFromSurface(KList<IrisObjectPlacement> surfaceObjects) {
|
public String biome() {
|
||||||
return switch (topObjectMode) {
|
return biome == null ? "" : biome;
|
||||||
case REPLACE -> new KList<>(topObjectOverrides);
|
|
||||||
case MERGE -> {
|
|
||||||
KList<IrisObjectPlacement> merged = new KList<>();
|
|
||||||
merged.addAll(surfaceObjects);
|
|
||||||
merged.addAll(topObjectOverrides);
|
|
||||||
yield merged;
|
|
||||||
}
|
|
||||||
case INHERIT_ONLY -> surfaceObjects;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public KList<IrisObjectPlacement> resolveBottomObjects(IrisBiome target) {
|
public int rarity() {
|
||||||
return switch (bottomObjectMode) {
|
return rarity;
|
||||||
case INHERIT_ONLY -> new KList<>();
|
|
||||||
case MERGE, REPLACE -> bottomObjectOverrides;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasObjectShrink() {
|
public NoiseStyle footprintStyle() {
|
||||||
return objectShrinkFactor > 0 && objectShrinkFactor < 1.0;
|
return footprintStyle == null ? DEFAULT_FOOTPRINT_STYLE : footprintStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisObjectScale getShrinkScale() {
|
public double footprintThreshold() {
|
||||||
return shrinkScaleCache.aquire(() -> {
|
return footprintThreshold;
|
||||||
IrisObjectScale s = new IrisObjectScale();
|
|
||||||
s.setSize(Math.max(0.01, Math.min(1.0, objectShrinkFactor)));
|
|
||||||
return s;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisBiome getRealBiome(IrisBiome parent, IrisData data) {
|
public int edgeTaperWidth() {
|
||||||
return resolvedBiome.aquire(() -> {
|
return edgeTaperWidth;
|
||||||
if (biome == null || biome.isBlank() || biome.equals(parent.getLoadKey())) {
|
}
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisBiome loaded = data.getBiomeLoader().load(biome);
|
public double edgeTaperExponent() {
|
||||||
if (loaded == null) {
|
return edgeTaperExponent;
|
||||||
return parent;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return loaded;
|
public NoiseStyle edgeTaperVariationStyle() {
|
||||||
});
|
return edgeTaperVariationStyle == null ? DEFAULT_EDGE_TAPER_VARIATION_STYLE : edgeTaperVariationStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double edgeTaperVariationAmplitude() {
|
||||||
|
return edgeTaperVariationAmplitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoiseStyle pickerStyle() {
|
||||||
|
return pickerStyle == null ? DEFAULT_PICKER_STYLE : pickerStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoiseStyle altitudeStyle() {
|
||||||
|
return altitudeStyle == null ? DEFAULT_ALTITUDE_STYLE : altitudeStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int minHeightAboveSurface() {
|
||||||
|
return minHeightAboveSurface;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int maxHeightAboveSurface() {
|
||||||
|
return maxHeightAboveSurface;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Empty where the pack sets none. */
|
||||||
|
public OptionalInt minAbsoluteY() {
|
||||||
|
return minAbsoluteY == null ? OptionalInt.empty() : OptionalInt.of(minAbsoluteY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Empty where the pack sets none. */
|
||||||
|
public OptionalInt maxAbsoluteY() {
|
||||||
|
return maxAbsoluteY == null ? OptionalInt.empty() : OptionalInt.of(maxAbsoluteY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TopShapeMode topShapeMode() {
|
||||||
|
return topShapeMode == null ? TopShapeMode.BIOME : topShapeMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int maxTopHeight() {
|
||||||
|
return maxTopHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoiseStyle topShapeStyle() {
|
||||||
|
return topShapeStyle == null ? DEFAULT_TOP_SHAPE_STYLE : topShapeStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double topShapeAmp() {
|
||||||
|
return topShapeAmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoiseStyle bottomStyle() {
|
||||||
|
return bottomStyle == null ? DEFAULT_BOTTOM_STYLE : bottomStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int bottomDepthMin() {
|
||||||
|
return bottomDepthMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int bottomDepthMax() {
|
||||||
|
return bottomDepthMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double bottomExponent() {
|
||||||
|
return bottomExponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatingBottomPaletteMode bottomPaletteMode() {
|
||||||
|
return bottomPaletteMode == null ? FloatingBottomPaletteMode.DEPTH : bottomPaletteMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IrisBiomePaletteLayer> bottomPalette() {
|
||||||
|
return bottomPalette == null ? List.of() : Collections.unmodifiableList(bottomPalette);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int maxThickness() {
|
||||||
|
return maxThickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Empty where the pack sets none. */
|
||||||
|
public Optional<NoiseStyle> wallWarpStyle() {
|
||||||
|
return Optional.ofNullable(wallWarpStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double wallWarpAmplitude() {
|
||||||
|
return wallWarpAmplitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Empty where the pack sets none. */
|
||||||
|
public Optional<NoiseStyle> carveStyle() {
|
||||||
|
return Optional.ofNullable(carveStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String carving() {
|
||||||
|
return carving == null ? "" : carving;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double carveThreshold() {
|
||||||
|
return carveThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Empty where the pack sets none. */
|
||||||
|
public OptionalInt localFluidHeight() {
|
||||||
|
return localFluidHeight == null ? OptionalInt.empty() : OptionalInt.of(localFluidHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String fluidBlock() {
|
||||||
|
return fluidBlock == null ? "" : fluidBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean inheritDecorators() {
|
||||||
|
return inheritDecorators;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean inheritObjects() {
|
||||||
|
return inheritObjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double objectShrinkFactor() {
|
||||||
|
return objectShrinkFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IrisObjectPlacement> extraObjects() {
|
||||||
|
return extraObjects == null ? List.of() : Collections.unmodifiableList(extraObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IrisObjectPlacement> floatingObjects() {
|
||||||
|
return floatingObjects == null ? List.of() : Collections.unmodifiableList(floatingObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String color() {
|
||||||
|
return color == null ? "" : color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OverrideMode topObjectMode() {
|
||||||
|
return topObjectMode == null ? OverrideMode.INHERIT_ONLY : topObjectMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OverrideMode bottomObjectMode() {
|
||||||
|
return bottomObjectMode == null ? OverrideMode.INHERIT_ONLY : bottomObjectMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IrisObjectPlacement> topObjectOverrides() {
|
||||||
|
return topObjectOverrides == null ? List.of() : Collections.unmodifiableList(topObjectOverrides);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IrisObjectPlacement> bottomObjectOverrides() {
|
||||||
|
return bottomObjectOverrides == null ? List.of() : Collections.unmodifiableList(bottomObjectOverrides);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -16,9 +16,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package art.arcane.iris.engine.object.terrain.floating;
|
package art.arcane.iris.builtin.floating;
|
||||||
|
|
||||||
import art.arcane.iris.engine.object.annotations.Desc;
|
import com.volmit.config.Desc;
|
||||||
|
|
||||||
@Desc("Controls how an override list is combined with the inherited object set from the target biome.")
|
@Desc("Controls how an override list is combined with the inherited object set from the target biome.")
|
||||||
public enum OverrideMode {
|
public enum OverrideMode {
|
||||||
+2
-2
@@ -16,9 +16,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package art.arcane.iris.engine.object.terrain.floating;
|
package art.arcane.iris.builtin.floating;
|
||||||
|
|
||||||
import art.arcane.iris.engine.object.annotations.Desc;
|
import com.volmit.config.Desc;
|
||||||
|
|
||||||
@Desc("How the top profile of a floating-child island is shaped.")
|
@Desc("How the top profile of a floating-child island is shaped.")
|
||||||
public enum TopShapeMode {
|
public enum TopShapeMode {
|
||||||
@@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
package art.arcane.iris.engine.mantle.components;
|
package art.arcane.iris.engine.mantle.components;
|
||||||
|
|
||||||
|
import art.arcane.iris.engine.object.terrain.floating.FloatingChildren;
|
||||||
|
import art.arcane.iris.builtin.floating.FloatingChildBiome;
|
||||||
|
import art.arcane.iris.engine.object.terrain.floating.ResolvedFloatingChild;
|
||||||
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
|
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
|
||||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||||
import art.arcane.iris.core.loader.IrisData;
|
import art.arcane.iris.core.loader.IrisData;
|
||||||
@@ -29,7 +32,6 @@ import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
|
|||||||
import art.arcane.iris.engine.object.placement.FloatingObjectFootprint;
|
import art.arcane.iris.engine.object.placement.FloatingObjectFootprint;
|
||||||
import art.arcane.iris.engine.object.placement.IObjectPlacer;
|
import art.arcane.iris.engine.object.placement.IObjectPlacer;
|
||||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||||
import art.arcane.iris.engine.object.terrain.floating.IrisFloatingChildBiomes;
|
|
||||||
import art.arcane.iris.engine.object.prefab.IrisObject;
|
import art.arcane.iris.engine.object.prefab.IrisObject;
|
||||||
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
|
import art.arcane.iris.engine.object.prefab.IrisObjectRotation;
|
||||||
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
|
import art.arcane.iris.engine.object.prefab.IrisObjectTranslate;
|
||||||
@@ -47,6 +49,7 @@ import java.io.File;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -91,10 +94,10 @@ public class FloatingObjectPlacing {
|
|||||||
// The IdentityHashMaps are lookup indices only. Iteration MUST follow the encounter
|
// The IdentityHashMaps are lookup indices only. Iteration MUST follow the encounter
|
||||||
// order of the deterministic 0..255 column scan: identity-hash order changes per JVM
|
// order of the deterministic 0..255 column scan: identity-hash order changes per JVM
|
||||||
// run, and the shared chunkRng makes placement output depend on iteration order.
|
// run, and the shared chunkRng makes placement output depend on iteration order.
|
||||||
IdentityHashMap<IrisFloatingChildBiomes, KList<Integer>> entryColumns = new IdentityHashMap<>();
|
IdentityHashMap<ResolvedFloatingChild, KList<Integer>> entryColumns = new IdentityHashMap<>();
|
||||||
IdentityHashMap<IrisFloatingChildBiomes, KList<Integer>> bottomEntryColumns = new IdentityHashMap<>();
|
IdentityHashMap<ResolvedFloatingChild, KList<Integer>> bottomEntryColumns = new IdentityHashMap<>();
|
||||||
KList<IrisFloatingChildBiomes> entryOrder = new KList<>();
|
KList<ResolvedFloatingChild> entryOrder = new KList<>();
|
||||||
KList<IrisFloatingChildBiomes> bottomEntryOrder = new KList<>();
|
KList<ResolvedFloatingChild> bottomEntryOrder = new KList<>();
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
FloatingIslandSample s = samples[i];
|
FloatingIslandSample s = samples[i];
|
||||||
if (s == null || s.entry == null) {
|
if (s == null || s.entry == null) {
|
||||||
@@ -104,7 +107,7 @@ public class FloatingObjectPlacing {
|
|||||||
entryOrder.add(e);
|
entryOrder.add(e);
|
||||||
return new KList<>();
|
return new KList<>();
|
||||||
}).add(i);
|
}).add(i);
|
||||||
IrisFloatingChildBiomes bottomEntry = s.bottomEntry();
|
ResolvedFloatingChild bottomEntry = s.bottomEntry();
|
||||||
if (bottomEntry != null) {
|
if (bottomEntry != null) {
|
||||||
bottomEntryColumns.computeIfAbsent(bottomEntry, e -> {
|
bottomEntryColumns.computeIfAbsent(bottomEntry, e -> {
|
||||||
bottomEntryOrder.add(e);
|
bottomEntryOrder.add(e);
|
||||||
@@ -113,7 +116,7 @@ public class FloatingObjectPlacing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IrisFloatingChildBiomes entry : entryOrder) {
|
for (ResolvedFloatingChild entry : entryOrder) {
|
||||||
KList<Integer> columns = entryColumns.get(entry);
|
KList<Integer> columns = entryColumns.get(entry);
|
||||||
if (columns.isEmpty()) {
|
if (columns.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -123,7 +126,7 @@ public class FloatingObjectPlacing {
|
|||||||
IrisBiome parent = sampleResolver.parent(minX + (firstKey & 15), minZ + (firstKey >> 4));
|
IrisBiome parent = sampleResolver.parent(minX + (firstKey & 15), minZ + (firstKey >> 4));
|
||||||
IrisBiome target = entry.getRealBiome(parent, data);
|
IrisBiome target = entry.getRealBiome(parent, data);
|
||||||
|
|
||||||
KList<IrisObjectPlacement> floating = entry.getFloatingObjects();
|
KList<IrisObjectPlacement> floating = new KList<>(entry.settings().floatingObjects());
|
||||||
if (floating != null && !floating.isEmpty()) {
|
if (floating != null && !floating.isEmpty()) {
|
||||||
for (IrisObjectPlacement placement : floating) {
|
for (IrisObjectPlacement placement : floating) {
|
||||||
tryPlaceFloatingChunk(writer, complex, chunkRng, data, placement, columns, minX, minZ, entry);
|
tryPlaceFloatingChunk(writer, complex, chunkRng, data, placement, columns, minX, minZ, entry);
|
||||||
@@ -131,7 +134,7 @@ public class FloatingObjectPlacing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
KList<IrisObjectPlacement> surface = target != null ? entry.resolveTopObjects(target) : null;
|
KList<IrisObjectPlacement> surface = target != null ? entry.resolveTopObjects(target) : null;
|
||||||
KList<IrisObjectPlacement> extras = entry.getExtraObjects();
|
KList<IrisObjectPlacement> extras = new KList<>(entry.settings().extraObjects());
|
||||||
boolean hasSurface = surface != null && !surface.isEmpty();
|
boolean hasSurface = surface != null && !surface.isEmpty();
|
||||||
boolean hasExtras = extras != null && !extras.isEmpty();
|
boolean hasExtras = extras != null && !extras.isEmpty();
|
||||||
KList<Integer> interior = null;
|
KList<Integer> interior = null;
|
||||||
@@ -150,7 +153,7 @@ public class FloatingObjectPlacing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IrisFloatingChildBiomes entry : bottomEntryOrder) {
|
for (ResolvedFloatingChild entry : bottomEntryOrder) {
|
||||||
KList<Integer> columns = bottomEntryColumns.get(entry);
|
KList<Integer> columns = bottomEntryColumns.get(entry);
|
||||||
if (columns.isEmpty()) {
|
if (columns.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -170,7 +173,7 @@ public class FloatingObjectPlacing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
private void tryPlaceFloatingChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, KList<Integer> columns, int minX, int minZ, IrisFloatingChildBiomes entry) {
|
private void tryPlaceFloatingChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, KList<Integer> columns, int minX, int minZ, ResolvedFloatingChild entry) {
|
||||||
if (placement == null || columns == null || columns.isEmpty()) {
|
if (placement == null || columns == null || columns.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -216,7 +219,7 @@ public class FloatingObjectPlacing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
private void tryPlaceAnchoredChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, FloatingIslandSample[] samples, IslandObjectPlacer.SampleProvider sampleProvider, KList<Integer> columns, KList<Integer> interior, int minX, int minZ, IrisFloatingChildBiomes entry) {
|
private void tryPlaceAnchoredChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, FloatingIslandSample[] samples, IslandObjectPlacer.SampleProvider sampleProvider, KList<Integer> columns, KList<Integer> interior, int minX, int minZ, ResolvedFloatingChild entry) {
|
||||||
if (placement == null || columns.isEmpty()) {
|
if (placement == null || columns.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -301,7 +304,7 @@ public class FloatingObjectPlacing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
private void tryPlaceInvertedChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, FloatingIslandSample[] samples, IslandObjectPlacer.SampleProvider sampleProvider, KList<Integer> columns, KList<Integer> interior, int minX, int minZ, IrisFloatingChildBiomes entry) {
|
private void tryPlaceInvertedChunk(MantleWriter writer, IrisComplex complex, RNG rng, IrisData data, IrisObjectPlacement placement, FloatingIslandSample[] samples, IslandObjectPlacer.SampleProvider sampleProvider, KList<Integer> columns, KList<Integer> interior, int minX, int minZ, ResolvedFloatingChild entry) {
|
||||||
if (placement == null || columns.isEmpty()) {
|
if (placement == null || columns.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -405,7 +408,7 @@ public class FloatingObjectPlacing {
|
|||||||
static boolean isFootprintFlatBottom(FloatingObjectFootprint fp, IrisObjectRotation rotation,
|
static boolean isFootprintFlatBottom(FloatingObjectFootprint fp, IrisObjectRotation rotation,
|
||||||
int pickedX, int pickedZ, int pickBottomY,
|
int pickedX, int pickedZ, int pickBottomY,
|
||||||
IslandObjectPlacer.SampleProvider samples,
|
IslandObjectPlacer.SampleProvider samples,
|
||||||
IrisFloatingChildBiomes entry, int tolerance) {
|
ResolvedFloatingChild entry, int tolerance) {
|
||||||
IrisBlockVector anchor = invertedFootprintAnchor(fp, rotation);
|
IrisBlockVector anchor = invertedFootprintAnchor(fp, rotation);
|
||||||
long[] cells = fp.footprintXZ();
|
long[] cells = fp.footprintXZ();
|
||||||
if (cells.length == 0) {
|
if (cells.length == 0) {
|
||||||
@@ -475,7 +478,7 @@ public class FloatingObjectPlacing {
|
|||||||
|
|
||||||
static boolean isFootprintFlat(FloatingObjectFootprint fp, int pickedX, int pickedZ, int pickTopY,
|
static boolean isFootprintFlat(FloatingObjectFootprint fp, int pickedX, int pickedZ, int pickTopY,
|
||||||
IslandObjectPlacer.SampleProvider samples,
|
IslandObjectPlacer.SampleProvider samples,
|
||||||
IrisFloatingChildBiomes entry, int tolerance) {
|
ResolvedFloatingChild entry, int tolerance) {
|
||||||
int tallestKx = fp.getTallestKx();
|
int tallestKx = fp.getTallestKx();
|
||||||
int tallestKz = fp.getTallestKz();
|
int tallestKz = fp.getTallestKz();
|
||||||
long[] cells = fp.footprintXZ();
|
long[] cells = fp.footprintXZ();
|
||||||
@@ -499,7 +502,7 @@ public class FloatingObjectPlacing {
|
|||||||
|
|
||||||
private static KList<Integer> interiorColumns(IslandObjectPlacer.SampleProvider samples,
|
private static KList<Integer> interiorColumns(IslandObjectPlacer.SampleProvider samples,
|
||||||
KList<Integer> columns, int minX, int minZ,
|
KList<Integer> columns, int minX, int minZ,
|
||||||
IrisFloatingChildBiomes entry,
|
ResolvedFloatingChild entry,
|
||||||
IslandObjectPlacer.AnchorFace face) {
|
IslandObjectPlacer.AnchorFace face) {
|
||||||
KList<Integer> interior = new KList<>();
|
KList<Integer> interior = new KList<>();
|
||||||
for (int key : columns) {
|
for (int key : columns) {
|
||||||
@@ -554,15 +557,15 @@ public class FloatingObjectPlacing {
|
|||||||
try {
|
try {
|
||||||
IrisData data = engine.getData();
|
IrisData data = engine.getData();
|
||||||
for (IrisBiome biome : engine.getDimension().getReachableBiomes(engine)) {
|
for (IrisBiome biome : engine.getDimension().getReachableBiomes(engine)) {
|
||||||
KList<IrisFloatingChildBiomes> entries = biome.getFloatingChildBiomes();
|
List<FloatingChildBiome> settings = biome.getFloatingChildBiomes();
|
||||||
if (entries == null || entries.isEmpty()) {
|
if (settings == null || settings.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (IrisFloatingChildBiomes entry : entries) {
|
for (ResolvedFloatingChild entry : FloatingChildren.of(engine).of(settings)) {
|
||||||
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(entry.getFloatingObjects(), data, sizeCache, warnedLargeObjects));
|
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(new KList<>(entry.settings().floatingObjects()), data, sizeCache, warnedLargeObjects));
|
||||||
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(entry.getExtraObjects(), data, sizeCache, warnedLargeObjects));
|
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(new KList<>(entry.settings().extraObjects()), data, sizeCache, warnedLargeObjects));
|
||||||
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(entry.getTopObjectOverrides(), data, sizeCache, warnedLargeObjects));
|
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(new KList<>(entry.settings().topObjectOverrides()), data, sizeCache, warnedLargeObjects));
|
||||||
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(entry.getBottomObjectOverrides(), data, sizeCache, warnedLargeObjects));
|
maxObjectExtent = Math.max(maxObjectExtent, computePlacementRadius(new KList<>(entry.settings().bottomObjectOverrides()), data, sizeCache, warnedLargeObjects));
|
||||||
try {
|
try {
|
||||||
IrisBiome target = entry.getRealBiome(biome, data);
|
IrisBiome target = entry.getRealBiome(biome, data);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
|
|
||||||
package art.arcane.iris.engine.mantle.components;
|
package art.arcane.iris.engine.mantle.components;
|
||||||
|
|
||||||
|
import art.arcane.iris.engine.object.terrain.floating.ResolvedFloatingChild;
|
||||||
import art.arcane.iris.core.loader.IrisData;
|
import art.arcane.iris.core.loader.IrisData;
|
||||||
import art.arcane.iris.engine.framework.Engine;
|
import art.arcane.iris.engine.framework.Engine;
|
||||||
import art.arcane.iris.engine.mantle.MantleWriter;
|
import art.arcane.iris.engine.mantle.MantleWriter;
|
||||||
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
|
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
|
||||||
import art.arcane.iris.engine.object.placement.IObjectPlacer;
|
import art.arcane.iris.engine.object.placement.IObjectPlacer;
|
||||||
import art.arcane.iris.engine.object.terrain.floating.IrisFloatingChildBiomes;
|
|
||||||
import art.arcane.iris.engine.object.prefab.TileData;
|
import art.arcane.iris.engine.object.prefab.TileData;
|
||||||
import art.arcane.iris.spi.PlatformBlockState;
|
import art.arcane.iris.spi.PlatformBlockState;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -34,7 +34,7 @@ public final class IslandObjectPlacer implements IObjectPlacer {
|
|||||||
|
|
||||||
private final MantleWriter wrapped;
|
private final MantleWriter wrapped;
|
||||||
private final SampleProvider samples;
|
private final SampleProvider samples;
|
||||||
private final IrisFloatingChildBiomes entry;
|
private final ResolvedFloatingChild entry;
|
||||||
private final int anchorY;
|
private final int anchorY;
|
||||||
private final AnchorFace face;
|
private final AnchorFace face;
|
||||||
|
|
||||||
@@ -47,12 +47,12 @@ public final class IslandObjectPlacer implements IObjectPlacer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IslandObjectPlacer top(MantleWriter wrapped, SampleProvider samples,
|
public static IslandObjectPlacer top(MantleWriter wrapped, SampleProvider samples,
|
||||||
IrisFloatingChildBiomes entry, int anchorY) {
|
ResolvedFloatingChild entry, int anchorY) {
|
||||||
return new IslandObjectPlacer(wrapped, new AnchorSettings(samples, entry, anchorY, AnchorFace.TOP));
|
return new IslandObjectPlacer(wrapped, new AnchorSettings(samples, entry, anchorY, AnchorFace.TOP));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IslandObjectPlacer bottom(MantleWriter wrapped, SampleProvider samples,
|
public static IslandObjectPlacer bottom(MantleWriter wrapped, SampleProvider samples,
|
||||||
IrisFloatingChildBiomes entry, int anchorY) {
|
ResolvedFloatingChild entry, int anchorY) {
|
||||||
return new IslandObjectPlacer(wrapped, new AnchorSettings(samples, entry, anchorY, AnchorFace.BOTTOM));
|
return new IslandObjectPlacer(wrapped, new AnchorSettings(samples, entry, anchorY, AnchorFace.BOTTOM));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ public final class IslandObjectPlacer implements IObjectPlacer {
|
|||||||
return wrapped == null ? null : wrapped.getEngine();
|
return wrapped == null ? null : wrapped.getEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean matchesAnchor(FloatingIslandSample sample, IrisFloatingChildBiomes entry, AnchorFace face) {
|
static boolean matchesAnchor(FloatingIslandSample sample, ResolvedFloatingChild entry, AnchorFace face) {
|
||||||
if (sample == null) {
|
if (sample == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ public final class IslandObjectPlacer implements IObjectPlacer {
|
|||||||
|
|
||||||
private record AnchorSettings(
|
private record AnchorSettings(
|
||||||
SampleProvider samples,
|
SampleProvider samples,
|
||||||
IrisFloatingChildBiomes entry,
|
ResolvedFloatingChild entry,
|
||||||
int anchorY,
|
int anchorY,
|
||||||
AnchorFace face
|
AnchorFace face
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
package art.arcane.iris.engine.modifier;
|
package art.arcane.iris.engine.modifier;
|
||||||
|
|
||||||
|
|
||||||
|
import art.arcane.iris.engine.object.terrain.floating.ResolvedFloatingChild;
|
||||||
|
import art.arcane.iris.builtin.floating.FloatingBottomPaletteMode;
|
||||||
import art.arcane.iris.builtin.prepare.SlopeClip;
|
import art.arcane.iris.builtin.prepare.SlopeClip;
|
||||||
import art.arcane.iris.engine.object.world.biome.custom.IrisBiomeCustom;
|
import art.arcane.iris.engine.object.world.biome.custom.IrisBiomeCustom;
|
||||||
import art.arcane.iris.core.loader.IrisData;
|
import art.arcane.iris.core.loader.IrisData;
|
||||||
@@ -27,14 +29,12 @@ import art.arcane.iris.engine.decorator.FloatingDecorator;
|
|||||||
import art.arcane.iris.engine.decorator.IrisSeaSurfaceDecorator;
|
import art.arcane.iris.engine.decorator.IrisSeaSurfaceDecorator;
|
||||||
import art.arcane.iris.engine.framework.Engine;
|
import art.arcane.iris.engine.framework.Engine;
|
||||||
import art.arcane.iris.engine.framework.EngineDecorator;
|
import art.arcane.iris.engine.framework.EngineDecorator;
|
||||||
import art.arcane.iris.engine.object.terrain.floating.FloatingBottomPaletteMode;
|
|
||||||
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandBoundarySampler;
|
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandBoundarySampler;
|
||||||
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
|
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
|
||||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||||
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
||||||
import art.arcane.iris.engine.object.decoration.IrisDecorationPart;
|
import art.arcane.iris.engine.object.decoration.IrisDecorationPart;
|
||||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||||
import art.arcane.iris.engine.object.terrain.floating.IrisFloatingChildBiomes;
|
|
||||||
import art.arcane.iris.spi.IrisLogging;
|
import art.arcane.iris.spi.IrisLogging;
|
||||||
import art.arcane.iris.util.common.data.B;
|
import art.arcane.iris.util.common.data.B;
|
||||||
import art.arcane.iris.util.project.context.ChunkContext;
|
import art.arcane.iris.util.project.context.ChunkContext;
|
||||||
@@ -65,11 +65,11 @@ public class FloatingIslands {
|
|||||||
private final RNG rng;
|
private final RNG rng;
|
||||||
private final EngineDecorator seaSurfaceDecorator;
|
private final EngineDecorator seaSurfaceDecorator;
|
||||||
|
|
||||||
private static KList<PlatformBlockState> generateBottomPaletteLayers(IrisFloatingChildBiomes entry, IrisDimension dimension, double wx, double wz, RNG random, int paletteDepth, IrisData data, IrisComplex complex) {
|
private static KList<PlatformBlockState> generateBottomPaletteLayers(ResolvedFloatingChild entry, IrisDimension dimension, double wx, double wz, RNG random, int paletteDepth, IrisData data, IrisComplex complex) {
|
||||||
if (entry == null || entry.getBottomPaletteMode() != FloatingBottomPaletteMode.CUSTOM || entry.getBottomPalette() == null || entry.getBottomPalette().isEmpty()) {
|
if (entry == null || entry.settings().bottomPaletteMode() != FloatingBottomPaletteMode.CUSTOM || entry.settings().bottomPalette() == null || entry.settings().bottomPalette().isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return generatePaletteLayers(dimension, entry.getBottomPalette(), wx, wz, random.nextParallelRNG(0xB0770B), paletteDepth, data, complex);
|
return generatePaletteLayers(dimension, new KList<>(entry.settings().bottomPalette()), wx, wz, random.nextParallelRNG(0xB0770B), paletteDepth, data, complex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static KList<PlatformBlockState> generatePaletteLayers(IrisDimension dimension, KList<IrisBiomePaletteLayer> layers, double wx, double wz, RNG random, int maxDepth, IrisData data, IrisComplex complex) {
|
private static KList<PlatformBlockState> generatePaletteLayers(IrisDimension dimension, KList<IrisBiomePaletteLayer> layers, double wx, double wz, RNG random, int maxDepth, IrisData data, IrisComplex complex) {
|
||||||
@@ -127,8 +127,8 @@ public class FloatingIslands {
|
|||||||
return generated;
|
return generated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean usesBottomPalette(IrisFloatingChildBiomes entry) {
|
private static boolean usesBottomPalette(ResolvedFloatingChild entry) {
|
||||||
FloatingBottomPaletteMode mode = entry == null || entry.getBottomPaletteMode() == null ? FloatingBottomPaletteMode.DEPTH : entry.getBottomPaletteMode();
|
FloatingBottomPaletteMode mode = entry == null || entry.settings().bottomPaletteMode() == null ? FloatingBottomPaletteMode.DEPTH : entry.settings().bottomPaletteMode();
|
||||||
return mode != FloatingBottomPaletteMode.DEPTH;
|
return mode != FloatingBottomPaletteMode.DEPTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ public class FloatingIslands {
|
|||||||
bottomDepths[i] = -1;
|
bottomDepths[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentityHashMap<IrisFloatingChildBiomes, Integer> depthByEntry = new IdentityHashMap<>();
|
IdentityHashMap<ResolvedFloatingChild, Integer> depthByEntry = new IdentityHashMap<>();
|
||||||
int max = Math.min(sample.topIdx, sample.solidMask.length - 1);
|
int max = Math.min(sample.topIdx, sample.solidMask.length - 1);
|
||||||
for (int k = 0; k <= max; k++) {
|
for (int k = 0; k <= max; k++) {
|
||||||
if (!sample.solidMask[k]) {
|
if (!sample.solidMask[k]) {
|
||||||
@@ -148,7 +148,7 @@ public class FloatingIslands {
|
|||||||
if (y < 0 || y >= chunkHeight) {
|
if (y < 0 || y >= chunkHeight) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
IrisFloatingChildBiomes entry = sample.entryAt(k);
|
ResolvedFloatingChild entry = sample.entryAt(k);
|
||||||
int depth = depthByEntry.getOrDefault(entry, 0);
|
int depth = depthByEntry.getOrDefault(entry, 0);
|
||||||
bottomDepths[k] = depth;
|
bottomDepths[k] = depth;
|
||||||
depthByEntry.put(entry, depth + 1);
|
depthByEntry.put(entry, depth + 1);
|
||||||
@@ -157,8 +157,8 @@ public class FloatingIslands {
|
|||||||
return bottomDepths;
|
return bottomDepths;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PlatformBlockState selectPaletteBlock(IrisFloatingChildBiomes entry, KList<PlatformBlockState> topBlocks, KList<PlatformBlockState> bottomBlocks, int topDepth, int bottomDepth, PlatformBlockState fallbackSolid) {
|
private static PlatformBlockState selectPaletteBlock(ResolvedFloatingChild entry, KList<PlatformBlockState> topBlocks, KList<PlatformBlockState> bottomBlocks, int topDepth, int bottomDepth, PlatformBlockState fallbackSolid) {
|
||||||
FloatingBottomPaletteMode mode = entry == null || entry.getBottomPaletteMode() == null ? FloatingBottomPaletteMode.DEPTH : entry.getBottomPaletteMode();
|
FloatingBottomPaletteMode mode = entry == null || entry.settings().bottomPaletteMode() == null ? FloatingBottomPaletteMode.DEPTH : entry.settings().bottomPaletteMode();
|
||||||
if (mode == FloatingBottomPaletteMode.MIRROR_TOP) {
|
if (mode == FloatingBottomPaletteMode.MIRROR_TOP) {
|
||||||
return paletteBlock(topBlocks, Math.min(topDepth, bottomDepth), fallbackSolid);
|
return paletteBlock(topBlocks, Math.min(topDepth, bottomDepth), fallbackSolid);
|
||||||
}
|
}
|
||||||
@@ -179,9 +179,9 @@ public class FloatingIslands {
|
|||||||
return block == null ? fallbackSolid : block;
|
return block == null ? fallbackSolid : block;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PaletteContext createPaletteContext(IrisBiome parent, IrisFloatingChildBiomes entry, IrisDimension dimension, int wx, int wz, long colSeed, int paletteDepth, IrisData data, IrisComplex complex) {
|
private PaletteContext createPaletteContext(IrisBiome parent, ResolvedFloatingChild entry, IrisDimension dimension, int wx, int wz, long colSeed, int paletteDepth, IrisData data, IrisComplex complex) {
|
||||||
IrisBiome target = entry == null ? parent : entry.getRealBiome(parent, data);
|
IrisBiome target = entry == null ? parent : entry.getRealBiome(parent, data);
|
||||||
int entrySeed = entry == null || entry.getBiome() == null ? 0 : entry.getBiome().hashCode();
|
int entrySeed = entry == null || entry.settings().biome() == null ? 0 : entry.settings().biome().hashCode();
|
||||||
RNG layerRng = rng.nextParallelRNG((int) (colSeed ^ 0x7A4E ^ entrySeed));
|
RNG layerRng = rng.nextParallelRNG((int) (colSeed ^ 0x7A4E ^ entrySeed));
|
||||||
KList<PlatformBlockState> topBlocks = target == null ? null : target.generateLayers(dimension, wx, wz, layerRng, paletteDepth, paletteDepth, data, complex);
|
KList<PlatformBlockState> topBlocks = target == null ? null : target.generateLayers(dimension, wx, wz, layerRng, paletteDepth, paletteDepth, data, complex);
|
||||||
if (topBlocks == null || topBlocks.isEmpty()) {
|
if (topBlocks == null || topBlocks.isEmpty()) {
|
||||||
@@ -235,8 +235,8 @@ public class FloatingIslands {
|
|||||||
|
|
||||||
long colSeed = FloatingIslandSample.columnSeed(baseSeed, wx, wz);
|
long colSeed = FloatingIslandSample.columnSeed(baseSeed, wx, wz);
|
||||||
int paletteDepth = Math.max(4, sample.solidCount + 4);
|
int paletteDepth = Math.max(4, sample.solidCount + 4);
|
||||||
IdentityHashMap<IrisFloatingChildBiomes, PaletteContext> paletteContexts = new IdentityHashMap<>();
|
IdentityHashMap<ResolvedFloatingChild, PaletteContext> paletteContexts = new IdentityHashMap<>();
|
||||||
IdentityHashMap<IrisFloatingChildBiomes, Integer> topDepthByEntry = new IdentityHashMap<>();
|
IdentityHashMap<ResolvedFloatingChild, Integer> topDepthByEntry = new IdentityHashMap<>();
|
||||||
int[] bottomDepths = bottomDepths(sample, chunkHeight);
|
int[] bottomDepths = bottomDepths(sample, chunkHeight);
|
||||||
for (int k = sample.topIdx; k >= 0; k--) {
|
for (int k = sample.topIdx; k >= 0; k--) {
|
||||||
if (!sample.solidMask[k]) {
|
if (!sample.solidMask[k]) {
|
||||||
@@ -246,7 +246,7 @@ public class FloatingIslands {
|
|||||||
if (y < 0 || y >= chunkHeight) {
|
if (y < 0 || y >= chunkHeight) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
IrisFloatingChildBiomes entry = sample.entryAt(k);
|
ResolvedFloatingChild entry = sample.entryAt(k);
|
||||||
PaletteContext paletteContext = paletteContexts.get(entry);
|
PaletteContext paletteContext = paletteContexts.get(entry);
|
||||||
if (paletteContext == null) {
|
if (paletteContext == null) {
|
||||||
paletteContext = createPaletteContext(parent, entry, dimension, wx, wz, colSeed, paletteDepth, data, complex);
|
paletteContext = createPaletteContext(parent, entry, dimension, wx, wz, colSeed, paletteDepth, data, complex);
|
||||||
@@ -261,10 +261,10 @@ public class FloatingIslands {
|
|||||||
topDepthByEntry.put(entry, depth + 1);
|
topDepthByEntry.put(entry, depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisFloatingChildBiomes entry = sample.entry;
|
ResolvedFloatingChild entry = sample.entry;
|
||||||
Integer localFluidHeight = entry.getLocalFluidHeight();
|
int localFluidHeight = entry.settings().localFluidHeight().orElse(0);
|
||||||
if (localFluidHeight != null && localFluidHeight > 0) {
|
if (localFluidHeight > 0) {
|
||||||
PlatformBlockState fluid = B.getStateOrNull(entry.getFluidBlock());
|
PlatformBlockState fluid = B.getStateOrNull(entry.settings().fluidBlock());
|
||||||
if (fluid == null) {
|
if (fluid == null) {
|
||||||
fluid = B.getState("minecraft:water");
|
fluid = B.getState("minecraft:water");
|
||||||
}
|
}
|
||||||
@@ -317,10 +317,10 @@ public class FloatingIslands {
|
|||||||
if (sample == null) {
|
if (sample == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
IrisFloatingChildBiomes entry = sample.entry;
|
ResolvedFloatingChild entry = sample.entry;
|
||||||
IrisBiome target = entry.getRealBiome(parent, data);
|
IrisBiome target = entry.getRealBiome(parent, data);
|
||||||
|
|
||||||
if (!entry.isInheritDecorators() || target == null) {
|
if (!entry.settings().inheritDecorators() || target == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,8 +338,8 @@ public class FloatingIslands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer localFluidHeight = entry.getLocalFluidHeight();
|
int localFluidHeight = entry.settings().localFluidHeight().orElse(0);
|
||||||
if (localFluidHeight != null && localFluidHeight > 0) {
|
if (localFluidHeight > 0) {
|
||||||
int fluidCap = Math.min(sample.thickness - 1, localFluidHeight);
|
int fluidCap = Math.min(sample.thickness - 1, localFluidHeight);
|
||||||
int fluidTopY = -1;
|
int fluidTopY = -1;
|
||||||
for (int k = 1; k <= fluidCap; k++) {
|
for (int k = 1; k <= fluidCap; k++) {
|
||||||
@@ -375,7 +375,7 @@ public class FloatingIslands {
|
|||||||
|
|
||||||
private void writeIslandSkyBiomes(IrisBiome parent, int wx, int wz, FloatingIslandSample sample, int chunkHeight, IrisData data) {
|
private void writeIslandSkyBiomes(IrisBiome parent, int wx, int wz, FloatingIslandSample sample, int chunkHeight, IrisData data) {
|
||||||
try {
|
try {
|
||||||
IdentityHashMap<IrisFloatingChildBiomes, MatterBiomeInject> matterByEntry = new IdentityHashMap<>();
|
IdentityHashMap<ResolvedFloatingChild, MatterBiomeInject> matterByEntry = new IdentityHashMap<>();
|
||||||
for (int k = 0; k <= sample.topIdx; k++) {
|
for (int k = 0; k <= sample.topIdx; k++) {
|
||||||
if (!sample.solidMask[k]) {
|
if (!sample.solidMask[k]) {
|
||||||
continue;
|
continue;
|
||||||
@@ -384,7 +384,7 @@ public class FloatingIslands {
|
|||||||
if (y < 0 || y >= chunkHeight) {
|
if (y < 0 || y >= chunkHeight) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
IrisFloatingChildBiomes entry = sample.entryAt(k);
|
ResolvedFloatingChild entry = sample.entryAt(k);
|
||||||
MatterBiomeInject matter = matterByEntry.get(entry);
|
MatterBiomeInject matter = matterByEntry.get(entry);
|
||||||
if (matter == null) {
|
if (matter == null) {
|
||||||
IrisBiome target = entry == null ? parent : entry.getRealBiome(parent, data);
|
IrisBiome target = entry == null ? parent : entry.getRealBiome(parent, data);
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package art.arcane.iris.engine.modifier;
|
package art.arcane.iris.engine.modifier;
|
||||||
|
|
||||||
|
import art.arcane.iris.builtin.floating.FloatingChildBiome;
|
||||||
|
import com.volmit.FeatureRegistry;
|
||||||
import art.arcane.iris.builtin.IrisStages;
|
import art.arcane.iris.builtin.IrisStages;
|
||||||
import art.arcane.iris.core.modules.IrisChunk;
|
import art.arcane.iris.core.modules.IrisChunk;
|
||||||
import art.arcane.iris.core.modules.IrisMantleChunk;
|
import art.arcane.iris.core.modules.IrisMantleChunk;
|
||||||
@@ -46,6 +48,11 @@ public final class FloatingModule implements IrisModule {
|
|||||||
return ModuleInfo.of("iris:floating", "Floating islands", VERSION);
|
return ModuleInfo.of("iris:floating", "Floating islands", VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(FeatureRegistry registry) {
|
||||||
|
registry.registerHeldType(FloatingChildBiome.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void install(StageGraph graph) {
|
public void install(StageGraph graph) {
|
||||||
graph.define(IrisStages.Floating.OBJECTS).softAfter(IrisStages.Objects.PLACE.ref()).reach(FloatingModule::objectReach)
|
graph.define(IrisStages.Floating.OBJECTS).softAfter(IrisStages.Objects.PLACE.ref()).reach(FloatingModule::objectReach)
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Servers
|
||||||
|
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package art.arcane.iris.engine.object.terrain.floating;
|
||||||
|
|
||||||
|
import art.arcane.iris.builtin.floating.FloatingChildBiome;
|
||||||
|
import art.arcane.iris.core.loader.IrisData;
|
||||||
|
import art.arcane.iris.engine.framework.Engine;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/** The {@link ResolvedFloatingChild} of every {@link FloatingChildBiome} an engine runtime has met, one per decoded entry. */
|
||||||
|
public final class FloatingChildren {
|
||||||
|
private final Map<FloatingChildBiome, ResolvedFloatingChild> resolved = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public FloatingChildren(Engine engine) {
|
||||||
|
}
|
||||||
|
|
||||||
|
FloatingChildren() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The children of the engine {@code data} serves, or of {@code data} alone when no engine runs it. */
|
||||||
|
public static FloatingChildren of(IrisData data) {
|
||||||
|
Engine engine = data.getEngine();
|
||||||
|
return engine == null ? new FloatingChildren() : of(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FloatingChildren of(Engine engine) {
|
||||||
|
return engine.getGeneration().state(FloatingChildren.class, FloatingChildren::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResolvedFloatingChild of(FloatingChildBiome settings) {
|
||||||
|
return resolved.computeIfAbsent(settings, ResolvedFloatingChild::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ResolvedFloatingChild> of(List<FloatingChildBiome> settings) {
|
||||||
|
return settings.stream().map(this::of).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
-12
@@ -83,11 +83,11 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
return field.sample(x, z);
|
return field.sample(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OwnershipSample ownership(KList<IrisFloatingChildBiomes> entries, CNG picker, int x, int z) {
|
public OwnershipSample ownership(KList<ResolvedFloatingChild> entries, CNG picker, int x, int z) {
|
||||||
return ownership(entries, picker, x, z, EDGE_TAPER_WIDTH);
|
return ownership(entries, picker, x, z, EDGE_TAPER_WIDTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OwnershipSample ownership(KList<IrisFloatingChildBiomes> entries, CNG picker, int x, int z,
|
public OwnershipSample ownership(KList<ResolvedFloatingChild> entries, CNG picker, int x, int z,
|
||||||
int taperWidth) {
|
int taperWidth) {
|
||||||
int width = FloatingIslandEdgeProfile.clampWidth(taperWidth);
|
int width = FloatingIslandEdgeProfile.clampWidth(taperWidth);
|
||||||
int chunkX = Math.floorDiv(x, CHUNK_SIZE);
|
int chunkX = Math.floorDiv(x, CHUNK_SIZE);
|
||||||
@@ -131,7 +131,7 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
int boundaryDistance, double edgeFade) {
|
int boundaryDistance, double edgeFade) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public record OwnershipSample(IrisFloatingChildBiomes owner, int boundaryDistance, double edgeFade) {
|
public record OwnershipSample(ResolvedFloatingChild owner, int boundaryDistance, double edgeFade) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private record ParentFieldKey(long chunkKey, int taperWidth) {
|
private record ParentFieldKey(long chunkKey, int taperWidth) {
|
||||||
@@ -175,13 +175,13 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final class OwnershipFieldKey {
|
private static final class OwnershipFieldKey {
|
||||||
private final KList<IrisFloatingChildBiomes> entries;
|
private final KList<ResolvedFloatingChild> entries;
|
||||||
private final CNG picker;
|
private final CNG picker;
|
||||||
private final int chunkX;
|
private final int chunkX;
|
||||||
private final int chunkZ;
|
private final int chunkZ;
|
||||||
private final int taperWidth;
|
private final int taperWidth;
|
||||||
|
|
||||||
private OwnershipFieldKey(KList<IrisFloatingChildBiomes> entries, CNG picker, int chunkX, int chunkZ,
|
private OwnershipFieldKey(KList<ResolvedFloatingChild> entries, CNG picker, int chunkX, int chunkZ,
|
||||||
int taperWidth) {
|
int taperWidth) {
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
this.picker = picker;
|
this.picker = picker;
|
||||||
@@ -394,15 +394,15 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
private final FieldGeometry geometry;
|
private final FieldGeometry geometry;
|
||||||
private final int minX;
|
private final int minX;
|
||||||
private final int minZ;
|
private final int minZ;
|
||||||
private final IrisFloatingChildBiomes[] owners;
|
private final ResolvedFloatingChild[] owners;
|
||||||
private final IdentityHashMap<IrisFloatingChildBiomes, ComponentDistanceField> distances;
|
private final IdentityHashMap<ResolvedFloatingChild, ComponentDistanceField> distances;
|
||||||
|
|
||||||
private OwnershipField(KList<IrisFloatingChildBiomes> entries, CNG picker, int chunkX, int chunkZ,
|
private OwnershipField(KList<ResolvedFloatingChild> entries, CNG picker, int chunkX, int chunkZ,
|
||||||
int taperWidth) {
|
int taperWidth) {
|
||||||
this.geometry = FieldGeometry.forWidth(taperWidth);
|
this.geometry = FieldGeometry.forWidth(taperWidth);
|
||||||
this.minX = (chunkX * CHUNK_SIZE) - geometry.fadeRadius();
|
this.minX = (chunkX * CHUNK_SIZE) - geometry.fadeRadius();
|
||||||
this.minZ = (chunkZ * CHUNK_SIZE) - geometry.fadeRadius();
|
this.minZ = (chunkZ * CHUNK_SIZE) - geometry.fadeRadius();
|
||||||
this.owners = new IrisFloatingChildBiomes[geometry.area()];
|
this.owners = new ResolvedFloatingChild[geometry.area()];
|
||||||
this.distances = new IdentityHashMap<>();
|
this.distances = new IdentityHashMap<>();
|
||||||
for (int z = 0; z < geometry.fieldSize(); z++) {
|
for (int z = 0; z < geometry.fieldSize(); z++) {
|
||||||
for (int x = 0; x < geometry.fieldSize(); x++) {
|
for (int x = 0; x < geometry.fieldSize(); x++) {
|
||||||
@@ -410,7 +410,7 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
owners[geometry.index(x, z)] = IRare.pick(entries, value);
|
owners[geometry.index(x, z)] = IRare.pick(entries, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (IrisFloatingChildBiomes entry : entries) {
|
for (ResolvedFloatingChild entry : entries) {
|
||||||
if (entry != null && !distances.containsKey(entry)) {
|
if (entry != null && !distances.containsKey(entry)) {
|
||||||
distances.put(entry, buildDistanceField(entry));
|
distances.put(entry, buildDistanceField(entry));
|
||||||
}
|
}
|
||||||
@@ -419,7 +419,7 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
|
|
||||||
private OwnershipSample sample(int x, int z) {
|
private OwnershipSample sample(int x, int z) {
|
||||||
int index = geometry.index(x - minX, z - minZ);
|
int index = geometry.index(x - minX, z - minZ);
|
||||||
IrisFloatingChildBiomes owner = owners[index];
|
ResolvedFloatingChild owner = owners[index];
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
return new OwnershipSample(null, 0, 0.0D);
|
return new OwnershipSample(null, 0, 0.0D);
|
||||||
}
|
}
|
||||||
@@ -435,7 +435,7 @@ public final class FloatingIslandBoundarySampler {
|
|||||||
return new OwnershipSample(owner, boundaryDistance, fade);
|
return new OwnershipSample(owner, boundaryDistance, fade);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ComponentDistanceField buildDistanceField(IrisFloatingChildBiomes owner) {
|
private ComponentDistanceField buildDistanceField(ResolvedFloatingChild owner) {
|
||||||
boolean[] owned = new boolean[owners.length];
|
boolean[] owned = new boolean[owners.length];
|
||||||
byte[] distance = new byte[owners.length];
|
byte[] distance = new byte[owners.length];
|
||||||
boolean[] viable = new boolean[owners.length];
|
boolean[] viable = new boolean[owners.length];
|
||||||
|
|||||||
+46
-39
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package art.arcane.iris.engine.object.terrain.floating;
|
package art.arcane.iris.engine.object.terrain.floating;
|
||||||
|
|
||||||
|
import art.arcane.iris.builtin.floating.FloatingChildBiome;
|
||||||
import art.arcane.iris.engine.object.terrain.carving.IrisCaveProfileSampler;
|
import art.arcane.iris.engine.object.terrain.carving.IrisCaveProfileSampler;
|
||||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||||
import art.arcane.iris.core.loader.IrisData;
|
import art.arcane.iris.core.loader.IrisData;
|
||||||
@@ -28,6 +29,8 @@ import art.arcane.volmlib.util.collection.KList;
|
|||||||
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.OptionalInt;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@@ -99,20 +102,20 @@ public final class FloatingIslandSample {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final IrisFloatingChildBiomes entry;
|
public final ResolvedFloatingChild entry;
|
||||||
public final int islandBaseY;
|
public final int islandBaseY;
|
||||||
public final int thickness;
|
public final int thickness;
|
||||||
public final int topIdx;
|
public final int topIdx;
|
||||||
public final int solidCount;
|
public final int solidCount;
|
||||||
public final boolean[] solidMask;
|
public final boolean[] solidMask;
|
||||||
private final IrisFloatingChildBiomes[] entryMask;
|
private final ResolvedFloatingChild[] entryMask;
|
||||||
private transient int cachedBottomIdx = -2;
|
private transient int cachedBottomIdx = -2;
|
||||||
|
|
||||||
private FloatingIslandSample(IrisFloatingChildBiomes entry, int islandBaseY, int thickness, int topIdx, int solidCount, boolean[] solidMask) {
|
private FloatingIslandSample(ResolvedFloatingChild entry, int islandBaseY, int thickness, int topIdx, int solidCount, boolean[] solidMask) {
|
||||||
this(entry, islandBaseY, thickness, topIdx, solidCount, solidMask, null);
|
this(entry, islandBaseY, thickness, topIdx, solidCount, solidMask, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FloatingIslandSample(IrisFloatingChildBiomes entry, int islandBaseY, int thickness, int topIdx, int solidCount, boolean[] solidMask, IrisFloatingChildBiomes[] entryMask) {
|
private FloatingIslandSample(ResolvedFloatingChild entry, int islandBaseY, int thickness, int topIdx, int solidCount, boolean[] solidMask, ResolvedFloatingChild[] entryMask) {
|
||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
this.islandBaseY = islandBaseY;
|
this.islandBaseY = islandBaseY;
|
||||||
this.thickness = thickness;
|
this.thickness = thickness;
|
||||||
@@ -126,7 +129,7 @@ public final class FloatingIslandSample {
|
|||||||
return new FloatingIslandSample(null, islandBaseY, thickness, topIdx, solidCount, solidMask);
|
return new FloatingIslandSample(null, islandBaseY, thickness, topIdx, solidCount, solidMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FloatingIslandSample constructForTest(IrisFloatingChildBiomes entry, int islandBaseY, int thickness, int topIdx, int solidCount, boolean[] solidMask, IrisFloatingChildBiomes[] entryMask) {
|
static FloatingIslandSample constructForTest(ResolvedFloatingChild entry, int islandBaseY, int thickness, int topIdx, int solidCount, boolean[] solidMask, ResolvedFloatingChild[] entryMask) {
|
||||||
return new FloatingIslandSample(entry, islandBaseY, thickness, topIdx, solidCount, solidMask, entryMask);
|
return new FloatingIslandSample(entry, islandBaseY, thickness, topIdx, solidCount, solidMask, entryMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +150,7 @@ public final class FloatingIslandSample {
|
|||||||
return cachedBottomIdx == -1 ? -1 : islandBaseY + cachedBottomIdx;
|
return cachedBottomIdx == -1 ? -1 : islandBaseY + cachedBottomIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisFloatingChildBiomes entryAt(int maskIndex) {
|
public ResolvedFloatingChild entryAt(int maskIndex) {
|
||||||
if (entryMask != null && maskIndex >= 0 && maskIndex < entryMask.length && entryMask[maskIndex] != null) {
|
if (entryMask != null && maskIndex >= 0 && maskIndex < entryMask.length && entryMask[maskIndex] != null) {
|
||||||
return entryMask[maskIndex];
|
return entryMask[maskIndex];
|
||||||
}
|
}
|
||||||
@@ -155,7 +158,7 @@ public final class FloatingIslandSample {
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisFloatingChildBiomes bottomEntry() {
|
public ResolvedFloatingChild bottomEntry() {
|
||||||
int bottomY = bottomY();
|
int bottomY = bottomY();
|
||||||
if (bottomY < 0) {
|
if (bottomY < 0) {
|
||||||
return entry;
|
return entry;
|
||||||
@@ -172,17 +175,17 @@ public final class FloatingIslandSample {
|
|||||||
return baseSeed ^ ((long) wx * 341873128712L) ^ ((long) wz * 132897987541L);
|
return baseSeed ^ ((long) wx * 341873128712L) ^ ((long) wz * 132897987541L);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int maximumEdgeFieldWidth(KList<IrisFloatingChildBiomes> entries, long baseSeed,
|
private static int maximumEdgeFieldWidth(KList<ResolvedFloatingChild> entries, long baseSeed,
|
||||||
IrisData data, IrisBiome parent) {
|
IrisData data, IrisBiome parent) {
|
||||||
int maximumWidth = FloatingIslandEdgeProfile.MIN_WIDTH;
|
int maximumWidth = FloatingIslandEdgeProfile.MIN_WIDTH;
|
||||||
for (IrisFloatingChildBiomes entry : entries) {
|
for (ResolvedFloatingChild entry : entries) {
|
||||||
FloatingIslandEdgeProfile profile = resolveEdgeProfile(entry, baseSeed, data, parent);
|
FloatingIslandEdgeProfile profile = resolveEdgeProfile(entry, baseSeed, data, parent);
|
||||||
maximumWidth = Math.max(maximumWidth, profile.fieldWidth());
|
maximumWidth = Math.max(maximumWidth, profile.fieldWidth());
|
||||||
}
|
}
|
||||||
return maximumWidth;
|
return maximumWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FloatingIslandEdgeProfile resolveEdgeProfile(IrisFloatingChildBiomes entry, long baseSeed,
|
private static FloatingIslandEdgeProfile resolveEdgeProfile(ResolvedFloatingChild entry, long baseSeed,
|
||||||
IrisData data, IrisBiome parent) {
|
IrisData data, IrisBiome parent) {
|
||||||
FloatingIslandEdgeProfile profile = entry.getEdgeTaperProfile(baseSeed, data);
|
FloatingIslandEdgeProfile profile = entry.getEdgeTaperProfile(baseSeed, data);
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
@@ -193,11 +196,15 @@ public final class FloatingIslandSample {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static FloatingIslandSample sample(IrisBiome parent, int wx, int wz, int chunkHeight, long baseSeed, IrisData data, Engine engine, FloatingIslandBoundarySampler boundarySampler) {
|
public static FloatingIslandSample sample(IrisBiome parent, int wx, int wz, int chunkHeight, long baseSeed, IrisData data, Engine engine, FloatingIslandBoundarySampler boundarySampler) {
|
||||||
KList<IrisFloatingChildBiomes> entries = parent.getFloatingChildBiomes();
|
List<FloatingChildBiome> settings = parent.getFloatingChildBiomes();
|
||||||
if (entries == null || entries.isEmpty()) {
|
if (settings == null || settings.isEmpty()) {
|
||||||
return reject(REJECT_NO_ENTRIES);
|
return reject(REJECT_NO_ENTRIES);
|
||||||
}
|
}
|
||||||
|
KList<ResolvedFloatingChild> entries = new KList<>(FloatingChildren.of(data).of(settings));
|
||||||
|
return sample(parent, entries, wx, wz, chunkHeight, baseSeed, data, engine, boundarySampler);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FloatingIslandSample sample(IrisBiome parent, KList<ResolvedFloatingChild> entries, int wx, int wz, int chunkHeight, long baseSeed, IrisData data, Engine engine, FloatingIslandBoundarySampler boundarySampler) {
|
||||||
int boundaryFieldWidth = maximumEdgeFieldWidth(entries, baseSeed, data, parent);
|
int boundaryFieldWidth = maximumEdgeFieldWidth(entries, baseSeed, data, parent);
|
||||||
int parentBoundaryDistance = boundarySampler.edgeDistance(parent, wx, wz, boundaryFieldWidth);
|
int parentBoundaryDistance = boundarySampler.edgeDistance(parent, wx, wz, boundaryFieldWidth);
|
||||||
|
|
||||||
@@ -206,12 +213,12 @@ public final class FloatingIslandSample {
|
|||||||
parentBoundaryDistance, boundaryFieldWidth);
|
parentBoundaryDistance, boundaryFieldWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisFloatingChildBiomes entry;
|
ResolvedFloatingChild entry;
|
||||||
int ownershipBoundaryDistance = boundaryFieldWidth + 1;
|
int ownershipBoundaryDistance = boundaryFieldWidth + 1;
|
||||||
if (entries.size() == 1) {
|
if (entries.size() == 1) {
|
||||||
entry = entries.getFirst();
|
entry = entries.getFirst();
|
||||||
} else {
|
} else {
|
||||||
IrisFloatingChildBiomes reference = entries.getFirst();
|
ResolvedFloatingChild reference = entries.getFirst();
|
||||||
CNG picker = reference.getPickerCng(baseSeed, data);
|
CNG picker = reference.getPickerCng(baseSeed, data);
|
||||||
if (picker == null) {
|
if (picker == null) {
|
||||||
warnNullCng("pickerStyle", parent);
|
warnNullCng("pickerStyle", parent);
|
||||||
@@ -230,7 +237,7 @@ public final class FloatingIslandSample {
|
|||||||
parentBoundaryDistance, ownershipBoundaryDistance);
|
parentBoundaryDistance, ownershipBoundaryDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FloatingIslandSample sampleMerged(IrisBiome parent, KList<IrisFloatingChildBiomes> entries,
|
private static FloatingIslandSample sampleMerged(IrisBiome parent, KList<ResolvedFloatingChild> entries,
|
||||||
int wx, int wz, int chunkHeight, long baseSeed, IrisData data,
|
int wx, int wz, int chunkHeight, long baseSeed, IrisData data,
|
||||||
Engine engine, FloatingIslandBoundarySampler boundarySampler,
|
Engine engine, FloatingIslandBoundarySampler boundarySampler,
|
||||||
int parentBoundaryDistance, int boundaryFieldWidth) {
|
int parentBoundaryDistance, int boundaryFieldWidth) {
|
||||||
@@ -238,7 +245,7 @@ public final class FloatingIslandSample {
|
|||||||
int minY = Integer.MAX_VALUE;
|
int minY = Integer.MAX_VALUE;
|
||||||
int maxY = Integer.MIN_VALUE;
|
int maxY = Integer.MIN_VALUE;
|
||||||
|
|
||||||
for (IrisFloatingChildBiomes entry : entries) {
|
for (ResolvedFloatingChild entry : entries) {
|
||||||
FloatingIslandSample sample = sampleEntry(parent, entry, wx, wz, chunkHeight, baseSeed, data, engine,
|
FloatingIslandSample sample = sampleEntry(parent, entry, wx, wz, chunkHeight, baseSeed, data, engine,
|
||||||
boundarySampler, parentBoundaryDistance, boundaryFieldWidth + 1);
|
boundarySampler, parentBoundaryDistance, boundaryFieldWidth + 1);
|
||||||
if (sample == null) {
|
if (sample == null) {
|
||||||
@@ -266,7 +273,7 @@ public final class FloatingIslandSample {
|
|||||||
|
|
||||||
int thickness = maxY - minY + 1;
|
int thickness = maxY - minY + 1;
|
||||||
boolean[] solidMask = new boolean[thickness];
|
boolean[] solidMask = new boolean[thickness];
|
||||||
IrisFloatingChildBiomes[] entryMask = new IrisFloatingChildBiomes[thickness];
|
ResolvedFloatingChild[] entryMask = new ResolvedFloatingChild[thickness];
|
||||||
int[] entryTopY = new int[thickness];
|
int[] entryTopY = new int[thickness];
|
||||||
Arrays.fill(entryTopY, Integer.MIN_VALUE);
|
Arrays.fill(entryTopY, Integer.MIN_VALUE);
|
||||||
int solidCount = 0;
|
int solidCount = 0;
|
||||||
@@ -296,12 +303,12 @@ public final class FloatingIslandSample {
|
|||||||
return reject(REJECT_NO_SOLID);
|
return reject(REJECT_NO_SOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisFloatingChildBiomes topEntry = entryMask[topIdx] == null ? samples.getFirst().entry : entryMask[topIdx];
|
ResolvedFloatingChild topEntry = entryMask[topIdx] == null ? samples.getFirst().entry : entryMask[topIdx];
|
||||||
LAST_REJECT.get()[0] = REJECT_NONE;
|
LAST_REJECT.get()[0] = REJECT_NONE;
|
||||||
return new FloatingIslandSample(topEntry, minY, thickness, topIdx, solidCount, solidMask, entryMask);
|
return new FloatingIslandSample(topEntry, minY, thickness, topIdx, solidCount, solidMask, entryMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FloatingIslandSample sampleEntry(IrisBiome parent, IrisFloatingChildBiomes entry, int wx, int wz,
|
private static FloatingIslandSample sampleEntry(IrisBiome parent, ResolvedFloatingChild entry, int wx, int wz,
|
||||||
int chunkHeight, long baseSeed, IrisData data, Engine engine,
|
int chunkHeight, long baseSeed, IrisData data, Engine engine,
|
||||||
FloatingIslandBoundarySampler boundarySampler,
|
FloatingIslandBoundarySampler boundarySampler,
|
||||||
int parentBoundaryDistance, int ownershipBoundaryDistance) {
|
int parentBoundaryDistance, int ownershipBoundaryDistance) {
|
||||||
@@ -311,7 +318,7 @@ public final class FloatingIslandSample {
|
|||||||
warnNullCng("footprintStyle", parent);
|
warnNullCng("footprintStyle", parent);
|
||||||
return reject(REJECT_NO_SEED);
|
return reject(REJECT_NO_SEED);
|
||||||
}
|
}
|
||||||
double threshold = Math.max(0, Math.min(1, entry.getFootprintThreshold()));
|
double threshold = Math.max(0, Math.min(1, entry.settings().footprintThreshold()));
|
||||||
double signedCut = (threshold * 2.0) - 1.0;
|
double signedCut = (threshold * 2.0) - 1.0;
|
||||||
FloatingIslandBoundarySampler.FootprintSample footprint = boundarySampler.footprint(
|
FloatingIslandBoundarySampler.FootprintSample footprint = boundarySampler.footprint(
|
||||||
footprintCng, wx, wz, signedCut, edgeProfile.fieldWidth());
|
footprintCng, wx, wz, signedCut, edgeProfile.fieldWidth());
|
||||||
@@ -340,8 +347,8 @@ public final class FloatingIslandSample {
|
|||||||
double altNoise = altitudeCng.noise(wx, wz);
|
double altNoise = altitudeCng.noise(wx, wz);
|
||||||
double altClamped = Math.max(0, Math.min(1, altNoise));
|
double altClamped = Math.max(0, Math.min(1, altNoise));
|
||||||
int worldMin = engine.getWorld().minHeight();
|
int worldMin = engine.getWorld().minHeight();
|
||||||
int minAlt = Math.max(0, entry.getMinHeightAboveSurface() - worldMin);
|
int minAlt = Math.max(0, entry.settings().minHeightAboveSurface() - worldMin);
|
||||||
int maxAlt = Math.max(minAlt, entry.getMaxHeightAboveSurface() - worldMin);
|
int maxAlt = Math.max(minAlt, entry.settings().maxHeightAboveSurface() - worldMin);
|
||||||
int baseY = minAlt + (int) Math.round(altClamped * (maxAlt - minAlt));
|
int baseY = minAlt + (int) Math.round(altClamped * (maxAlt - minAlt));
|
||||||
|
|
||||||
IrisBiome target = entry.getRealBiome(parent, data);
|
IrisBiome target = entry.getRealBiome(parent, data);
|
||||||
@@ -355,9 +362,9 @@ public final class FloatingIslandSample {
|
|||||||
}
|
}
|
||||||
double bottomNoise = bottomCng.noise(wx, wz);
|
double bottomNoise = bottomCng.noise(wx, wz);
|
||||||
double bottomClamped = Math.max(0, Math.min(1, bottomNoise));
|
double bottomClamped = Math.max(0, Math.min(1, bottomNoise));
|
||||||
double bottomShaped = Math.pow(bottomClamped, Math.max(0.1, entry.getBottomExponent()));
|
double bottomShaped = Math.pow(bottomClamped, Math.max(0.1, entry.settings().bottomExponent()));
|
||||||
int minDepth = Math.max(0, entry.getBottomDepthMin());
|
int minDepth = Math.max(0, entry.settings().bottomDepthMin());
|
||||||
int maxDepth = Math.max(minDepth, entry.getBottomDepthMax());
|
int maxDepth = Math.max(minDepth, entry.settings().bottomDepthMax());
|
||||||
int depth = roundedEdgeDepth(minDepth, maxDepth, bottomShaped, edgeFade);
|
int depth = roundedEdgeDepth(minDepth, maxDepth, bottomShaped, edgeFade);
|
||||||
if (topH == 0 && depth == 0) {
|
if (topH == 0 && depth == 0) {
|
||||||
double fullDepth = minDepth + (bottomShaped * (maxDepth - minDepth));
|
double fullDepth = minDepth + (bottomShaped * (maxDepth - minDepth));
|
||||||
@@ -372,13 +379,13 @@ public final class FloatingIslandSample {
|
|||||||
int topY = baseY + topH;
|
int topY = baseY + topH;
|
||||||
int botY = baseY - depth;
|
int botY = baseY - depth;
|
||||||
|
|
||||||
Integer minAbsoluteY = entry.getMinAbsoluteY();
|
OptionalInt minAbsoluteY = entry.settings().minAbsoluteY();
|
||||||
if (minAbsoluteY != null && botY < minAbsoluteY - worldMin) {
|
if (minAbsoluteY.isPresent() && botY < minAbsoluteY.getAsInt() - worldMin) {
|
||||||
botY = minAbsoluteY - worldMin;
|
botY = minAbsoluteY.getAsInt() - worldMin;
|
||||||
}
|
}
|
||||||
Integer maxAbsoluteY = entry.getMaxAbsoluteY();
|
OptionalInt maxAbsoluteY = entry.settings().maxAbsoluteY();
|
||||||
if (maxAbsoluteY != null && topY > maxAbsoluteY - worldMin) {
|
if (maxAbsoluteY.isPresent() && topY > maxAbsoluteY.getAsInt() - worldMin) {
|
||||||
topY = maxAbsoluteY - worldMin;
|
topY = maxAbsoluteY.getAsInt() - worldMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (botY < 0) {
|
if (botY < 0) {
|
||||||
@@ -392,7 +399,7 @@ public final class FloatingIslandSample {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int thickness = topY - botY + 1;
|
int thickness = topY - botY + 1;
|
||||||
int maxThickness = Math.max(1, entry.getMaxThickness());
|
int maxThickness = Math.max(1, entry.settings().maxThickness());
|
||||||
if (thickness > maxThickness) {
|
if (thickness > maxThickness) {
|
||||||
botY = topY - maxThickness + 1;
|
botY = topY - maxThickness + 1;
|
||||||
if (botY < 0) {
|
if (botY < 0) {
|
||||||
@@ -406,11 +413,11 @@ public final class FloatingIslandSample {
|
|||||||
|
|
||||||
boolean[] solidMask = new boolean[thickness];
|
boolean[] solidMask = new boolean[thickness];
|
||||||
CNG wallWarp = entry.getWallWarpCng(baseSeed, data);
|
CNG wallWarp = entry.getWallWarpCng(baseSeed, data);
|
||||||
double warpAmp = Math.max(0, entry.getWallWarpAmplitude());
|
double warpAmp = Math.max(0, entry.settings().wallWarpAmplitude());
|
||||||
double effectiveWarpAmp = effectiveWallWarpAmplitude(warpAmp, edgeFade);
|
double effectiveWarpAmp = effectiveWallWarpAmplitude(warpAmp, edgeFade);
|
||||||
IrisCaveProfileSampler carvingProfileSampler = entry.getCarvingProfileSampler(engine, data);
|
IrisCaveProfileSampler carvingProfileSampler = entry.getCarvingProfileSampler(engine, data);
|
||||||
CNG carve = carvingProfileSampler == null && !entry.hasCarvingReference() ? entry.getCarveCng(baseSeed, data) : null;
|
CNG carve = carvingProfileSampler == null && !entry.hasCarvingReference() ? entry.getCarveCng(baseSeed, data) : null;
|
||||||
double carveThreshold = entry.getCarveThreshold();
|
double carveThreshold = entry.settings().carveThreshold();
|
||||||
boolean useWarp = wallWarp != null && effectiveWarpAmp > 0;
|
boolean useWarp = wallWarp != null && effectiveWarpAmp > 0;
|
||||||
boolean useProfileCarve = carvingProfileSampler != null;
|
boolean useProfileCarve = carvingProfileSampler != null;
|
||||||
boolean useCarve = directCarveEnabled(entry, carvingProfileSampler, carve, carveThreshold);
|
boolean useCarve = directCarveEnabled(entry, carvingProfileSampler, carve, carveThreshold);
|
||||||
@@ -477,7 +484,7 @@ public final class FloatingIslandSample {
|
|||||||
return amplitude * fade;
|
return amplitude * fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean directCarveEnabled(IrisFloatingChildBiomes entry, IrisCaveProfileSampler carvingProfileSampler, CNG carve, double carveThreshold) {
|
static boolean directCarveEnabled(ResolvedFloatingChild entry, IrisCaveProfileSampler carvingProfileSampler, CNG carve, double carveThreshold) {
|
||||||
return carvingProfileSampler == null && (entry == null || !entry.hasCarvingReference()) && carve != null && carveThreshold < 1.0;
|
return carvingProfileSampler == null && (entry == null || !entry.hasCarvingReference()) && carve != null && carveThreshold < 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -768,12 +775,12 @@ public final class FloatingIslandSample {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int computeTopHeight(IrisFloatingChildBiomes entry, IrisBiome target, Engine engine, long baseSeed, int wx, int wz, IrisData data) {
|
private static int computeTopHeight(ResolvedFloatingChild entry, IrisBiome target, Engine engine, long baseSeed, int wx, int wz, IrisData data) {
|
||||||
int maxTopHeight = Math.max(0, entry.getMaxTopHeight());
|
int maxTopHeight = Math.max(0, entry.settings().maxTopHeight());
|
||||||
if (maxTopHeight == 0) {
|
if (maxTopHeight == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return switch (entry.getTopShapeMode()) {
|
return switch (entry.settings().topShapeMode()) {
|
||||||
case FLAT -> maxTopHeight;
|
case FLAT -> maxTopHeight;
|
||||||
case NOISE -> {
|
case NOISE -> {
|
||||||
CNG topCng = entry.getTopShapeCng(baseSeed, data);
|
CNG topCng = entry.getTopShapeCng(baseSeed, data);
|
||||||
@@ -783,7 +790,7 @@ public final class FloatingIslandSample {
|
|||||||
}
|
}
|
||||||
double n = topCng.noise(wx, wz);
|
double n = topCng.noise(wx, wz);
|
||||||
double clamped = Math.max(0, Math.min(1, n));
|
double clamped = Math.max(0, Math.min(1, n));
|
||||||
double amp = Math.max(0, Math.min(1, entry.getTopShapeAmp()));
|
double amp = Math.max(0, Math.min(1, entry.settings().topShapeAmp()));
|
||||||
yield (int) Math.round(clamped * amp * maxTopHeight);
|
yield (int) Math.round(clamped * amp * maxTopHeight);
|
||||||
}
|
}
|
||||||
case BIOME -> {
|
case BIOME -> {
|
||||||
|
|||||||
+226
@@ -0,0 +1,226 @@
|
|||||||
|
/*
|
||||||
|
* 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.floating;
|
||||||
|
|
||||||
|
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.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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link FloatingChildBiome} made ready for one engine: the noise its styles build (each from the world seed it is first
|
||||||
|
* asked with), the edge taper profile, the biome it targets, the carving profile sampler and the objects it hosts. The
|
||||||
|
* settings class held these on itself; the engine now keeps one of these per decoded entry ({@link FloatingChildren}).
|
||||||
|
*/
|
||||||
|
public final class ResolvedFloatingChild implements IRare {
|
||||||
|
private final FloatingChildBiome settings;
|
||||||
|
private final IrisGeneratorStyle footprintStyle;
|
||||||
|
private final IrisGeneratorStyle edgeTaperVariationStyle;
|
||||||
|
private final IrisGeneratorStyle pickerStyle;
|
||||||
|
private final IrisGeneratorStyle altitudeStyle;
|
||||||
|
private final IrisGeneratorStyle topShapeStyle;
|
||||||
|
private final IrisGeneratorStyle bottomStyle;
|
||||||
|
private final IrisGeneratorStyle wallWarpStyle;
|
||||||
|
private final IrisGeneratorStyle carveStyle;
|
||||||
|
private final AtomicCache<IrisBiome> resolvedBiome = new AtomicCache<>();
|
||||||
|
private final AtomicCache<CNG> footprintCache = new AtomicCache<>();
|
||||||
|
private final AtomicCache<FloatingIslandEdgeProfile> edgeTaperProfileCache = new AtomicCache<>();
|
||||||
|
private final AtomicCache<CNG> pickerCache = new AtomicCache<>();
|
||||||
|
private final AtomicCache<CNG> altitudeCache = new AtomicCache<>();
|
||||||
|
private final AtomicCache<CNG> topShapeCache = new AtomicCache<>();
|
||||||
|
private final AtomicCache<CNG> bottomCache = new AtomicCache<>();
|
||||||
|
private final AtomicCache<CNG> wallWarpCache = new AtomicCache<>();
|
||||||
|
private final AtomicCache<CNG> carveCache = new AtomicCache<>();
|
||||||
|
private final AtomicCache<IrisCaveProfileSampler> carvingProfileSamplerCache = new AtomicCache<>(true);
|
||||||
|
private final AtomicCache<IrisObjectScale> shrinkScaleCache = new AtomicCache<>();
|
||||||
|
|
||||||
|
public ResolvedFloatingChild(FloatingChildBiome settings) {
|
||||||
|
this.settings = settings;
|
||||||
|
this.footprintStyle = IrisValues.generatorStyle(settings.footprintStyle());
|
||||||
|
this.edgeTaperVariationStyle = IrisValues.generatorStyle(settings.edgeTaperVariationStyle());
|
||||||
|
this.pickerStyle = IrisValues.generatorStyle(settings.pickerStyle());
|
||||||
|
this.altitudeStyle = IrisValues.generatorStyle(settings.altitudeStyle());
|
||||||
|
this.topShapeStyle = IrisValues.generatorStyle(settings.topShapeStyle());
|
||||||
|
this.bottomStyle = IrisValues.generatorStyle(settings.bottomStyle());
|
||||||
|
this.wallWarpStyle = settings.wallWarpStyle().map(IrisValues::generatorStyle).orElse(null);
|
||||||
|
this.carveStyle = settings.carveStyle().map(IrisValues::generatorStyle).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatingChildBiome settings() {
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRarity() {
|
||||||
|
return settings.rarity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CNG getFootprintCng(long baseSeed, IrisData data) {
|
||||||
|
return footprintCache.aquire(() -> footprintStyle.create(new RNG(baseSeed ^ 0xF007B17DL), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public FloatingIslandEdgeProfile getEdgeTaperProfile(long baseSeed, IrisData data) {
|
||||||
|
return edgeTaperProfileCache.aquire(() -> {
|
||||||
|
int width = FloatingIslandEdgeProfile.clampWidth(settings.edgeTaperWidth());
|
||||||
|
double amplitude = FloatingIslandEdgeProfile.clampVariationAmplitude(
|
||||||
|
settings.edgeTaperVariationAmplitude(), width);
|
||||||
|
CNG variation = amplitude > 0.0D
|
||||||
|
? edgeTaperVariationStyle.create(new RNG(baseSeed ^ 0xED6E7A9E5L), data)
|
||||||
|
: null;
|
||||||
|
return new FloatingIslandEdgeProfile(width, settings.edgeTaperExponent(), amplitude, variation);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public CNG getPickerCng(long baseSeed, IrisData data) {
|
||||||
|
return pickerCache.aquire(() -> pickerStyle.create(new RNG(baseSeed ^ 0x91C4E72DL), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CNG getAltitudeCng(long baseSeed, IrisData data) {
|
||||||
|
return altitudeCache.aquire(() -> altitudeStyle.create(new RNG(baseSeed ^ 0xA17DEBBL), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CNG getTopShapeCng(long baseSeed, IrisData data) {
|
||||||
|
return topShapeCache.aquire(() -> topShapeStyle.create(new RNG(baseSeed ^ 0x70970601DEFL), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CNG getBottomCng(long baseSeed, IrisData data) {
|
||||||
|
return bottomCache.aquire(() -> bottomStyle.create(new RNG(baseSeed ^ 0xB0770075CAFEL), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CNG getWallWarpCng(long baseSeed, IrisData data) {
|
||||||
|
if (wallWarpStyle == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return wallWarpCache.aquire(() -> wallWarpStyle.create(new RNG(baseSeed ^ 0xA117BA17E0FL), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CNG getCarveCng(long baseSeed, IrisData data) {
|
||||||
|
if (carveStyle == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return carveCache.aquire(() -> carveStyle.create(new RNG(baseSeed ^ 0xCA5EC1EE5EL), data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IrisCaveProfileSampler getCarvingProfileSampler(Engine engine, IrisData data) {
|
||||||
|
if (!hasCarvingReference()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return carvingProfileSamplerCache.aquire(() -> {
|
||||||
|
IrisBiome resolved = resolveCarvingBiome(settings.carving(), engine, data);
|
||||||
|
if (resolved == null || resolved.getCaveProfile() == null || !resolved.getCaveProfile().enabled()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new IrisCaveProfileSampler(engine, resolved.getCaveProfile());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasCarvingReference() {
|
||||||
|
String carving = settings.carving();
|
||||||
|
return !carving.isBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
static IrisBiome resolveCarvingBiome(String carving, Engine engine, IrisData data) {
|
||||||
|
if (carving == null || carving.isBlank() || engine == null || data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
IrisDimension dimension = engine.getDimension();
|
||||||
|
if (dimension != null && dimension.getCarvingEntryIndex() != null) {
|
||||||
|
IrisDimensionCarvingEntry entry = dimension.getCarvingEntryIndex().get(carving);
|
||||||
|
if (entry != null) {
|
||||||
|
return IrisDimensionCarvingResolver.resolveEntryBiome(engine, entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getBiomeLoader() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.getBiomeLoader().load(carving);
|
||||||
|
}
|
||||||
|
|
||||||
|
public KList<IrisObjectPlacement> resolveTopObjects(IrisBiome target) {
|
||||||
|
KList<IrisObjectPlacement> surfaceObjects = (settings.inheritObjects() && target != null) ? target.getSurfaceObjects() : new KList<>();
|
||||||
|
return resolveTopObjectsFromSurface(surfaceObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
KList<IrisObjectPlacement> resolveTopObjectsFromSurface(KList<IrisObjectPlacement> surfaceObjects) {
|
||||||
|
return switch (settings.topObjectMode()) {
|
||||||
|
case REPLACE -> new KList<>(settings.topObjectOverrides());
|
||||||
|
case MERGE -> {
|
||||||
|
KList<IrisObjectPlacement> merged = new KList<>();
|
||||||
|
merged.addAll(surfaceObjects);
|
||||||
|
merged.addAll(settings.topObjectOverrides());
|
||||||
|
yield merged;
|
||||||
|
}
|
||||||
|
case INHERIT_ONLY -> surfaceObjects;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public KList<IrisObjectPlacement> resolveBottomObjects(IrisBiome target) {
|
||||||
|
return switch (settings.bottomObjectMode()) {
|
||||||
|
case INHERIT_ONLY -> new KList<>();
|
||||||
|
case MERGE, REPLACE -> new KList<>(settings.bottomObjectOverrides());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasObjectShrink() {
|
||||||
|
double shrink = settings.objectShrinkFactor();
|
||||||
|
return shrink > 0 && shrink < 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IrisObjectScale getShrinkScale() {
|
||||||
|
return shrinkScaleCache.aquire(() -> {
|
||||||
|
IrisObjectScale s = new IrisObjectScale();
|
||||||
|
s.setSize(Math.max(0.01, Math.min(1.0, settings.objectShrinkFactor())));
|
||||||
|
return s;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public IrisBiome getRealBiome(IrisBiome parent, IrisData data) {
|
||||||
|
return resolvedBiome.aquire(() -> {
|
||||||
|
String biome = settings.biome();
|
||||||
|
if (biome.isBlank() || biome.equals(parent.getLoadKey())) {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
IrisBiome loaded = data.getBiomeLoader().load(biome);
|
||||||
|
if (loaded == null) {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return loaded;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package art.arcane.iris.engine.object.world.biome;
|
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.builtin.carve.CaveProfile;
|
||||||
import art.arcane.iris.engine.object.decoration.IrisDecorationPart;
|
import art.arcane.iris.engine.object.decoration.IrisDecorationPart;
|
||||||
import art.arcane.iris.engine.object.decoration.IrisDecorator;
|
import art.arcane.iris.engine.object.decoration.IrisDecorator;
|
||||||
@@ -36,7 +37,6 @@ 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.IrisDepositVariant;
|
||||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
||||||
import art.arcane.iris.engine.object.terrain.floating.IrisFloatingChildBiomes;
|
|
||||||
import art.arcane.iris.engine.object.value.IRare;
|
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.biome.custom.IrisBiomeCustom;
|
||||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||||
@@ -216,9 +216,9 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
@ArrayType(min = 1, type = IrisStructurePlacement.class)
|
@ArrayType(min = 1, type = IrisStructurePlacement.class)
|
||||||
@Desc("Structures define jigsaw or vanilla/datapack structures iris will place in this biome")
|
@Desc("Structures define jigsaw or vanilla/datapack structures iris will place in this biome")
|
||||||
private KList<IrisStructurePlacement> structures = new KList<>();
|
private KList<IrisStructurePlacement> structures = new KList<>();
|
||||||
@ArrayType(min = 1, type = IrisFloatingChildBiomes.class)
|
@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.")
|
@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<IrisFloatingChildBiomes> floatingChildBiomes = new KList<>();
|
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.")
|
@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;
|
private boolean mergeFloatingChildBiomes = false;
|
||||||
@ArrayType(min = 1, type = IrisBiomeGeneratorLink.class)
|
@ArrayType(min = 1, type = IrisBiomeGeneratorLink.class)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package art.arcane.iris.engine.object.world.dimension;
|
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.builtin.carve.CaveProfile;
|
||||||
import art.arcane.iris.engine.object.decoration.IrisImportedFeatureControl;
|
import art.arcane.iris.engine.object.decoration.IrisImportedFeatureControl;
|
||||||
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
|
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
|
||||||
@@ -38,7 +39,6 @@ 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.IrisDepositVariant;
|
||||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
||||||
import art.arcane.iris.engine.object.terrain.floating.IrisFloatingChildBiomes;
|
|
||||||
import art.arcane.iris.engine.object.value.IrisRange;
|
import art.arcane.iris.engine.object.value.IrisRange;
|
||||||
import art.arcane.iris.engine.object.world.IrisEnvironment;
|
import art.arcane.iris.engine.object.world.IrisEnvironment;
|
||||||
import art.arcane.iris.engine.object.world.IrisWorldBoundary;
|
import art.arcane.iris.engine.object.world.IrisWorldBoundary;
|
||||||
@@ -584,14 +584,14 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
biomes.put(loadKey, biome);
|
biomes.put(loadKey, biome);
|
||||||
addReachableBiomeKeys(pending, biome.getChildren());
|
addReachableBiomeKeys(pending, biome.getChildren());
|
||||||
addReachableBiomeKey(pending, biome.getCarvingBiome());
|
addReachableBiomeKey(pending, biome.getCarvingBiome());
|
||||||
KList<IrisFloatingChildBiomes> floatingChildren = biome.getFloatingChildBiomes();
|
KList<FloatingChildBiome> floatingChildren = biome.getFloatingChildBiomes();
|
||||||
if (floatingChildren == null) {
|
if (floatingChildren == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (IrisFloatingChildBiomes floatingChild : floatingChildren) {
|
for (FloatingChildBiome floatingChild : floatingChildren) {
|
||||||
if (floatingChild != null) {
|
if (floatingChild != null) {
|
||||||
addReachableBiomeKey(pending, floatingChild.getBiome());
|
addReachableBiomeKey(pending, floatingChild.biome());
|
||||||
String carvingReference = floatingChild.getCarving();
|
String carvingReference = floatingChild.carving();
|
||||||
IrisDimensionCarvingEntry carvingEntry = carvingEntryIndex.get(carvingReference);
|
IrisDimensionCarvingEntry carvingEntry = carvingEntryIndex.get(carvingReference);
|
||||||
addReachableBiomeKey(pending,
|
addReachableBiomeKey(pending,
|
||||||
carvingEntry == null ? carvingReference : carvingEntry.getBiome());
|
carvingEntry == null ? carvingReference : carvingEntry.getBiome());
|
||||||
|
|||||||
Reference in new issue
Block a user