mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 16:25:36 +00:00
Merge master (T, C, L) into wave3/s: iris:post reads T's post and terrain settings, iris:perfection C's hideOresForHiddenOre; a layer's block picks move into the shared, portable LayerBlocks so terrain, caves and post keep one noise per layer; PendingSettings is gone
This commit is contained in:
commit
2148eb28cd
140 files changed
+5658
-3746
No files matched your search
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin;
|
||||
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Transitional: settings Iris's built-in modules read that still live on Iris's dimension and biome classes while
|
||||
* wave 3a moves them into module settings, {@code hideOresForHiddenOre} (agent C) and {@code postProcessingWalls},
|
||||
* {@code postProcessingSlabs} and a biome's {@code wall} and {@code slab} (agent T). Iris's worlds implement it. When
|
||||
* those settings land, each method gives way to a read of its module setting and this type is deleted; nothing else
|
||||
* may use it.
|
||||
*/
|
||||
public interface PendingSettings {
|
||||
/** The pending settings of {@code world}, which must be a world Iris generates. */
|
||||
static PendingSettings of(PackWorld world) {
|
||||
if (world instanceof PendingSettings pending) {
|
||||
return pending;
|
||||
}
|
||||
throw new IllegalArgumentException("Built-in modules generate Iris's own worlds, not " + world);
|
||||
}
|
||||
|
||||
/** The dimension's {@code hideOresForHiddenOre}. */
|
||||
boolean hidesOres();
|
||||
|
||||
/** The dimension's {@code postProcessingWalls}. */
|
||||
boolean postProcessingWalls();
|
||||
|
||||
/** The dimension's {@code postProcessingSlabs}. */
|
||||
boolean postProcessingSlabs();
|
||||
|
||||
/** The {@code wall} of the surface biome of the column at {@code x}, {@code z}; empty when its palette lists no block. */
|
||||
Optional<BiomeLayer> wall(int x, int z);
|
||||
|
||||
/** The {@code slab} of the surface biome of the column at {@code x}, {@code z}. */
|
||||
BiomeLayer slab(int x, int z);
|
||||
|
||||
/** One of a biome's palette layers, picking as Iris always picked it, with the world's post-processing seed. */
|
||||
interface BiomeLayer {
|
||||
/** The block the layer picks at {@code x}, {@code y}, {@code z}; empty when none of its blocks exists. */
|
||||
Optional<BlockState> at(double x, double y, double z);
|
||||
|
||||
/** Whether the layer's slope condition holds where the terrain's slope is {@code slope}. */
|
||||
boolean allowsSlope(double slope);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.carve;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.LinkedBiomes;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/** A biome's {@code carvingBiome}, written as the biome key: it registers that biome with the pack's layout and is not applied as a substitute under carvings. */
|
||||
@Desc("Registers the referenced biome with this pack's reachable biome set. It is NOT applied as a substitute under carvings; cave biomes come from the region's caveBiomes list.")
|
||||
@Feature(id = "iris:carve/biome", name = "Carving biome", key = "carvingBiome", root = "biome", targets = Target.BIOME)
|
||||
public final class CarvingBiomeSettings implements IrisFeature, LinkedBiomes {
|
||||
@Ref(Reference.PACK_BIOME)
|
||||
@Desc("Registers the referenced biome with this pack's reachable biome set. It is NOT applied as a substitute under carvings; cave biomes come from the region's caveBiomes list.")
|
||||
private String biome = "";
|
||||
|
||||
public CarvingBiomeSettings() {
|
||||
}
|
||||
|
||||
public CarvingBiomeSettings(String biome) {
|
||||
this.biome = biome;
|
||||
}
|
||||
|
||||
public String biome() {
|
||||
return biome == null ? "" : biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> treeBiomes() {
|
||||
return Set.of(biome());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.carve;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** A dimension's {@code carvingEnabled}, written as the bare boolean. */
|
||||
@Desc("Enable or disable all carving for this dimension")
|
||||
@Feature(id = "iris:carve/enabled", name = "Carving enabled", key = "carvingEnabled", root = "enabled", targets = Target.DIMENSION)
|
||||
public final class CarvingEnabledSettings implements IrisFeature {
|
||||
@Desc("Enable or disable all carving for this dimension")
|
||||
private boolean enabled = true;
|
||||
|
||||
public CarvingEnabledSettings() {
|
||||
}
|
||||
|
||||
public CarvingEnabledSettings(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.carve;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Range;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Snippet;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One dimension-level cave biome override, an entry of {@code carving}: a pack biome that replaces the cave biome within a band
|
||||
* of world Y, optionally split into child entries by a noise pattern. IrisApi types only; {@code CarvingResolver} picks
|
||||
* the entry for a position.
|
||||
*/
|
||||
@Snippet("dimension-carving-entry")
|
||||
@Desc("Dimension-level cave biome override with absolute world Y bounds.")
|
||||
public final class CarvingEntry {
|
||||
private static final double DEFAULT_WORLD_Y_MIN = -64;
|
||||
private static final double DEFAULT_WORLD_Y_MAX = 320;
|
||||
private static final double DEFAULT_CHILD_SHRINK_FACTOR = 1.5;
|
||||
private static final int DEFAULT_CHILD_RECURSION_DEPTH = 3;
|
||||
|
||||
@Desc("Stable id for this carving entry")
|
||||
private String id = "";
|
||||
|
||||
@Desc("Enable or disable this carving entry")
|
||||
private boolean enabled = true;
|
||||
|
||||
@Ref(Reference.PACK_BIOME)
|
||||
@Desc("Cave biome to apply when world Y falls within worldYRange")
|
||||
private String biome = "";
|
||||
|
||||
@Desc("Absolute world Y bounds where this carving entry applies")
|
||||
private Range worldYRange = Range.of(DEFAULT_WORLD_Y_MIN, DEFAULT_WORLD_Y_MAX);
|
||||
|
||||
@Desc("If this carving entry has child carving entries, this controls how small those child carving patches are.")
|
||||
private double childShrinkFactor = DEFAULT_CHILD_SHRINK_FACTOR;
|
||||
|
||||
@Desc("If this carving entry has child carving entries, this controls the shape pattern used to pick them.")
|
||||
private NoiseStyle childStyle = NoiseStyle.of("CELLULAR_IRIS_DOUBLE");
|
||||
|
||||
@Desc("Child carving entry ids. Child ids can point back to parent ids to create cycles; recursion is bounded by childRecursionDepth.")
|
||||
private List<String> children = List.of();
|
||||
|
||||
@Desc("Maximum recursion depth when resolving child carving entries from this entry.")
|
||||
private int childRecursionDepth = DEFAULT_CHILD_RECURSION_DEPTH;
|
||||
|
||||
public CarvingEntry() {
|
||||
}
|
||||
|
||||
public String id() {
|
||||
return id == null ? "" : id;
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public String biome() {
|
||||
return biome == null ? "" : biome;
|
||||
}
|
||||
|
||||
public Range worldYRange() {
|
||||
return worldYRange;
|
||||
}
|
||||
|
||||
public double childShrinkFactor() {
|
||||
return childShrinkFactor;
|
||||
}
|
||||
|
||||
public NoiseStyle childStyle() {
|
||||
return childStyle;
|
||||
}
|
||||
|
||||
public List<String> children() {
|
||||
return children == null ? List.of() : Collections.unmodifiableList(children);
|
||||
}
|
||||
|
||||
public int childRecursionDepth() {
|
||||
return childRecursionDepth;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.carve;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.LinkedBiomes;
|
||||
import com.volmit.config.MinItems;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The cave biome overrides a dimension declares, written as {@code "carving": [...]}, the list of {@link CarvingEntry}s.
|
||||
* The biome of every enabled entry takes part in the pack's layout like any biome the dimension reaches.
|
||||
*/
|
||||
@Desc("Dimension-level cave biome carving overrides with absolute world Y ranges")
|
||||
@Feature(id = "iris:carve/bands", name = "Cave biome bands", key = "carving", root = "entries", targets = Target.DIMENSION)
|
||||
public final class CarvingSettings implements IrisFeature, LinkedBiomes {
|
||||
@MinItems(1)
|
||||
@Desc("Dimension-level cave biome carving overrides with absolute world Y ranges")
|
||||
private List<CarvingEntry> entries = List.of();
|
||||
|
||||
public CarvingSettings() {
|
||||
}
|
||||
|
||||
public CarvingSettings(List<CarvingEntry> entries) {
|
||||
this.entries = List.copyOf(entries);
|
||||
}
|
||||
|
||||
public List<CarvingEntry> entries() {
|
||||
return entries == null ? List.of() : Collections.unmodifiableList(entries);
|
||||
}
|
||||
|
||||
/**
|
||||
* The biome key {@code reference} stands for: the biome of the entry with that id, ignoring surrounding blanks, or
|
||||
* {@code reference} itself when no entry has the id. When several entries share an id the last one counts.
|
||||
*/
|
||||
public String biomeOf(String reference) {
|
||||
CarvingEntry entry = null;
|
||||
for (CarvingEntry candidate : entries()) {
|
||||
if (candidate != null && !candidate.id().isBlank() && candidate.id().trim().equals(reference)) {
|
||||
entry = candidate;
|
||||
}
|
||||
}
|
||||
return entry == null ? reference : entry.biome();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> usedBiomes(Collection<IrisFeature> dimension) {
|
||||
Set<String> biomes = new LinkedHashSet<>();
|
||||
for (CarvingEntry entry : entries()) {
|
||||
if (entry != null && entry.enabled()) {
|
||||
biomes.add(entry.biome());
|
||||
}
|
||||
}
|
||||
return biomes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.carve;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
/** A biome's {@code caveMinDepthBelowSurface}, written as the bare number of blocks. */
|
||||
@Desc("Minimum depth below terrain surface required before this cave biome can be selected.")
|
||||
@Feature(id = "iris:carve/min-depth", name = "Cave minimum depth", key = "caveMinDepthBelowSurface", root = "depth", targets = Target.BIOME)
|
||||
public final class CaveDepthSettings implements IrisFeature {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(256)
|
||||
@Desc("Minimum depth below terrain surface required before this cave biome can be selected.")
|
||||
private int depth = 0;
|
||||
|
||||
public CaveDepthSettings() {
|
||||
}
|
||||
|
||||
public CaveDepthSettings(int depth) {
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
public int depth() {
|
||||
return depth;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,10 @@
|
||||
package art.arcane.iris.builtin.carve;
|
||||
|
||||
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
@@ -35,11 +38,13 @@ import java.util.Optional;
|
||||
/**
|
||||
* A 3D cave profile as packs write it for a dimension, region or biome ({@code caveProfile}) or under
|
||||
* {@code snippet/cave-profile/}: the noise fields that decide where caves are, how they meet the surface, where
|
||||
* cave fluid may sit and how objects find anchors in them. IrisApi types only; the carving module builds the noise.
|
||||
* cave fluid may sit and how objects find anchors in them. A level that writes none has no profile, which is the
|
||||
* same as one that is not {@code enabled}. IrisApi types only; the carving module builds the noise.
|
||||
*/
|
||||
@Snippet("cave-profile")
|
||||
@Desc("Represents a configurable 3D cave profile.")
|
||||
public final class CaveProfile {
|
||||
@Feature(id = "iris:carve/profile", name = "Cave profile", key = "caveProfile", targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
|
||||
public final class CaveProfile implements IrisFeature {
|
||||
@Desc("Enable profile-driven cave carving.")
|
||||
private boolean enabled = false;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.builtin.decorant;
|
||||
|
||||
import art.arcane.iris.builtin.prepare.SlopeClip;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
@@ -60,7 +61,7 @@ public final class Decorator {
|
||||
private List<BlockSpec> blacklist;
|
||||
|
||||
@Desc("The slope at which this decorator can be placed. Range from 0 to 10 by default. Calculated from a 3-block radius from the center of the decorator placement.")
|
||||
private DecoratorSlope slopeCondition = new DecoratorSlope();
|
||||
private SlopeClip slopeCondition = new SlopeClip();
|
||||
|
||||
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
|
||||
private int absoluteMaxStack = 30;
|
||||
@@ -143,8 +144,8 @@ public final class Decorator {
|
||||
return blacklist != null;
|
||||
}
|
||||
|
||||
public DecoratorSlope slopeCondition() {
|
||||
return slopeCondition == null ? new DecoratorSlope() : slopeCondition;
|
||||
public SlopeClip slopeCondition() {
|
||||
return slopeCondition == null ? new SlopeClip() : slopeCondition;
|
||||
}
|
||||
|
||||
public int absoluteMaxStack() {
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.decorant;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
/** The terrain slopes a decorator may be placed on, as packs write it in a decorator's {@code slopeCondition}. */
|
||||
@Desc("Limits placement to a minimum and maximum terrain slope")
|
||||
public final class DecoratorSlope {
|
||||
private static final double UNLIMITED_MINIMUM = 0;
|
||||
private static final double UNLIMITED_MAXIMUM = 10;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The minimum slope for placement")
|
||||
private double minimumSlope = UNLIMITED_MINIMUM;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The maximum slope for placement")
|
||||
private double maximumSlope = UNLIMITED_MAXIMUM;
|
||||
|
||||
public DecoratorSlope() {
|
||||
}
|
||||
|
||||
public double minimumSlope() {
|
||||
return minimumSlope;
|
||||
}
|
||||
|
||||
public double maximumSlope() {
|
||||
return maximumSlope;
|
||||
}
|
||||
|
||||
/** Whether every slope passes: the limits are the defaults, or looser. */
|
||||
public boolean isDefault() {
|
||||
return minimumSlope <= UNLIMITED_MINIMUM && maximumSlope >= UNLIMITED_MAXIMUM;
|
||||
}
|
||||
|
||||
public boolean isValid(double slope) {
|
||||
if (isDefault()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !(minimumSlope > slope) && !(maximumSlope < slope);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.deposit;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* One deposit ore remap rule, an entry of {@code depositVariants}: within a vertical band, ore blocks are rewritten to
|
||||
* alternate blocks. A value of IrisApi types only; {@code ResolvedDepositVariant} resolves the blocks.
|
||||
*/
|
||||
@Snippet("deposit-variant")
|
||||
@Desc("Remaps ore block ids to alternate block ids within a vertical band. Ores declared at dimension, region, and biome scope can be rewritten at placement time (for example, iron_ore -> deepslate_iron_ore inside a deep carving band, or yourmod:iron -> yourmod:moon_iron inside a lunar biome).")
|
||||
public final class DepositVariant {
|
||||
@Required
|
||||
@MinNumber(-2048)
|
||||
@MaxNumber(8192)
|
||||
@Desc("Inclusive minimum world Y this variant applies at.")
|
||||
private int minHeight = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(-2048)
|
||||
@MaxNumber(8192)
|
||||
@Desc("Inclusive maximum world Y this variant applies at.")
|
||||
private int maxHeight = 0;
|
||||
|
||||
@Required
|
||||
@Desc("Source block id (for example `minecraft:iron_ore`) -> replacement block id (for example `minecraft:deepslate_iron_ore`). Any block id the data loader resolves is accepted, including external/mod blocks. Source match is by material only, so block properties on the source key are ignored.")
|
||||
private Map<String, String> remap = Map.of();
|
||||
|
||||
public DepositVariant() {
|
||||
}
|
||||
|
||||
public int minHeight() {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
public int maxHeight() {
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
public Map<String, String> remap() {
|
||||
return remap == null ? Map.of() : Collections.unmodifiableMap(remap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.deposit;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MinItems;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The deposit ore remap rules one dimension, region or biome declares, written as {@code "depositVariants": [...]}, the list
|
||||
* of {@link DepositVariant}s. The biome's rules apply first, then the region's, then the dimension's; the first matching rule wins.
|
||||
*/
|
||||
@Desc("Deposit ore remap rules. Each entry declares a vertical band and a source->replacement block id map. Applied biome first, then region, then dimension; first matching rule wins.")
|
||||
@Feature(id = "iris:deposit/variants", name = "Deposit variants", key = "depositVariants", root = "variants",
|
||||
targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
|
||||
public final class DepositVariantSettings implements IrisFeature {
|
||||
@MinItems(1)
|
||||
@Desc("Deposit ore remap rules. Each entry declares a vertical band and a source->replacement block id map. Applied biome first, then region, then dimension; first matching rule wins.")
|
||||
private List<DepositVariant> variants = List.of();
|
||||
|
||||
public DepositVariantSettings() {
|
||||
}
|
||||
|
||||
public DepositVariantSettings(List<DepositVariant> variants) {
|
||||
this.variants = List.copyOf(variants);
|
||||
}
|
||||
|
||||
public List<DepositVariant> variants() {
|
||||
return variants == null ? List.of() : Collections.unmodifiableList(variants);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.deposit;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
/** A biome's {@code oreDepositFrequencyMultiplier}, written as the bare number. */
|
||||
@Desc("Multiplier applied to the frequency of every ore deposit whose center is inside this biome. A value of 0.4 keeps 40% of ore veins while leaving non-ore deposits unchanged.")
|
||||
@Feature(id = "iris:deposit/ore-frequency", name = "Ore deposit frequency", key = "oreDepositFrequencyMultiplier", root = "multiplier", targets = Target.BIOME)
|
||||
public final class OreFrequencySettings implements IrisFeature {
|
||||
private static final double UNCHANGED = 1D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Multiplier applied to the frequency of every ore deposit whose center is inside this biome. A value of 0.4 keeps 40% of ore veins while leaving non-ore deposits unchanged.")
|
||||
private double multiplier = UNCHANGED;
|
||||
|
||||
public OreFrequencySettings() {
|
||||
}
|
||||
|
||||
public OreFrequencySettings(double multiplier) {
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public double multiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.deposit;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
/** A biome's {@code oreDepositSizeMultiplier}, written as the bare number. */
|
||||
@Desc("Multiplier applied to the block count of every ore deposit whose center is inside this biome. Non-ore deposits are unchanged.")
|
||||
@Feature(id = "iris:deposit/ore-size", name = "Ore deposit size", key = "oreDepositSizeMultiplier", root = "multiplier", targets = Target.BIOME)
|
||||
public final class OreSizeSettings implements IrisFeature {
|
||||
private static final double UNCHANGED = 1D;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(16)
|
||||
@Desc("Multiplier applied to the block count of every ore deposit whose center is inside this biome. Non-ore deposits are unchanged.")
|
||||
private double multiplier = UNCHANGED;
|
||||
|
||||
public OreSizeSettings() {
|
||||
}
|
||||
|
||||
public OreSizeSettings(double multiplier) {
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public double multiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.builtin.floating;
|
||||
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
||||
import art.arcane.iris.builtin.terrain.PaletteLayer;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
@@ -149,7 +149,7 @@ public final class FloatingChildBiome {
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("Custom palette layers used near the underside when bottomPaletteMode=CUSTOM. The layer format is the same as normal biome layers.")
|
||||
private List<IrisBiomePaletteLayer> bottomPalette = List.of();
|
||||
private List<PaletteLayer> bottomPalette = List.of();
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(512)
|
||||
@@ -315,7 +315,7 @@ public final class FloatingChildBiome {
|
||||
return bottomPaletteMode == null ? FloatingBottomPaletteMode.DEPTH : bottomPaletteMode;
|
||||
}
|
||||
|
||||
public List<IrisBiomePaletteLayer> bottomPalette() {
|
||||
public List<PaletteLayer> bottomPalette() {
|
||||
return bottomPalette == null ? List.of() : Collections.unmodifiableList(bottomPalette);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.floating;
|
||||
|
||||
import art.arcane.iris.builtin.carve.CarvingSettings;
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.LinkedBiomes;
|
||||
import com.volmit.config.MinItems;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The floating child biomes one biome declares, written as {@code "floatingChildBiomes": [...]}, the list of
|
||||
* {@link FloatingChildBiome}s. The target biome of every child, and the biome its {@code carving} names, take part in the
|
||||
* pack's layout like any biome a dimension reaches.
|
||||
*/
|
||||
@Desc("Floating child biomes that procedurally generate above this biome's terrain. Each entry references a target biome whose layers, decorators, and objects drive the floating island's visual design, while the config here drives size, shape, altitude, rarity, and water level. Multiple entries are supported and selected by rarity per column unless mergeFloatingChildBiomes is enabled.")
|
||||
@Feature(id = "iris:floating/children", name = "Floating child biomes", key = "floatingChildBiomes", root = "children", targets = Target.BIOME)
|
||||
public final class FloatingChildSettings implements IrisFeature, LinkedBiomes {
|
||||
@MinItems(1)
|
||||
@Desc("Floating child biomes that procedurally generate above this biome's terrain. Each entry references a target biome whose layers, decorators, and objects drive the floating island's visual design, while the config here drives size, shape, altitude, rarity, and water level. Multiple entries are supported and selected by rarity per column unless mergeFloatingChildBiomes is enabled.")
|
||||
private List<FloatingChildBiome> children = List.of();
|
||||
|
||||
public FloatingChildSettings() {
|
||||
}
|
||||
|
||||
public FloatingChildSettings(List<FloatingChildBiome> children) {
|
||||
this.children = List.copyOf(children);
|
||||
}
|
||||
|
||||
public List<FloatingChildBiome> children() {
|
||||
return children == null ? List.of() : Collections.unmodifiableList(children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> usedBiomes(Collection<IrisFeature> dimension) {
|
||||
CarvingSettings carving = dimension.stream().filter(CarvingSettings.class::isInstance).map(CarvingSettings.class::cast).findFirst().orElse(null);
|
||||
Set<String> biomes = new LinkedHashSet<>();
|
||||
for (FloatingChildBiome child : children()) {
|
||||
if (child != null) {
|
||||
biomes.add(child.biome());
|
||||
biomes.add(carving == null ? child.carving() : carving.biomeOf(child.carving()));
|
||||
}
|
||||
}
|
||||
return biomes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.floating;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** A biome's {@code mergeFloatingChildBiomes}, written as the bare boolean. */
|
||||
@Desc("When true, every floating child entry is sampled independently and their solid masks are unioned, so multiple floating islands can stack, overlap, and collide instead of the picker choosing only one child per column.")
|
||||
@Feature(id = "iris:floating/merge", name = "Merge floating child biomes", key = "mergeFloatingChildBiomes", root = "merge", targets = Target.BIOME)
|
||||
public final class MergeFloatingChildrenSettings implements IrisFeature {
|
||||
@Desc("When true, every floating child entry is sampled independently and their solid masks are unioned, so multiple floating islands can stack, overlap, and collide instead of the picker choosing only one child per column.")
|
||||
private boolean merge = false;
|
||||
|
||||
public MergeFloatingChildrenSettings() {
|
||||
}
|
||||
|
||||
public MergeFloatingChildrenSettings(boolean merge) {
|
||||
this.merge = merge;
|
||||
}
|
||||
|
||||
public boolean merge() {
|
||||
return merge;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("block-drops")
|
||||
@Desc("Represents a block drop list")
|
||||
public final class BlockDrop {
|
||||
@Required
|
||||
@MinItems(1)
|
||||
@Desc("The blocks that drop loot")
|
||||
private List<BlockSpec> blocks = List.of();
|
||||
|
||||
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
|
||||
private boolean exactBlocks = false;
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("Add in specific items to drop")
|
||||
private List<LootEntry> drops = List.of();
|
||||
|
||||
@Desc("If this is in a biome, setting skipParents to true will ignore the drops in the region and dimension for this block type. The default (false) will allow all three nodes to fire and add to a list of drops.")
|
||||
private boolean skipParents = false;
|
||||
|
||||
@Desc("Removes the default vanilla block drops and only drops the given items & any parent loot tables specified for this block type.")
|
||||
private boolean replaceVanillaDrops = false;
|
||||
|
||||
public BlockDrop() {
|
||||
}
|
||||
|
||||
public List<BlockSpec> blocks() {
|
||||
return blocks == null ? List.of() : Collections.unmodifiableList(blocks);
|
||||
}
|
||||
|
||||
public boolean exactBlocks() {
|
||||
return exactBlocks;
|
||||
}
|
||||
|
||||
public List<LootEntry> drops() {
|
||||
return drops == null ? List.of() : Collections.unmodifiableList(drops);
|
||||
}
|
||||
|
||||
public boolean skipParents() {
|
||||
return skipParents;
|
||||
}
|
||||
|
||||
public boolean replaceVanillaDrops() {
|
||||
return replaceVanillaDrops;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MinItems;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The block drops one dimension, region or biome declares, written as {@code "blockDrops": [...]}, the list of
|
||||
* {@link BlockDrop}s. A broken block drops those of its biome, then, unless one of them skips its parents, those of its
|
||||
* region and dimension.
|
||||
*/
|
||||
@Desc("Define custom block drops for this area")
|
||||
@Feature(id = "iris:loot/drops", name = "Block drops", key = "blockDrops", root = "drops", targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
|
||||
public final class BlockDropSettings implements IrisFeature {
|
||||
@MinItems(1)
|
||||
@Desc("Define custom block drops for this area")
|
||||
private List<BlockDrop> drops = List.of();
|
||||
|
||||
public BlockDropSettings() {
|
||||
}
|
||||
|
||||
public List<BlockDrop> drops() {
|
||||
return drops == null ? List.of() : Collections.unmodifiableList(drops);
|
||||
}
|
||||
}
|
||||
+34
-22
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,32 +16,21 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("attribute-modifier")
|
||||
@Accessors(chain = true)
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Desc("Represents an attribute modifier for an item or an entity. This allows you to create modifications to basic game attributes such as MAX_HEALTH or ARMOR_VALUE.")
|
||||
@Data
|
||||
public class IrisAttributeModifier {
|
||||
public final class ItemAttributeModifier {
|
||||
@Required
|
||||
@Desc("The Attribute type key such as max_health or minecraft:armor. This type is pulled from the game attributes. Zombie & Horse attributes will not work on non-zombie/horse entities.\nUsing an attribute on an item will have affects when held, or worn. There is no way to specify further granularity as the game picks this depending on the item type.")
|
||||
private String attribute = null;
|
||||
|
||||
@MinNumber(2)
|
||||
@Required
|
||||
@Desc("The Attribute Name is used internally only for the game. This value should be unique to all other attributes applied to this item/entity. It is not shown in game.")
|
||||
private String name = "";
|
||||
@@ -60,7 +49,30 @@ public class IrisAttributeModifier {
|
||||
@Desc("The chance that this attribute is applied (0 to 1). If the chance is 0.5 (50%), then Iris will only apply this attribute 50% of the time.")
|
||||
private double chance = 1;
|
||||
|
||||
public double getAmount(RNG rng) {
|
||||
return rng.d(getMinAmount(), getMaxAmount());
|
||||
public ItemAttributeModifier() {
|
||||
}
|
||||
|
||||
public String attribute() {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String operation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public double minAmount() {
|
||||
return minAmount;
|
||||
}
|
||||
|
||||
public double maxAmount() {
|
||||
return maxAmount;
|
||||
}
|
||||
|
||||
public double chance() {
|
||||
return chance;
|
||||
}
|
||||
}
|
||||
+29
-26
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,33 +16,21 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
|
||||
import art.arcane.iris.engine.framework.LootResolver;
|
||||
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.RegistryListEnchantment;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("enchantment")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents an enchantment & level")
|
||||
@Data
|
||||
public class IrisEnchantment {
|
||||
public final class LootEnchantment {
|
||||
@Required
|
||||
@RegistryListEnchantment
|
||||
@Ref(Reference.ENCHANTMENT)
|
||||
@Desc("The enchantment")
|
||||
private String enchantment;
|
||||
|
||||
@@ -59,7 +47,22 @@ public class IrisEnchantment {
|
||||
@Desc("The chance that this enchantment is applied (0 to 1)")
|
||||
private double chance = 1;
|
||||
|
||||
public int getLevel(RNG rng) {
|
||||
return LootResolver.inclusive(rng, getMinLevel(), getMaxLevel());
|
||||
public LootEnchantment() {
|
||||
}
|
||||
|
||||
public String enchantment() {
|
||||
return enchantment;
|
||||
}
|
||||
|
||||
public int minLevel() {
|
||||
return minLevel;
|
||||
}
|
||||
|
||||
public int maxLevel() {
|
||||
return maxLevel;
|
||||
}
|
||||
|
||||
public double chance() {
|
||||
return chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Snippet("loot")
|
||||
@Desc("Represents a loot entry")
|
||||
public final class LootEntry {
|
||||
public static final int MAX_AMOUNT = 64;
|
||||
|
||||
@Desc("The target inventory slot types to fill this loot with. World generation only ever fills STORAGE; the other values are inert during worldgen.")
|
||||
private LootSlot slotTypes = LootSlot.STORAGE;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The sub rarity of this loot. Calculated after this loot table has been picked.")
|
||||
private int rarity = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(MAX_AMOUNT)
|
||||
@Desc("Minimum amount of this loot, from 1 to 64")
|
||||
private int minAmount = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(MAX_AMOUNT)
|
||||
@Desc("Maximum amount of this loot, from 1 to 64")
|
||||
private int maxAmount = 1;
|
||||
|
||||
@Desc("The display name of this item")
|
||||
private String displayName = null;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Minimum durability percent")
|
||||
private double minDurability = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Maximum durability percent")
|
||||
private double maxDurability = 1;
|
||||
|
||||
@Desc("Define a custom model identifier 1.14+ only")
|
||||
private Integer customModel = null;
|
||||
|
||||
@Desc("Set this to true to prevent it from being broken")
|
||||
private boolean unbreakable = false;
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("The item flags to add")
|
||||
private List<String> itemFlags = List.of();
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("Apply enchantments to this item")
|
||||
private List<LootEnchantment> enchantments = List.of();
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("Apply attribute modifiers to this item")
|
||||
private List<ItemAttributeModifier> attributes = List.of();
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("Add lore to this item")
|
||||
private List<String> lore = List.of();
|
||||
|
||||
@Ref(Reference.ITEM)
|
||||
@Required
|
||||
@Desc("This is the item or block type. Does not accept minecraft:*, only materials such as DIAMOND_SWORD or DIRT. The exception are modded materials, as they require a namespace.")
|
||||
private String type = "";
|
||||
|
||||
@Desc("The dye color")
|
||||
private String dyeColor = null;
|
||||
|
||||
@Desc("The leather armor color")
|
||||
private String leatherColor = null;
|
||||
|
||||
@Desc("Defines a custom NBT Tag for the item.")
|
||||
private Map<String, Object> customNbt;
|
||||
|
||||
public LootEntry() {
|
||||
}
|
||||
|
||||
public LootSlot slotTypes() {
|
||||
return slotTypes == null ? LootSlot.STORAGE : slotTypes;
|
||||
}
|
||||
|
||||
public int rarity() {
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public int minAmount() {
|
||||
return minAmount;
|
||||
}
|
||||
|
||||
public int maxAmount() {
|
||||
return maxAmount;
|
||||
}
|
||||
|
||||
public String displayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public double minDurability() {
|
||||
return minDurability;
|
||||
}
|
||||
|
||||
public double maxDurability() {
|
||||
return maxDurability;
|
||||
}
|
||||
|
||||
public Integer customModel() {
|
||||
return customModel;
|
||||
}
|
||||
|
||||
public boolean unbreakable() {
|
||||
return unbreakable;
|
||||
}
|
||||
|
||||
public List<String> itemFlags() {
|
||||
return listOrEmpty(itemFlags);
|
||||
}
|
||||
|
||||
public List<LootEnchantment> enchantments() {
|
||||
return listOrEmpty(enchantments);
|
||||
}
|
||||
|
||||
public List<ItemAttributeModifier> attributes() {
|
||||
return listOrEmpty(attributes);
|
||||
}
|
||||
|
||||
public List<String> lore() {
|
||||
return listOrEmpty(lore);
|
||||
}
|
||||
|
||||
/** The authored item key, exactly as written in the pack. Each platform resolves it against its own item registry. */
|
||||
public String type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String dyeColor() {
|
||||
return dyeColor;
|
||||
}
|
||||
|
||||
public String leatherColor() {
|
||||
return leatherColor;
|
||||
}
|
||||
|
||||
/** The custom data of the item; empty when unset. */
|
||||
public Map<String, Object> customNbt() {
|
||||
return customNbt == null ? Map.of() : Collections.unmodifiableMap(customNbt);
|
||||
}
|
||||
|
||||
private static <T> List<T> listOrEmpty(List<T> list) {
|
||||
return list == null ? List.of() : Collections.unmodifiableList(list);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,12 +16,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("A loot mode is used to describe what to do with the existing loot layers before adding this loot. ADD appends to the building list of tables (dimension tables, then region tables, then biome tables). REPLACE swaps the parent tables for this reference's tables. CLEAR suppresses loot entirely at this point.")
|
||||
public enum IrisLootMode {
|
||||
public enum LootMode {
|
||||
@Desc("Add to the existing parent loot tables")
|
||||
ADD,
|
||||
@Desc("Clear all parent loot tables and contribute nothing at this level. Any tables listed here are ignored.")
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The loot tables one dimension, region or biome adds to the containers it covers, written as
|
||||
* {@code "loot": {"mode": "ADD", "tables": [...], "multiplier": 1}}. Levels stack, dimension first, then region and
|
||||
* biome; {@link LootMode} says what each does with the tables before it. An entity's {@code loot} has the same shape.
|
||||
*/
|
||||
@Snippet("loot-registry")
|
||||
@Desc("Reference loot tables in this area")
|
||||
@Feature(id = "iris:loot", name = "Loot", key = "loot", targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
|
||||
public final class LootSettings implements IrisFeature {
|
||||
public static final double MAX_MULTIPLIER = 16D;
|
||||
|
||||
@Desc("ADD = add on top of parent tables. REPLACE = clear parent tables, then add these. CLEAR = clear parent tables and add nothing, even if tables are listed. FALLBACK = only used when nothing else defined a table.")
|
||||
private LootMode mode = LootMode.ADD;
|
||||
|
||||
@ResourceRef(LootTable.class)
|
||||
@Desc("Add loot table registries here")
|
||||
private List<String> tables = List.of();
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(MAX_MULTIPLIER)
|
||||
@Desc("Scale loot sources in this area from 0 to 16 times their normal count")
|
||||
private double multiplier = 1D;
|
||||
|
||||
/** Nothing added, nothing scaled: what a level without loot settings means. */
|
||||
public LootSettings() {
|
||||
}
|
||||
|
||||
public LootMode mode() {
|
||||
return mode == null ? LootMode.ADD : mode;
|
||||
}
|
||||
|
||||
/** The keys of the loot tables, in order. */
|
||||
public List<String> tables() {
|
||||
return tables == null ? List.of() : Collections.unmodifiableList(tables);
|
||||
}
|
||||
|
||||
public double multiplier() {
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,12 +16,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("An inventory slot type is used to represent a type of slot for items to fit into in any given inventory.")
|
||||
public enum InventorySlotType {
|
||||
public enum LootSlot {
|
||||
@Desc("Typically the one you want to go with. Storage represnents most slots in inventories.")
|
||||
STORAGE,
|
||||
|
||||
+38
-30
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,34 +16,25 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
package art.arcane.iris.builtin.loot;
|
||||
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** A loot table of the pack, one file of {@code loot/}. */
|
||||
@Desc("Represents a loot table. Biomes, Regions & Objects can add or replace the virtual table with these loot tables")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisLootTable extends IrisRegistrant {
|
||||
public final class LootTable {
|
||||
public static final int MAX_PICKED = 64;
|
||||
public static final int MAX_TRIES = 256;
|
||||
|
||||
@Required
|
||||
@Desc("The name of this loot table")
|
||||
@MinNumber(2)
|
||||
private String name = "";
|
||||
|
||||
@MinNumber(1)
|
||||
@@ -65,17 +56,34 @@ public class IrisLootTable extends IrisRegistrant {
|
||||
@Desc("The maximum amount of tries to generate loot, from 1 to 256")
|
||||
private int maxTries = 10;
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("The loot in this table")
|
||||
@ArrayType(min = 1, type = IrisLoot.class)
|
||||
private KList<IrisLoot> loot = new KList<>();
|
||||
private List<LootEntry> loot = List.of();
|
||||
|
||||
@Override
|
||||
public String getFolderName() {
|
||||
return "loot";
|
||||
public LootTable() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return "Loot";
|
||||
public String name() {
|
||||
return name == null ? "" : name;
|
||||
}
|
||||
|
||||
public int rarity() {
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public int maxPicked() {
|
||||
return maxPicked;
|
||||
}
|
||||
|
||||
public int minPicked() {
|
||||
return minPicked;
|
||||
}
|
||||
|
||||
public int maxTries() {
|
||||
return maxTries;
|
||||
}
|
||||
|
||||
public List<LootEntry> loot() {
|
||||
return loot == null ? List.of() : Collections.unmodifiableList(loot);
|
||||
}
|
||||
}
|
||||
@@ -27,9 +27,10 @@
|
||||
* subpackage per built-in module, named after the module path, such as {@code art.arcane.iris.builtin.deposit}
|
||||
* for {@code iris:deposit}.
|
||||
* <p>
|
||||
* Besides those, it holds narrow facades only Iris's own built-ins use, interfaces Iris's worlds implement, for what
|
||||
* they need from Iris's internals and no pack module does: {@link art.arcane.iris.builtin.IrisSeed}, and the transitional
|
||||
* {@link art.arcane.iris.builtin.PendingSettings}. Keep them few: each is a promise.
|
||||
* Besides those, it holds what the compiled-in built-ins and the built-ins jar must share, since each sees its own copy
|
||||
* of every other class: narrow facades only Iris's own built-ins use, interfaces Iris's worlds implement
|
||||
* ({@link art.arcane.iris.builtin.IrisSeed}), and per-world state several of them use
|
||||
* ({@link art.arcane.iris.builtin.terrain.LayerBlocks}). Keep them few: each is a promise.
|
||||
* <p>
|
||||
* Some built-in stages produce Iris's own types, such as the placement settings of {@code iris:prepare}. A
|
||||
* pack module can require such a stage to run after it, but cannot read its output: the pack load rejects
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.post;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/**
|
||||
* Whether a dimension is post processed, written as {@code "postProcessing": true}. Iris has never read this flag: surface smoothing runs
|
||||
* whatever it says, so it is declared to keep the key valid in packs.
|
||||
*/
|
||||
@Desc("Use post processing or not")
|
||||
@Feature(id = "iris:post/enabled", name = "Post processing", key = "postProcessing", root = "enabled", targets = Target.DIMENSION)
|
||||
public final class PostProcessingSettings implements IrisFeature {
|
||||
public static final boolean DEFAULT_ENABLED = true;
|
||||
|
||||
@Desc("Use post processing or not")
|
||||
private boolean enabled = DEFAULT_ENABLED;
|
||||
|
||||
public PostProcessingSettings() {
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.post;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/**
|
||||
* Whether post processing adds slabs on steps in a dimension, written as {@code "postProcessingSlabs": false}. A dimension without the key adds them.
|
||||
*/
|
||||
@Desc("Add slabs in post processing")
|
||||
@Feature(id = "iris:post/slabs", name = "Post processing slabs", key = "postProcessingSlabs", root = "enabled", targets = Target.DIMENSION)
|
||||
public final class PostProcessingSlabsSettings implements IrisFeature {
|
||||
public static final boolean DEFAULT_ENABLED = true;
|
||||
|
||||
@Desc("Add slabs in post processing")
|
||||
private boolean enabled = DEFAULT_ENABLED;
|
||||
|
||||
public PostProcessingSlabsSettings() {
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.post;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/**
|
||||
* Whether post processing paints walls on steep faces in a dimension, written as {@code "postProcessingWalls": false}. A dimension without the key paints them.
|
||||
*/
|
||||
@Desc("Add painted walls in post processing")
|
||||
@Feature(id = "iris:post/walls", name = "Post processing walls", key = "postProcessingWalls", root = "enabled", targets = Target.DIMENSION)
|
||||
public final class PostProcessingWallsSettings implements IrisFeature {
|
||||
public static final boolean DEFAULT_ENABLED = true;
|
||||
|
||||
@Desc("Add painted walls in post processing")
|
||||
private boolean enabled = DEFAULT_ENABLED;
|
||||
|
||||
public PostProcessingWallsSettings() {
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/** The terrain slopes a placement or decorator may sit on, written as its {@code slopeCondition}. */
|
||||
/** The terrain slopes an object placement, a decorator or a terrain layer may sit on, written as its {@code slopeCondition}. */
|
||||
@Snippet("slope-clip")
|
||||
@Desc("Limits placement to a minimum and maximum terrain slope")
|
||||
public final class SlopeClip {
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
/**
|
||||
* A sound, particles, potion effect or commands that play now and then around the players in an area. The same
|
||||
* settings make the effect an entity shows when it appears ({@link EntityDefinition#spawnEffect()}).
|
||||
*/
|
||||
@Snippet("effect")
|
||||
@Desc("An iris effect")
|
||||
public final class AmbientEffect {
|
||||
@Ref(Reference.POTION_EFFECT)
|
||||
@Desc("The potion effect to apply in this area")
|
||||
private String potionEffect = "";
|
||||
|
||||
@Desc("The particle effect to apply in the area")
|
||||
private String particleEffect = null;
|
||||
|
||||
@MinNumber(-32)
|
||||
@MaxNumber(32)
|
||||
@Desc("Randomly offset from the surface to this surface+value")
|
||||
private int particleOffset = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltX = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltY = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltZ = 0;
|
||||
|
||||
@Desc("Randomize the altX by -altX to altX")
|
||||
private boolean randomAltX = true;
|
||||
|
||||
@Desc("Randomize the altY by -altY to altY")
|
||||
private boolean randomAltY = false;
|
||||
|
||||
@Desc("Randomize the altZ by -altZ to altZ")
|
||||
private boolean randomAltZ = true;
|
||||
|
||||
@Desc("The sound to play")
|
||||
private String sound = null;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(512)
|
||||
@Desc("The max distance from the player the sound will play")
|
||||
private int soundDistance = 12;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.99)
|
||||
@Desc("The minimum sound pitch")
|
||||
private double minPitch = 0.5D;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.99)
|
||||
@Desc("The max sound pitch")
|
||||
private double maxPitch = 1.5D;
|
||||
|
||||
@MinNumber(0.001)
|
||||
@MaxNumber(512)
|
||||
@Desc("The sound volume.")
|
||||
private double volume = 1.5D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(512)
|
||||
@Desc("The particle count. Try setting to zero for using the alt xyz to a motion value instead of an offset")
|
||||
private int particleCount = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("How far away from the player particles can play")
|
||||
private int particleDistance = 20;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@Desc("How wide the particles can play (player's view left and right) RADIUS")
|
||||
private int particleDistanceWidth = 24;
|
||||
|
||||
@Desc("An extra value for some particles... Which bukkit doesn't even document.")
|
||||
private double extra = 0;
|
||||
|
||||
@MinNumber(-1)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The Potion Strength or -1 to disable")
|
||||
private int potionStrength = -1;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The max time the potion will last for")
|
||||
private int potionTicksMax = 155;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The min time the potion will last for")
|
||||
private int potionTicksMin = 75;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@Desc("The effect interval in milliseconds")
|
||||
private int interval = 150;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(16)
|
||||
@Desc("The effect distance start away")
|
||||
private int particleAway = 5;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@Desc("The chance is 1 in CHANCE per interval")
|
||||
private int chance = 50;
|
||||
|
||||
@Desc("Run commands, with configurable location parameters")
|
||||
private EffectCommands commandRegistry = null;
|
||||
|
||||
public AmbientEffect() {
|
||||
}
|
||||
|
||||
public String potionEffect() {
|
||||
return potionEffect;
|
||||
}
|
||||
|
||||
public String particleEffect() {
|
||||
return particleEffect;
|
||||
}
|
||||
|
||||
public int particleOffset() {
|
||||
return particleOffset;
|
||||
}
|
||||
|
||||
public double particleAltX() {
|
||||
return particleAltX;
|
||||
}
|
||||
|
||||
public double particleAltY() {
|
||||
return particleAltY;
|
||||
}
|
||||
|
||||
public double particleAltZ() {
|
||||
return particleAltZ;
|
||||
}
|
||||
|
||||
public boolean randomAltX() {
|
||||
return randomAltX;
|
||||
}
|
||||
|
||||
public boolean randomAltY() {
|
||||
return randomAltY;
|
||||
}
|
||||
|
||||
public boolean randomAltZ() {
|
||||
return randomAltZ;
|
||||
}
|
||||
|
||||
public String sound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
public int soundDistance() {
|
||||
return soundDistance;
|
||||
}
|
||||
|
||||
public double minPitch() {
|
||||
return minPitch;
|
||||
}
|
||||
|
||||
public double maxPitch() {
|
||||
return maxPitch;
|
||||
}
|
||||
|
||||
public double volume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public int particleCount() {
|
||||
return particleCount;
|
||||
}
|
||||
|
||||
public int particleDistance() {
|
||||
return particleDistance;
|
||||
}
|
||||
|
||||
public int particleDistanceWidth() {
|
||||
return particleDistanceWidth;
|
||||
}
|
||||
|
||||
public double extra() {
|
||||
return extra;
|
||||
}
|
||||
|
||||
public int potionStrength() {
|
||||
return potionStrength;
|
||||
}
|
||||
|
||||
public int potionTicksMax() {
|
||||
return potionTicksMax;
|
||||
}
|
||||
|
||||
public int potionTicksMin() {
|
||||
return potionTicksMin;
|
||||
}
|
||||
|
||||
public int interval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public int particleAway() {
|
||||
return particleAway;
|
||||
}
|
||||
|
||||
public int chance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
/** The commands the effect runs; null for none. */
|
||||
public EffectCommands commandRegistry() {
|
||||
return commandRegistry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("command-registry")
|
||||
@Desc("Represents a casting location for a command")
|
||||
public final class EffectCommands {
|
||||
@Required
|
||||
@MinItems(1)
|
||||
@Desc("Run commands, at the exact location of the player")
|
||||
private List<SpawnCommand> rawCommands = List.of();
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetX = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetY = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double commandOffsetZ = 0;
|
||||
|
||||
@Desc("Randomize the altX from -altX to altX")
|
||||
private boolean commandRandomAltX = true;
|
||||
|
||||
@Desc("Randomize the altY from -altY to altY")
|
||||
private boolean commandRandomAltY = false;
|
||||
|
||||
@Desc("Randomize the altZ from -altZ to altZ")
|
||||
private boolean commandRandomAltZ = true;
|
||||
|
||||
@Desc("Randomize location for all separate commands (true), or run all on the same location (false)")
|
||||
private boolean commandAllRandomLocations = true;
|
||||
|
||||
public EffectCommands() {
|
||||
}
|
||||
|
||||
public List<SpawnCommand> rawCommands() {
|
||||
return rawCommands == null ? List.of() : Collections.unmodifiableList(rawCommands);
|
||||
}
|
||||
|
||||
public double commandOffsetX() {
|
||||
return commandOffsetX;
|
||||
}
|
||||
|
||||
public double commandOffsetY() {
|
||||
return commandOffsetY;
|
||||
}
|
||||
|
||||
public double commandOffsetZ() {
|
||||
return commandOffsetZ;
|
||||
}
|
||||
|
||||
public boolean commandRandomAltX() {
|
||||
return commandRandomAltX;
|
||||
}
|
||||
|
||||
public boolean commandRandomAltY() {
|
||||
return commandRandomAltY;
|
||||
}
|
||||
|
||||
public boolean commandRandomAltZ() {
|
||||
return commandRandomAltZ;
|
||||
}
|
||||
|
||||
public boolean commandAllRandomLocations() {
|
||||
return commandAllRandomLocations;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MinItems;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The ambient effects one region or biome declares, written as {@code "effects": [...]}, the list of
|
||||
* {@link AmbientEffect}s. They play around every player in the area.
|
||||
*/
|
||||
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play arround the player even if where the effect was played is no longer in the biome the player is in.")
|
||||
@Feature(id = "iris:spawn/effects", name = "Effects", key = "effects", root = "effects", targets = {Target.REGION, Target.BIOME})
|
||||
public final class EffectSettings implements IrisFeature {
|
||||
@MinItems(1)
|
||||
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player.")
|
||||
private List<AmbientEffect> effects = List.of();
|
||||
|
||||
public EffectSettings() {
|
||||
}
|
||||
|
||||
public List<AmbientEffect> effects() {
|
||||
return effects == null ? List.of() : Collections.unmodifiableList(effects);
|
||||
}
|
||||
}
|
||||
+163
-49
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,34 +16,25 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.entity.spawn.IrisSurface;
|
||||
import art.arcane.iris.engine.object.loot.IrisLoot;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootReference;
|
||||
import art.arcane.iris.engine.object.marker.IrisCommand;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListEntityType;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListSpecialEntity;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import art.arcane.iris.builtin.loot.ItemAttributeModifier;
|
||||
import art.arcane.iris.builtin.loot.LootEntry;
|
||||
import art.arcane.iris.builtin.loot.LootSettings;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.config.Required;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** An entity of the pack, one file of {@code entities/}: what spawners and markers spawn, with its equipment, attributes, passengers and loot. */
|
||||
@Desc("Represents an iris entity.")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisEntity extends IrisRegistrant {
|
||||
public final class EntityDefinition {
|
||||
@Required
|
||||
@RegistryListEntityType
|
||||
@Ref(Reference.ENTITY)
|
||||
@Desc("The namespaced key of the entity type to spawn, such as minecraft:zombie or alexsmobs:grizzly_bear. To spawn a mob from another plugin or provider, set this type to unknown and define the special type.")
|
||||
private String type = null;
|
||||
|
||||
@@ -81,39 +72,39 @@ public class IrisEntity extends IrisRegistrant {
|
||||
private boolean removable = false;
|
||||
|
||||
@Desc("Entity helmet equipment")
|
||||
private IrisLoot helmet = null;
|
||||
private LootEntry helmet = null;
|
||||
|
||||
@Desc("Entity chestplate equipment")
|
||||
private IrisLoot chestplate = null;
|
||||
private LootEntry chestplate = null;
|
||||
|
||||
@Desc("Entity boots equipment")
|
||||
private IrisLoot boots = null;
|
||||
private LootEntry boots = null;
|
||||
|
||||
@Desc("Entity leggings equipment")
|
||||
private IrisLoot leggings = null;
|
||||
private LootEntry leggings = null;
|
||||
|
||||
@Desc("Entity main hand equipment")
|
||||
private IrisLoot mainHand = null;
|
||||
private LootEntry mainHand = null;
|
||||
|
||||
@Desc("Entity off hand equipment")
|
||||
private IrisLoot offHand = null;
|
||||
private LootEntry offHand = null;
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("Make other entities ride this entity")
|
||||
@ArrayType(min = 1, type = IrisEntity.class)
|
||||
private KList<IrisEntity> passengers = new KList<>();
|
||||
private List<EntityDefinition> passengers = List.of();
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("Attribute modifiers for this entity")
|
||||
@ArrayType(min = 1, type = IrisAttributeModifier.class)
|
||||
private KList<IrisAttributeModifier> attributes = new KList<>();
|
||||
private List<ItemAttributeModifier> attributes = List.of();
|
||||
|
||||
@Desc("Loot tables for drops. Only the tables list is honored for entities; mode and multiplier are ignored, and the tables replace vanilla drops entirely.")
|
||||
private IrisLootReference loot = new IrisLootReference();
|
||||
private LootSettings loot = new LootSettings();
|
||||
|
||||
@Desc("If specified, this entity will be leashed by this entity. I.e. THIS ENTITY Leashed by SPECIFIED. This has no effect on EnderDragons, Withers, Players, or Bats.Non-living entities excluding leashes will not persist as leashholders.")
|
||||
private IrisEntity leashHolder = null;
|
||||
private EntityDefinition leashHolder = null;
|
||||
|
||||
@Desc("If specified, this entity will spawn with an effect")
|
||||
private IrisEffect spawnEffect = null;
|
||||
private AmbientEffect spawnEffect = null;
|
||||
|
||||
@Desc("Simply moves the entity from below the surface slowly out of the ground as a spawn-in effect")
|
||||
private boolean spawnEffectRiseOutOfGround = false;
|
||||
@@ -131,30 +122,153 @@ public class IrisEntity extends IrisRegistrant {
|
||||
private boolean keepEntity = false;
|
||||
|
||||
@Desc("The surface type to spawn this mob on")
|
||||
private IrisSurface surface = IrisSurface.LAND;
|
||||
private SpawnSurface surface = SpawnSurface.LAND;
|
||||
|
||||
@RegistryListSpecialEntity
|
||||
@Ref(Reference.SPECIAL_ENTITY)
|
||||
@Desc("Create a mob from another plugin, such as Mythic Mobs. Should be in the format of a namespace of PluginName:MobName")
|
||||
private String specialType = "";
|
||||
|
||||
@Desc("Set to true if you want to apply all of the settings here to the mob, even though an external plugin has already done so.")
|
||||
private boolean applySettingsToCustomMobAnyways = false;
|
||||
|
||||
@ArrayType(min = 1, type = IrisCommand.class)
|
||||
@MinItems(1)
|
||||
@Desc("Run raw commands when this entity is spawned. Use {x}, {y}, and {z} for location. /summon pig {x} {y} {z}")
|
||||
private KList<IrisCommand> rawCommands = new KList<>();
|
||||
private List<SpawnCommand> rawCommands = List.of();
|
||||
|
||||
public EntityDefinition() {
|
||||
}
|
||||
|
||||
public String type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String reason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public String customName() {
|
||||
return customName;
|
||||
}
|
||||
|
||||
public boolean customNameVisible() {
|
||||
return customNameVisible;
|
||||
}
|
||||
|
||||
public boolean aware() {
|
||||
return aware;
|
||||
}
|
||||
|
||||
public boolean ai() {
|
||||
return ai;
|
||||
}
|
||||
|
||||
public boolean glowing() {
|
||||
return glowing;
|
||||
}
|
||||
|
||||
public boolean gravity() {
|
||||
return gravity;
|
||||
}
|
||||
|
||||
public boolean invulnerable() {
|
||||
return invulnerable;
|
||||
}
|
||||
|
||||
public boolean silent() {
|
||||
return silent;
|
||||
}
|
||||
|
||||
public boolean pickupItems() {
|
||||
return pickupItems;
|
||||
}
|
||||
|
||||
public boolean removable() {
|
||||
return removable;
|
||||
}
|
||||
|
||||
public LootEntry helmet() {
|
||||
return helmet;
|
||||
}
|
||||
|
||||
public LootEntry chestplate() {
|
||||
return chestplate;
|
||||
}
|
||||
|
||||
public LootEntry boots() {
|
||||
return boots;
|
||||
}
|
||||
|
||||
public LootEntry leggings() {
|
||||
return leggings;
|
||||
}
|
||||
|
||||
public LootEntry mainHand() {
|
||||
return mainHand;
|
||||
}
|
||||
|
||||
public LootEntry offHand() {
|
||||
return offHand;
|
||||
}
|
||||
|
||||
public List<EntityDefinition> passengers() {
|
||||
return passengers == null ? List.of() : Collections.unmodifiableList(passengers);
|
||||
}
|
||||
|
||||
public List<ItemAttributeModifier> attributes() {
|
||||
return attributes == null ? List.of() : Collections.unmodifiableList(attributes);
|
||||
}
|
||||
|
||||
/** The loot the entity drops when it dies; only its tables count. */
|
||||
public LootSettings loot() {
|
||||
return loot == null ? new LootSettings() : loot;
|
||||
}
|
||||
|
||||
public EntityDefinition leashHolder() {
|
||||
return leashHolder;
|
||||
}
|
||||
|
||||
public AmbientEffect spawnEffect() {
|
||||
return spawnEffect;
|
||||
}
|
||||
|
||||
public boolean spawnEffectRiseOutOfGround() {
|
||||
return spawnEffectRiseOutOfGround;
|
||||
}
|
||||
|
||||
public String pandaMainGene() {
|
||||
return pandaMainGene;
|
||||
}
|
||||
|
||||
public String pandaHiddenGene() {
|
||||
return pandaHiddenGene;
|
||||
}
|
||||
|
||||
public boolean baby() {
|
||||
return baby;
|
||||
}
|
||||
|
||||
public boolean keepEntity() {
|
||||
return keepEntity;
|
||||
}
|
||||
|
||||
public SpawnSurface surface() {
|
||||
return surface == null ? SpawnSurface.LAND : surface;
|
||||
}
|
||||
|
||||
public String specialType() {
|
||||
return specialType;
|
||||
}
|
||||
|
||||
/** Whether the entity is a mob of another plugin. */
|
||||
public boolean isSpecialType() {
|
||||
return specialType != null && !specialType.equals("");
|
||||
return specialType != null && !specialType.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFolderName() {
|
||||
return "entities";
|
||||
public boolean applySettingsToCustomMobAnyways() {
|
||||
return applySettingsToCustomMobAnyways;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return "Entity";
|
||||
public List<SpawnCommand> rawCommands() {
|
||||
return rawCommands == null ? List.of() : Collections.unmodifiableList(rawCommands);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.ResourceRef;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("entity-spawn")
|
||||
@Desc("Represents an entity spawn during initial chunk generation")
|
||||
public final class EntitySpawn {
|
||||
@ResourceRef(EntityDefinition.class)
|
||||
@Required
|
||||
@Desc("The entity")
|
||||
private String entity = "";
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The 1 in RARITY chance for this entity to spawn")
|
||||
private int rarity = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The minumum of this entity to spawn")
|
||||
private int minSpawns = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The max of this entity to spawn")
|
||||
private int maxSpawns = 1;
|
||||
|
||||
public EntitySpawn() {
|
||||
}
|
||||
|
||||
/** The key of the entity of the pack. */
|
||||
public String entity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public int rarity() {
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public int minSpawns() {
|
||||
return minSpawns;
|
||||
}
|
||||
|
||||
public int maxSpawns() {
|
||||
return maxSpawns;
|
||||
}
|
||||
}
|
||||
+37
-31
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,32 +16,23 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.marker;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.world.IrisTimeBlock;
|
||||
import art.arcane.iris.engine.object.world.IrisWeather;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.iris.spi.PlatformWorld;
|
||||
import art.arcane.iris.util.common.scheduling.ConsoleCommands;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("command")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@Desc("Represents a set of Iris commands")
|
||||
@Data
|
||||
public class IrisCommand {
|
||||
|
||||
public final class SpawnCommand {
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@MinItems(1)
|
||||
@Desc("List of commands. Iris replaces {x} {y} and {z} with the location of the entity spawn")
|
||||
private KList<String> commands = new KList<>();
|
||||
private List<String> commands = List.of();
|
||||
|
||||
@Desc("The delay for running the command. Instant by default")
|
||||
private long delay = 0;
|
||||
@@ -53,20 +44,35 @@ public class IrisCommand {
|
||||
private long repeatDelay = 100;
|
||||
|
||||
@Desc("The block of 24 hour time in which the command should execute.")
|
||||
private IrisTimeBlock timeBlock = new IrisTimeBlock();
|
||||
private SpawnTimeBlock timeBlock = new SpawnTimeBlock();
|
||||
|
||||
@Desc("The weather that is required for the command to execute.")
|
||||
private IrisWeather weather = IrisWeather.ANY;
|
||||
private SpawnWeather weather = SpawnWeather.ANY;
|
||||
|
||||
public boolean isValid(PlatformWorld world) {
|
||||
return timeBlock.isWithin(world) && weather.is(world);
|
||||
public SpawnCommand() {
|
||||
}
|
||||
|
||||
public void run(PlatformWorld world, int x, int y, int z) {
|
||||
if (!isValid(world)) {
|
||||
return;
|
||||
}
|
||||
public List<String> commands() {
|
||||
return commands == null ? List.of() : Collections.unmodifiableList(commands);
|
||||
}
|
||||
|
||||
ConsoleCommands.run(commands, delay, repeat, repeatDelay, x, y, z);
|
||||
public long delay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
public boolean repeat() {
|
||||
return repeat;
|
||||
}
|
||||
|
||||
public long repeatDelay() {
|
||||
return repeatDelay;
|
||||
}
|
||||
|
||||
public SpawnTimeBlock timeBlock() {
|
||||
return timeBlock == null ? new SpawnTimeBlock() : timeBlock;
|
||||
}
|
||||
|
||||
public SpawnWeather weather() {
|
||||
return weather == null ? SpawnWeather.ANY : weather;
|
||||
}
|
||||
}
|
||||
+23
-21
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,19 +16,22 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.value;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.format.Form;
|
||||
import lombok.Data;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Snippet("duration")
|
||||
@Data
|
||||
@Desc("Represents a combined duration. Fill each property to add time into a single duration")
|
||||
public class IrisDuration {
|
||||
public final class SpawnDuration {
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_TICK = 50L;
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_HOUR = 50_000L;
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_DAY = 1_200_000L;
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_WEEK = 8_400_000L;
|
||||
private static final long MILLISECONDS_PER_MINECRAFT_LUNAR_CYCLE = 9_600_000L;
|
||||
|
||||
@Desc("Milliseconds (1000ms = 1 second)")
|
||||
private int milliseconds = 0;
|
||||
|
||||
@@ -59,20 +62,19 @@ public class IrisDuration {
|
||||
@Desc("REAL (not minecraft) Days")
|
||||
private int days = 0;
|
||||
|
||||
public String toString() {
|
||||
return Form.duration((double) toMilliseconds(), 2);
|
||||
public SpawnDuration() {
|
||||
}
|
||||
|
||||
public long toMilliseconds() {
|
||||
return getMilliseconds()
|
||||
+ TimeUnit.SECONDS.toMillis(getSeconds())
|
||||
+ TimeUnit.MINUTES.toMillis(getMinutes())
|
||||
+ TimeUnit.HOURS.toMillis(getHours())
|
||||
+ TimeUnit.DAYS.toMillis(getDays())
|
||||
+ (getMinecraftTicks() * 50L)
|
||||
+ (getMinecraftHours() * 50000L)
|
||||
+ (getMinecraftDays() * 1_200_000L)
|
||||
+ (getMinecraftWeeks() * 8_400_000L)
|
||||
+ (getMinecraftLunarCycles() * 9_600_000L);
|
||||
return milliseconds
|
||||
+ TimeUnit.SECONDS.toMillis(seconds)
|
||||
+ TimeUnit.MINUTES.toMillis(minutes)
|
||||
+ TimeUnit.HOURS.toMillis(hours)
|
||||
+ TimeUnit.DAYS.toMillis(days)
|
||||
+ (minecraftTicks * MILLISECONDS_PER_MINECRAFT_TICK)
|
||||
+ (minecraftHours * MILLISECONDS_PER_MINECRAFT_HOUR)
|
||||
+ (minecraftDays * MILLISECONDS_PER_MINECRAFT_DAY)
|
||||
+ (minecraftWeeks * MILLISECONDS_PER_MINECRAFT_WEEK)
|
||||
+ (minecraftLunarCycles * MILLISECONDS_PER_MINECRAFT_LUNAR_CYCLE);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,12 +16,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity.spawn;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Terrain modes are used to decide the generator type currently used")
|
||||
public enum IrisSpawnGroup {
|
||||
public enum SpawnGroup {
|
||||
@Desc("Spawns on the terrain surface")
|
||||
NORMAL,
|
||||
|
||||
+28
-32
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,32 +16,22 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.marker;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListResource;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.ResourceRef;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** A marker of the pack, one file of {@code markers/}: object placements put markers in the world and a marker names the spawners that fire there. */
|
||||
@Desc("Represents a marker")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisMarker extends IrisRegistrant {
|
||||
public final class SpawnMarker {
|
||||
@Desc("A list of spawners to add to anywhere this marker is.")
|
||||
@RegistryListResource(IrisSpawner.class)
|
||||
@ArrayType(type = String.class, min = 1)
|
||||
private KList<String> spawners = new KList<>();
|
||||
@ResourceRef(Spawner.class)
|
||||
@MinItems(1)
|
||||
private List<String> spawners = List.of();
|
||||
|
||||
@Desc("Remove this marker when the block it's assigned to is changed.")
|
||||
private boolean removeOnChange = true;
|
||||
@@ -52,17 +42,23 @@ public class IrisMarker extends IrisRegistrant {
|
||||
@Desc("If this marker is used, what is the chance it removes itself. For example 25% (0.25) would mean that on average 4 uses will remove a specific marker. Set this below 0 (-1) to never exhaust & set this to 1 or higher to always exhaust on first use.")
|
||||
private double exhaustionChance = 0;
|
||||
|
||||
public boolean shouldExhaust() {
|
||||
return exhaustionChance > RNG.r.nextDouble();
|
||||
public SpawnMarker() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFolderName() {
|
||||
return "markers";
|
||||
/** The keys of the spawners that fire at the marker. */
|
||||
public List<String> spawners() {
|
||||
return spawners == null ? List.of() : Collections.unmodifiableList(spawners);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return "Marker";
|
||||
public boolean removeOnChange() {
|
||||
return removeOnChange;
|
||||
}
|
||||
|
||||
public boolean emptyAbove() {
|
||||
return emptyAbove;
|
||||
}
|
||||
|
||||
public double exhaustionChance() {
|
||||
return exhaustionChance;
|
||||
}
|
||||
}
|
||||
+16
-23
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,42 +16,35 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.value;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.format.Form;
|
||||
import art.arcane.volmlib.util.scheduling.ChronoLatch;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("rate")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@Desc("Represents a count of something per time duration")
|
||||
public class IrisRate {
|
||||
public final class SpawnRate {
|
||||
@Desc("The amount of things. Leave 0 for infinite (meaning always spawn whenever)")
|
||||
private int amount = 0;
|
||||
|
||||
@Desc("The time interval. Leave blank for infinite 0 (meaning always spawn all the time)")
|
||||
private IrisDuration per = new IrisDuration();
|
||||
private SpawnDuration per = new SpawnDuration();
|
||||
|
||||
public String toString() {
|
||||
return Form.f(amount) + "/" + per;
|
||||
public SpawnRate() {
|
||||
}
|
||||
|
||||
public long getInterval() {
|
||||
long t = per.toMilliseconds() / (amount == 0 ? 1 : amount);
|
||||
/** The milliseconds between two things: the interval divided by the amount, at least 1. */
|
||||
public long interval() {
|
||||
long t = duration().toMilliseconds() / (amount == 0 ? 1 : amount);
|
||||
return Math.abs(t <= 0 ? 1 : t);
|
||||
}
|
||||
|
||||
public ChronoLatch toChronoLatch() {
|
||||
return new ChronoLatch(getInterval());
|
||||
/** Whether there is no limit: no interval was given. */
|
||||
public boolean isInfinite() {
|
||||
return duration().toMilliseconds() == 0;
|
||||
}
|
||||
|
||||
public boolean isInfinite() {
|
||||
return per.toMilliseconds() == 0;
|
||||
private SpawnDuration duration() {
|
||||
return per == null ? new SpawnDuration() : per;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,12 +16,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity.spawn;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("The type of surface entities should spawn on")
|
||||
public enum IrisSurface {
|
||||
public enum SpawnSurface {
|
||||
|
||||
@Desc("Land surfaces")
|
||||
LAND,
|
||||
@@ -36,5 +36,5 @@ public enum IrisSurface {
|
||||
OVERWORLD,
|
||||
|
||||
@Desc("Within lava")
|
||||
LAVA;
|
||||
LAVA
|
||||
}
|
||||
+12
-13
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,30 +16,29 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.world;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.iris.spi.PlatformWorld;
|
||||
import lombok.Data;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Snippet;
|
||||
|
||||
@Snippet("time-block")
|
||||
@Data
|
||||
@Desc("Represents a time of day (24h time, not 12h am/pm). Set both to the same number for any time. If they are both set to -1, it will always be not allowed.")
|
||||
public class IrisTimeBlock {
|
||||
public final class SpawnTimeBlock {
|
||||
private static final double NEVER = -1;
|
||||
|
||||
@Desc("The beginning hour. Set both to the same number for any time. If they are both set to -1, it will always be not allowed.")
|
||||
private double startHour = 0;
|
||||
|
||||
@Desc("The ending hour. Set both to the same number for any time. If they are both set to -1, it will always be not allowed.")
|
||||
private double endHour = 0;
|
||||
|
||||
public boolean isWithin(PlatformWorld world) {
|
||||
return isWithin(((world.getTime() / 1000D) + 6) % 24);
|
||||
public SpawnTimeBlock() {
|
||||
}
|
||||
|
||||
public boolean isWithin(double hour) {
|
||||
/** Whether {@code hour}, a time of day from 0 to 24, lies in the block; a block that wraps past midnight includes both ends. */
|
||||
public boolean contains(double hour) {
|
||||
if (startHour == endHour) {
|
||||
return endHour != -1;
|
||||
return endHour != NEVER;
|
||||
}
|
||||
|
||||
if (startHour > endHour) {
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,13 +16,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.world;
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.spi.PlatformWorld;
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Represents a weather type")
|
||||
public enum IrisWeather {
|
||||
public enum SpawnWeather {
|
||||
@Desc("Represents when weather is not causing downfall")
|
||||
NONE,
|
||||
|
||||
@@ -35,11 +34,12 @@ public enum IrisWeather {
|
||||
@Desc("Any weather")
|
||||
ANY;
|
||||
|
||||
public boolean is(PlatformWorld world) {
|
||||
/** Whether the weather of a world, which is {@code storming} and {@code thundering} or neither, is this one. */
|
||||
public boolean matches(boolean storming, boolean thundering) {
|
||||
return switch (this) {
|
||||
case NONE -> !world.isStorming() && !world.isThundering();
|
||||
case DOWNFALL -> world.isStorming();
|
||||
case DOWNFALL_WITH_THUNDER -> world.isStorming() && world.isThundering();
|
||||
case NONE -> !storming && !thundering;
|
||||
case DOWNFALL -> storming;
|
||||
case DOWNFALL_WITH_THUNDER -> storming && thundering;
|
||||
case ANY -> true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.Range;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** A spawner of the pack, one file of {@code spawners/}: which entities appear where, when and how often. */
|
||||
@Desc("Represents an entity spawn during initial chunk generation")
|
||||
public final class Spawner {
|
||||
@MinItems(1)
|
||||
@Desc("The entity spawns to add")
|
||||
private List<EntitySpawn> spawns = List.of();
|
||||
|
||||
@MinItems(1)
|
||||
@Desc("The entity spawns to add initially. EXECUTES PER CHUNK!")
|
||||
private List<EntitySpawn> initialSpawns = List.of();
|
||||
|
||||
@Desc("This spawner will not spawn in a given chunk if that chunk has more than the defined amount of living entities.")
|
||||
private int maxEntitiesPerChunk = 1;
|
||||
|
||||
@Desc("The block of 24 hour time to contain this spawn in.")
|
||||
private SpawnTimeBlock timeBlock = new SpawnTimeBlock();
|
||||
|
||||
@Desc("The weather condition required for this spawner to fire.")
|
||||
private SpawnWeather weather = SpawnWeather.ANY;
|
||||
|
||||
@Desc("The maximum rate this spawner can fire")
|
||||
private SpawnRate maximumRate = new SpawnRate();
|
||||
|
||||
@Desc("The maximum rate this spawner can fire on a specific chunk")
|
||||
private SpawnRate maximumRatePerChunk = new SpawnRate();
|
||||
|
||||
@Desc("The light levels this spawn is allowed to run in (0-15 inclusive)")
|
||||
private Range allowedLightLevels = Range.of(0, 15);
|
||||
|
||||
@Desc("Where should these spawns be placed")
|
||||
private SpawnGroup group = SpawnGroup.NORMAL;
|
||||
|
||||
public Spawner() {
|
||||
}
|
||||
|
||||
public List<EntitySpawn> spawns() {
|
||||
return spawns == null ? List.of() : Collections.unmodifiableList(spawns);
|
||||
}
|
||||
|
||||
public List<EntitySpawn> initialSpawns() {
|
||||
return initialSpawns == null ? List.of() : Collections.unmodifiableList(initialSpawns);
|
||||
}
|
||||
|
||||
public int maxEntitiesPerChunk() {
|
||||
return maxEntitiesPerChunk;
|
||||
}
|
||||
|
||||
public SpawnTimeBlock timeBlock() {
|
||||
return timeBlock == null ? new SpawnTimeBlock() : timeBlock;
|
||||
}
|
||||
|
||||
public SpawnWeather weather() {
|
||||
return weather == null ? SpawnWeather.ANY : weather;
|
||||
}
|
||||
|
||||
public SpawnRate maximumRate() {
|
||||
return maximumRate == null ? new SpawnRate() : maximumRate;
|
||||
}
|
||||
|
||||
public SpawnRate maximumRatePerChunk() {
|
||||
return maximumRatePerChunk == null ? new SpawnRate() : maximumRatePerChunk;
|
||||
}
|
||||
|
||||
public Range allowedLightLevels() {
|
||||
return allowedLightLevels == null ? Range.of(0, 15) : allowedLightLevels;
|
||||
}
|
||||
|
||||
public SpawnGroup group() {
|
||||
return group == null ? SpawnGroup.NORMAL : group;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.spawn;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.ResourceRef;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The spawners one dimension, region or biome lists, written as {@code "entitySpawners": [...]}, the keys of the
|
||||
* {@link Spawner}s. A chunk may fire the spawners of its dimension, region and biome.
|
||||
*/
|
||||
@Desc("Entity spawners that fire in this area")
|
||||
@Feature(id = "iris:spawn", name = "Entity spawners", key = "entitySpawners", root = "spawners", targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
|
||||
public final class SpawnerSettings implements IrisFeature {
|
||||
@MinItems(1)
|
||||
@ResourceRef(Spawner.class)
|
||||
@Desc("Entity spawners to add to this area")
|
||||
private List<String> spawners = List.of();
|
||||
|
||||
public SpawnerSettings() {
|
||||
}
|
||||
|
||||
public List<String> spawners() {
|
||||
return spawners == null ? List.of() : Collections.unmodifiableList(spawners);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The layers of material on the ceilings of caves in a biome, written as {@code "caveCeilingLayers": [...]}, the list of layers.
|
||||
*/
|
||||
@Desc("Layers of materials placed on cave ceilings in this biome, indexed upward from the ceiling surface. Must not have more entries than layers, whose height generators it reuses. Omitting this leaves cave ceilings unchanged.")
|
||||
@Feature(id = "iris:terrain/cave-ceiling-layers", name = "Cave ceiling layers", key = "caveCeilingLayers", root = "layers", targets = Target.BIOME)
|
||||
public final class CaveCeilingLayersSettings implements IrisFeature {
|
||||
@Desc("Layers of materials placed on cave ceilings in this biome, indexed upward from the ceiling surface. Must not have more entries than layers, whose height generators it reuses. Omitting this leaves cave ceilings unchanged.")
|
||||
private List<PaletteLayer> layers = List.of();
|
||||
|
||||
public CaveCeilingLayersSettings() {
|
||||
}
|
||||
|
||||
public List<PaletteLayer> layers() {
|
||||
return layers == null ? List.of() : layers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The blocks that fill ocean columns and cave aquifers of a dimension, written as {@code "fluidPalette": {...}}, a palette. A dimension without the key is water.
|
||||
*/
|
||||
@Desc("The dimension fluid block palette used for ocean columns and cave aquifers.")
|
||||
@Feature(id = "iris:terrain/fluid-palette", name = "Fluid palette", key = "fluidPalette", root = "palette", targets = Target.DIMENSION)
|
||||
public final class FluidPaletteSettings implements IrisFeature {
|
||||
private static final String DEFAULT_BLOCK = "water";
|
||||
|
||||
@Desc("The dimension fluid block palette used for ocean columns and cave aquifers.")
|
||||
private PaletteSpec palette = PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK)));
|
||||
|
||||
public FluidPaletteSettings() {
|
||||
}
|
||||
|
||||
public PaletteSpec palette() {
|
||||
return palette == null ? PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK))) : palette;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/**
|
||||
* A dimension's {@code hideOresForHiddenOre}: whether every ore block the generator would place is replaced with its base
|
||||
* material. Written as the bare boolean.
|
||||
*/
|
||||
@Desc("When true, every ore block the generator would place (terrain ores, deposits, ores inside objects) is replaced with its base material such as stone, deepslate or netherrack, so drop-control plugins like HiddenOre can manage ore rewards themselves")
|
||||
@Feature(id = "iris:terrain/hide-ores", name = "Hide ores", key = "hideOresForHiddenOre", root = "hide", targets = Target.DIMENSION)
|
||||
public final class HideOresSettings implements IrisFeature {
|
||||
@Desc("When true, every ore block the generator would place (terrain ores, deposits, ores inside objects) is replaced with its base material such as stone, deepslate or netherrack, so drop-control plugins like HiddenOre can manage ore rewards themselves")
|
||||
private boolean hide = false;
|
||||
|
||||
public HideOresSettings() {
|
||||
}
|
||||
|
||||
public HideOresSettings(boolean hide) {
|
||||
this.hide = hide;
|
||||
}
|
||||
|
||||
public boolean hide() {
|
||||
return hide;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.noise.NoiseSampler;
|
||||
import com.volmit.resource.PackResources;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* What the blocks of the biomes' palette layers ({@link PaletteLayer}) are in one world, and which of them a layer picks
|
||||
* where. Terrain, caves and post processing all pick from the same layers (a biome's wall is painted in caves and on
|
||||
* cliffs), and a layer's block noise is built once per world, from the random of whichever of them asks first, as layers
|
||||
* always were. So the picks live here, in the world's state under this class, which the compiled-in built-ins and the
|
||||
* built-ins jar both see: one place, one noise per layer, whichever module asks.
|
||||
*/
|
||||
public final class LayerBlocks {
|
||||
/** A layer without blocks picks none. */
|
||||
public static final int NONE = -1;
|
||||
|
||||
private final PackResources resources;
|
||||
private final Map<PaletteLayer, Picks> picks = new ConcurrentHashMap<>();
|
||||
|
||||
private LayerBlocks(PackResources resources) {
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
/** The layer blocks of {@code world}. */
|
||||
public static LayerBlocks of(PackWorld world) {
|
||||
return world.state(LayerBlocks.class, created -> new LayerBlocks(created.resources()));
|
||||
}
|
||||
|
||||
/** The layer's blocks resolved for the world's pack, each repeated by its weight: what an index from {@link #pick} names. */
|
||||
public List<BlockState> blocks(PaletteLayer layer) {
|
||||
return picksOf(layer).blocks();
|
||||
}
|
||||
|
||||
/**
|
||||
* The index into {@link #blocks(PaletteLayer)} the layer picks at the position, or {@link #NONE} when it has no block.
|
||||
* The noise is seeded from {@code parent} and {@code signature} the first time anyone asks about this layer; a pick
|
||||
* outside the palette falls back to its first block.
|
||||
*/
|
||||
public int pick(PaletteLayer layer, RNG parent, int signature, double x, double y, double z) {
|
||||
Picks layerPicks = picksOf(layer);
|
||||
int size = layerPicks.blocks().size();
|
||||
if (size <= 1) {
|
||||
return size - 1;
|
||||
}
|
||||
double zoom = layer.zoom();
|
||||
double noise = layerPicks.noise(parent, signature).sample(x / zoom, y / zoom, z / zoom);
|
||||
int index = (int) Math.round(noise * (size - 1));
|
||||
return index < 0 || index >= size ? 0 : index;
|
||||
}
|
||||
|
||||
private Picks picksOf(PaletteLayer layer) {
|
||||
Picks known = picks.get(layer);
|
||||
if (known != null) {
|
||||
return known;
|
||||
}
|
||||
return picks.computeIfAbsent(layer, declared -> new Picks(declared, weighted(resources.blocks(), declared.palette()), resources));
|
||||
}
|
||||
|
||||
private static List<BlockState> weighted(BlockRegistry registry, List<BlockSpec> palette) {
|
||||
List<BlockState> weighted = new ArrayList<>();
|
||||
for (BlockSpec spec : palette) {
|
||||
BlockState block = registry.resolve(spec);
|
||||
for (int n = 0; n < spec.weight(); n++) {
|
||||
weighted.add(block);
|
||||
}
|
||||
}
|
||||
return List.copyOf(weighted);
|
||||
}
|
||||
|
||||
/** One layer's blocks and its block noise, built by the first caller. */
|
||||
private static final class Picks {
|
||||
private final PaletteLayer layer;
|
||||
private final List<BlockState> blocks;
|
||||
private final PackResources resources;
|
||||
private volatile NoiseSampler noise;
|
||||
|
||||
Picks(PaletteLayer layer, List<BlockState> blocks, PackResources resources) {
|
||||
this.layer = layer;
|
||||
this.blocks = blocks;
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
List<BlockState> blocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
NoiseSampler noise(RNG parent, int signature) {
|
||||
NoiseSampler built = noise;
|
||||
if (built != null) {
|
||||
return built;
|
||||
}
|
||||
synchronized (this) {
|
||||
if (noise == null) {
|
||||
long seed = parent.nextParallelRNG(signature).nextParallelRNG(layer.minHeight() + layer.maxHeight() + blocks.size()).getSeed();
|
||||
noise = resources.noise().sampler(layer.style(), seed);
|
||||
}
|
||||
return noise;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The layers of material a biome is made of below its surface, written as {@code "layers": [...]}, the list of layers. A biome
|
||||
* that declares none gets one layer of grass, so the settings class default is what a biome without the key has.
|
||||
*/
|
||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||
@Feature(id = "iris:terrain/layers", name = "Layers", key = "layers", root = "layers", targets = Target.BIOME)
|
||||
public final class LayersSettings implements IrisFeature {
|
||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||
private List<PaletteLayer> layers = List.of(new PaletteLayer());
|
||||
|
||||
public LayersSettings() {
|
||||
}
|
||||
|
||||
public List<PaletteLayer> layers() {
|
||||
return layers == null ? List.of() : layers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** How many layers a locked biome iterates below the surface, written as {@code "lockLayersMax": 7}. A biome without the key iterates seven. */
|
||||
@Desc("The max layers to iterate below the surface for locked layer biomes (mesa).")
|
||||
@Feature(id = "iris:terrain/lock-layers-max", name = "Lock layers max", key = "lockLayersMax", root = "layers", targets = Target.BIOME)
|
||||
public final class LockLayersMaxSettings implements IrisFeature {
|
||||
public static final int DEFAULT_LAYERS = 7;
|
||||
|
||||
@Desc("The max layers to iterate below the surface for locked layer biomes (mesa).")
|
||||
private int layers = DEFAULT_LAYERS;
|
||||
|
||||
public LockLayersMaxSettings() {
|
||||
}
|
||||
|
||||
public int layers() {
|
||||
return layers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/** Whether a biome's layers are locked to its highest possible height, written as {@code "lockLayers": true}. A biome without the key is not locked. */
|
||||
@Desc("Layers no longer descend from the surface block, they descend from the max possible height the biome can produce (constant) creating mesa like layers.")
|
||||
@Feature(id = "iris:terrain/lock-layers", name = "Lock layers", key = "lockLayers", root = "locked", targets = Target.BIOME)
|
||||
public final class LockLayersSettings implements IrisFeature {
|
||||
@Desc("Layers no longer descend from the surface block, they descend from the max possible height the biome can produce (constant) creating mesa like layers.")
|
||||
private boolean locked = false;
|
||||
|
||||
public LockLayersSettings() {
|
||||
}
|
||||
|
||||
public boolean locked() {
|
||||
return locked;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Range;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One ore generator of a dimension, region or biome, an entry of its {@code ores} list: single ore blocks scattered
|
||||
* through the terrain by a noise field, in a vertical band. A value of IrisApi types only; the terrain module resolves
|
||||
* its blocks and builds its noise ({@code ResolvedOre}).
|
||||
*/
|
||||
@Desc("Scatters single ore blocks through terrain by sampling a noise field at every block in a vertical band. Defined on dimensions, regions, or biomes; the most specific level wins.")
|
||||
public final class OreGenerator {
|
||||
private static final double DEFAULT_THRESHOLD = 0.5;
|
||||
private static final double DEFAULT_RANGE_MIN = 30;
|
||||
private static final double DEFAULT_RANGE_MAX = 80;
|
||||
|
||||
@Desc("The ore blocks to place. An empty palette generates nothing, so this must be set for the generator to have any effect.")
|
||||
private PaletteSpec palette = PaletteSpec.of(List.of());
|
||||
|
||||
@Desc("The noise style sampled per block to decide where ore appears. STATIC gives independent random speckle; smoother styles give veiny clusters.")
|
||||
private NoiseStyle chanceStyle = NoiseStyle.of("STATIC");
|
||||
|
||||
@Desc("When true this generator also replaces surface-layer blocks (it runs before layers and fluid); when false it only replaces underground rock.")
|
||||
private boolean generateSurface = false;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Noise cutoff: a block becomes ore when the sampled noise is at or below this value, so higher means more ore. 0 disables, 1 replaces everything in range.")
|
||||
private double threshold = DEFAULT_THRESHOLD;
|
||||
|
||||
@Desc("Vertical band (min, max) this ore can generate in, in engine-local Y where 0 is the bottom of the dimension, not world Y.")
|
||||
private Range range = Range.of(DEFAULT_RANGE_MIN, DEFAULT_RANGE_MAX);
|
||||
|
||||
public OreGenerator() {
|
||||
}
|
||||
|
||||
public PaletteSpec palette() {
|
||||
return palette;
|
||||
}
|
||||
|
||||
public NoiseStyle chanceStyle() {
|
||||
return chanceStyle;
|
||||
}
|
||||
|
||||
public boolean generateSurface() {
|
||||
return generateSurface;
|
||||
}
|
||||
|
||||
public double threshold() {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
public Range range() {
|
||||
return range;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
import com.volmit.config.MinItems;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The ore generators one dimension, region or biome declares, written as {@code "ores": [...]}, the list of generators.
|
||||
* Levels stack: a column's ores come from its biome first, then its region, then the dimension. IrisApi types only,
|
||||
* like {@link OreGenerator}.
|
||||
*/
|
||||
@Desc("Collection of ores to be generated")
|
||||
@Feature(id = "iris:terrain/ores", name = "Ores", key = "ores", root = "generators", targets = {Target.DIMENSION, Target.REGION, Target.BIOME})
|
||||
public final class OreSettings implements IrisFeature {
|
||||
@MinItems(1)
|
||||
@Desc("Collection of ores to be generated")
|
||||
private List<OreGenerator> generators = List.of();
|
||||
|
||||
public OreSettings() {
|
||||
}
|
||||
|
||||
public OreSettings(List<OreGenerator> generators) {
|
||||
this.generators = List.copyOf(generators);
|
||||
}
|
||||
|
||||
public List<OreGenerator> generators() {
|
||||
return generators == null ? List.of() : Collections.unmodifiableList(generators);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import art.arcane.iris.builtin.prepare.SlopeClip;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Required;
|
||||
import com.volmit.config.Snippet;
|
||||
import com.volmit.noise.NoiseStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One layer of surface or subsurface material of a biome, as packs write it in the biome's layers, sea layers, cave
|
||||
* ceiling layers, slab and wall, in a floating island's bottom palette or under {@code snippet/biome-palette/}. A value of
|
||||
* IrisApi types only; the terrain module resolves the blocks and builds the noise.
|
||||
*/
|
||||
@Snippet("biome-palette")
|
||||
@Desc("A layer of surface / subsurface material in biomes")
|
||||
public final class PaletteLayer {
|
||||
private static final String STATIC_NOISE = "STATIC";
|
||||
private static final String DEFAULT_BLOCK = "grass_block";
|
||||
|
||||
@Desc("The style of noise")
|
||||
private NoiseStyle style = NoiseStyle.of(STATIC_NOISE);
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(2032)
|
||||
@Desc("The min thickness of this layer")
|
||||
private int minHeight = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(2032)
|
||||
@Desc("The max thickness of this layer")
|
||||
private int maxHeight = 1;
|
||||
|
||||
@Desc("If set, this layer only shows where the terrain slope is within these bounds; outside them the layer is skipped entirely. Thickness is not scaled by slope.")
|
||||
private SlopeClip slopeCondition = new SlopeClip();
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
|
||||
private double zoom = 5;
|
||||
|
||||
@Required
|
||||
@MinItems(1)
|
||||
@Desc("The palette of blocks to be used in this layer")
|
||||
private List<BlockSpec> palette = List.of(BlockSpec.of(DEFAULT_BLOCK));
|
||||
|
||||
/** A layer with every option at its default, as packs get it from {@code {}}. */
|
||||
public PaletteLayer() {
|
||||
}
|
||||
|
||||
/** A layer with the default options and no block to place, which is what a biome without a slab or wall has. */
|
||||
public static PaletteLayer withoutBlocks() {
|
||||
PaletteLayer layer = new PaletteLayer();
|
||||
layer.palette = List.of();
|
||||
return layer;
|
||||
}
|
||||
|
||||
public NoiseStyle style() {
|
||||
return style == null ? NoiseStyle.of(STATIC_NOISE) : style;
|
||||
}
|
||||
|
||||
public int minHeight() {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
public int maxHeight() {
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
public SlopeClip slopeCondition() {
|
||||
return slopeCondition == null ? new SlopeClip() : slopeCondition;
|
||||
}
|
||||
|
||||
public double zoom() {
|
||||
return zoom;
|
||||
}
|
||||
|
||||
public List<BlockSpec> palette() {
|
||||
return palette == null ? List.of() : palette;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The blocks that fill terrain below the layers of a dimension, written as {@code "rockPalette": {...}}, a palette. A dimension without the key is stone.
|
||||
*/
|
||||
@Desc("The palette of blocks for 'stone'")
|
||||
@Feature(id = "iris:terrain/rock-palette", name = "Rock palette", key = "rockPalette", root = "palette", targets = Target.DIMENSION)
|
||||
public final class RockPaletteSettings implements IrisFeature {
|
||||
private static final String DEFAULT_BLOCK = "stone";
|
||||
|
||||
@Desc("The palette of blocks for 'stone'")
|
||||
private PaletteSpec palette = PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK)));
|
||||
|
||||
public RockPaletteSettings() {
|
||||
}
|
||||
|
||||
public PaletteSpec palette() {
|
||||
return palette == null ? PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK))) : palette;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The layers of material filling the water column of a sea biome, written as {@code "seaLayers": [...]}, the list of layers.
|
||||
*/
|
||||
@Desc("Layers of materials filling the water column of sea biomes, indexed downward from the water surface. Anything below the last layer is filled with the dimension fluid palette, not stone.")
|
||||
@Feature(id = "iris:terrain/sea-layers", name = "Sea layers", key = "seaLayers", root = "layers", targets = Target.BIOME)
|
||||
public final class SeaLayersSettings implements IrisFeature {
|
||||
@Desc("Layers of materials filling the water column of sea biomes, indexed downward from the water surface. Anything below the last layer is filled with the dimension fluid palette, not stone.")
|
||||
private List<PaletteLayer> layers = List.of();
|
||||
|
||||
public SeaLayersSettings() {
|
||||
}
|
||||
|
||||
public List<PaletteLayer> layers() {
|
||||
return layers == null ? List.of() : layers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/**
|
||||
* The slab post processing places on steps in a biome, written as {@code "slab": {...}}, one layer. A biome without the key has no slab.
|
||||
*/
|
||||
@Desc("The default slab if iris decides to place a slab in this biome. Default is no slab.")
|
||||
@Feature(id = "iris:terrain/slab", name = "Slab", key = "slab", root = "layer", targets = Target.BIOME)
|
||||
public final class SlabSettings implements IrisFeature {
|
||||
@Desc("The default slab if iris decides to place a slab in this biome. Default is no slab.")
|
||||
private PaletteLayer layer = PaletteLayer.withoutBlocks();
|
||||
|
||||
public SlabSettings() {
|
||||
}
|
||||
|
||||
public PaletteLayer layer() {
|
||||
return layer == null ? PaletteLayer.withoutBlocks() : layer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.builtin.terrain;
|
||||
|
||||
import com.volmit.FeatureAttachment.Target;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.Feature;
|
||||
|
||||
/**
|
||||
* The wall post processing paints on steep faces, and caves paint on their walls, in a biome, written as {@code "wall": {...}}, one layer.
|
||||
* A biome without the key has no wall.
|
||||
*/
|
||||
@Desc("The default wall if iris decides to place a wall higher than 2 blocks (steep hills or possibly cliffs)")
|
||||
@Feature(id = "iris:terrain/wall", name = "Wall", key = "wall", root = "layer", targets = Target.BIOME)
|
||||
public final class WallSettings implements IrisFeature {
|
||||
@Desc("The default wall if iris decides to place a wall higher than 2 blocks (steep hills or possibly cliffs)")
|
||||
private PaletteLayer layer = PaletteLayer.withoutBlocks();
|
||||
|
||||
public WallSettings() {
|
||||
}
|
||||
|
||||
public PaletteLayer layer() {
|
||||
return layer == null ? PaletteLayer.withoutBlocks() : layer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.HideOresSettings;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
|
||||
/** Whether a dimension hides its ores ({@code hideOresForHiddenOre}): the terrain places none and the perfection pass turns the rest into their base blocks. */
|
||||
public final class HiddenOres {
|
||||
private HiddenOres() {
|
||||
}
|
||||
|
||||
public static boolean in(IrisDimension dimension) {
|
||||
return dimension.getModuleSettings().find(HideOresSettings.class).map(HideOresSettings::hide).orElse(false);
|
||||
}
|
||||
}
|
||||
@@ -19,55 +19,52 @@
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
/**
|
||||
* Builds the noise of every ore generator the world's biomes, regions and dimension declare before generation needs it.
|
||||
* A generator keeps the noise of the first random it is given, so each one is warmed with the random of its place in
|
||||
* A generator keeps the noise of the first seed it is given, so each one is warmed with the seed of its place in
|
||||
* this order: the biomes by key, the regions by key, then the dimension. The order is part of what a world generates.
|
||||
*/
|
||||
final class OreWarmUp {
|
||||
private static final long ROOT_SEED_SALT = 7777L;
|
||||
|
||||
private final Engine engine;
|
||||
private final TerrainOres ores;
|
||||
private final RNG root;
|
||||
private int warmed;
|
||||
|
||||
OreWarmUp(Engine engine) {
|
||||
this(engine, TerrainOres.of(engine));
|
||||
}
|
||||
|
||||
OreWarmUp(Engine engine, TerrainOres ores) {
|
||||
this.engine = engine;
|
||||
this.ores = ores;
|
||||
this.root = new RNG(engine.getSeedManager().getComponent() + ROOT_SEED_SALT);
|
||||
}
|
||||
|
||||
void warm() {
|
||||
LongSupplier seeds = () -> root.nextParallelRNG(warmed++).getSeed();
|
||||
|
||||
KList<IrisBiome> biomes = engine.getAllBiomes();
|
||||
biomes.sort(Comparator.comparing(IrisBiome::getLoadKey));
|
||||
for (IrisBiome biome : biomes) {
|
||||
warmAll(biome.getOres());
|
||||
ores.of(biome).warm(seeds);
|
||||
}
|
||||
|
||||
KList<IrisRegion> regions = engine.getDimension().getAllRegions(engine);
|
||||
regions.sort(Comparator.comparing(IrisRegion::getLoadKey));
|
||||
for (IrisRegion region : regions) {
|
||||
warmAll(region.getOres());
|
||||
ores.of(region).warm(seeds);
|
||||
}
|
||||
|
||||
warmAll(engine.getDimension().getOres());
|
||||
}
|
||||
|
||||
private void warmAll(KList<IrisOreGenerator> ores) {
|
||||
if (ores == null) {
|
||||
return;
|
||||
}
|
||||
for (IrisOreGenerator ore : ores) {
|
||||
if (ore != null) {
|
||||
ore.warm(root.nextParallelRNG(warmed++), engine.getData());
|
||||
}
|
||||
}
|
||||
ores.of(engine.getDimension()).warm(seeds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.OreGenerator;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.common.data.B;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.PaletteSampler;
|
||||
import com.volmit.noise.NoiseFactory;
|
||||
import com.volmit.noise.NoiseSampler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* One {@link OreGenerator} made ready for one world: its palette resolved to the platform's blocks and the noise that
|
||||
* decides where it places ore, built from the seed it is warmed with or, when nothing warmed it, from the terrain seed
|
||||
* of its first use. The palette picks with the terrain seed. What the generator describes stays in the settings;
|
||||
* everything that needs the platform, the pack or the world seed is here.
|
||||
*/
|
||||
final class ResolvedOre {
|
||||
private final OreGenerator settings;
|
||||
private final NoiseFactory noise;
|
||||
private final BlockRegistry blockRegistry;
|
||||
private final long terrainSeed;
|
||||
private final List<PlatformBlockState> blocks;
|
||||
private final AtomicCache<NoiseSampler> chance = new AtomicCache<>();
|
||||
private final AtomicCache<PaletteSampler> palette = new AtomicCache<>();
|
||||
|
||||
/**
|
||||
* @param terrainSeed the seed the palette picks with, and the noise is built from when nothing warmed it first
|
||||
* @param blocks the palette as the platform's blocks, each repeated by its weight
|
||||
*/
|
||||
ResolvedOre(OreGenerator settings, NoiseFactory noise, BlockRegistry blockRegistry, long terrainSeed, List<PlatformBlockState> blocks) {
|
||||
this.settings = settings;
|
||||
this.noise = noise;
|
||||
this.blockRegistry = blockRegistry;
|
||||
this.terrainSeed = terrainSeed;
|
||||
this.blocks = List.copyOf(blocks);
|
||||
}
|
||||
|
||||
/** {@code settings} ready for {@code engine}: its blocks resolved through the pack, its picks seeded with the terrain seed. */
|
||||
static ResolvedOre of(OreGenerator settings, Engine engine) {
|
||||
var resources = engine.getData().getPackResources();
|
||||
BlockRegistry registry = resources.blocks();
|
||||
return new ResolvedOre(settings, resources.noise(), registry, engine.getSeedManager().getTerrain(), weighted(registry, settings.palette().palette()));
|
||||
}
|
||||
|
||||
private static List<PlatformBlockState> weighted(BlockRegistry registry, List<BlockSpec> specs) {
|
||||
List<PlatformBlockState> weighted = new ArrayList<>();
|
||||
for (BlockSpec spec : specs) {
|
||||
PlatformBlockState state = B.getState(registry.resolve(spec).key());
|
||||
if (state == null) {
|
||||
continue;
|
||||
}
|
||||
for (int n = 0; n < spec.weight(); n++) {
|
||||
weighted.add(state);
|
||||
}
|
||||
}
|
||||
return weighted;
|
||||
}
|
||||
|
||||
boolean generatesSurface() {
|
||||
return settings.generateSurface();
|
||||
}
|
||||
|
||||
double minY() {
|
||||
return settings.range().min();
|
||||
}
|
||||
|
||||
double maxY() {
|
||||
return settings.range().max();
|
||||
}
|
||||
|
||||
/** Builds the chance noise from {@code seed}, unless it is built already: the first seed it is given is the one it keeps. */
|
||||
void warm(long seed) {
|
||||
chance.aquire(() -> noise.sampler(settings.chanceStyle(), seed));
|
||||
}
|
||||
|
||||
/** The ore block at the position, or null when the position is out of the band, the chance noise is above the threshold or the palette has no block. */
|
||||
PlatformBlockState generate(int x, int y, int z) {
|
||||
if (!settings.range().contains(y)) {
|
||||
return null;
|
||||
}
|
||||
if (settings.palette().palette().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (chanceNoise().sample(x, y, z) > settings.threshold()) {
|
||||
return null;
|
||||
}
|
||||
return pick(x, y, z);
|
||||
}
|
||||
|
||||
/** The chance noise, which this runs per block of the terrain, so a built one is read without creating a supplier. */
|
||||
private NoiseSampler chanceNoise() {
|
||||
NoiseSampler built = chance.getIfPresent();
|
||||
if (built != null) {
|
||||
return built;
|
||||
}
|
||||
return chance.aquire(() -> noise.sampler(settings.chanceStyle(), terrainSeed));
|
||||
}
|
||||
|
||||
private PlatformBlockState pick(int x, int y, int z) {
|
||||
if (blocks.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (blocks.size() == 1) {
|
||||
return blocks.getFirst();
|
||||
}
|
||||
PaletteSampler sampler = palette.aquire(() -> blockRegistry.palette(settings.palette(), terrainSeed));
|
||||
return B.getState(sampler.at(x, y, z).key());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.OreGenerator;
|
||||
import art.arcane.iris.builtin.terrain.OreSettings;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
/**
|
||||
* The ore generators of one dimension, region or biome made ready ({@link ResolvedOre}), in the order its settings list them
|
||||
* and split into the ones that also replace surface blocks and the ones that only replace rock. A level without ores is
|
||||
* {@link #NONE}.
|
||||
*/
|
||||
final class ResolvedOres {
|
||||
static final ResolvedOres NONE = new ResolvedOres(List.of());
|
||||
|
||||
private final List<ResolvedOre> all;
|
||||
private final List<ResolvedOre> surface;
|
||||
private final List<ResolvedOre> underground;
|
||||
private final YBand surfaceBand;
|
||||
private final YBand undergroundBand;
|
||||
|
||||
ResolvedOres(List<ResolvedOre> all) {
|
||||
this.all = List.copyOf(all);
|
||||
this.surface = this.all.stream().filter(ResolvedOre::generatesSurface).toList();
|
||||
this.underground = this.all.stream().filter(ore -> !ore.generatesSurface()).toList();
|
||||
this.surfaceBand = YBand.of(surface);
|
||||
this.undergroundBand = YBand.of(underground);
|
||||
}
|
||||
|
||||
/** {@code settings} ready for {@code engine}; generators the pack wrote as {@code null} are left out. */
|
||||
static ResolvedOres of(OreSettings settings, Engine engine) {
|
||||
List<ResolvedOre> ores = new ArrayList<>();
|
||||
for (OreGenerator generator : settings.generators()) {
|
||||
if (generator != null) {
|
||||
ores.add(ResolvedOre.of(generator, engine));
|
||||
}
|
||||
}
|
||||
return ores.isEmpty() ? NONE : new ResolvedOres(ores);
|
||||
}
|
||||
|
||||
/** The heights where any surface ore can generate. */
|
||||
YBand surfaceBand() {
|
||||
return surfaceBand;
|
||||
}
|
||||
|
||||
/** The heights where any rock-only ore can generate. */
|
||||
YBand undergroundBand() {
|
||||
return undergroundBand;
|
||||
}
|
||||
|
||||
/** Warms every ore in the order the settings list them, each with the next seed. */
|
||||
void warm(LongSupplier seeds) {
|
||||
for (ResolvedOre ore : all) {
|
||||
ore.warm(seeds.getAsLong());
|
||||
}
|
||||
}
|
||||
|
||||
PlatformBlockState generateSurface(int x, int y, int z) {
|
||||
return firstOre(surface, x, y, z);
|
||||
}
|
||||
|
||||
PlatformBlockState generateUnderground(int x, int y, int z) {
|
||||
return firstOre(underground, x, y, z);
|
||||
}
|
||||
|
||||
private static PlatformBlockState firstOre(List<ResolvedOre> ores, int x, int y, int z) {
|
||||
for (int index = 0; index < ores.size(); index++) {
|
||||
PlatformBlockState ore = ores.get(index).generate(x, y, z);
|
||||
if (ore != null) {
|
||||
return ore;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** The lowest and highest height any of a set of ores reaches; empty when there are none. */
|
||||
record YBand(boolean hasOres, double min, double max) {
|
||||
static final YBand EMPTY = new YBand(false, 0, 0);
|
||||
|
||||
static YBand of(List<ResolvedOre> ores) {
|
||||
if (ores.isEmpty()) {
|
||||
return EMPTY;
|
||||
}
|
||||
double min = Double.POSITIVE_INFINITY;
|
||||
double max = Double.NEGATIVE_INFINITY;
|
||||
for (ResolvedOre ore : ores) {
|
||||
min = Math.min(min, ore.minY());
|
||||
max = Math.max(max, ore.maxY());
|
||||
}
|
||||
return new YBand(true, min, max);
|
||||
}
|
||||
|
||||
boolean contains(int y) {
|
||||
return hasOres && y >= min && y <= max;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,17 +19,29 @@
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.builtin.terrain.CaveCeilingLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.FluidPaletteSettings;
|
||||
import art.arcane.iris.builtin.terrain.LayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.LockLayersMaxSettings;
|
||||
import art.arcane.iris.builtin.terrain.LockLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.RockPaletteSettings;
|
||||
import art.arcane.iris.builtin.terrain.SeaLayersSettings;
|
||||
import art.arcane.iris.builtin.terrain.SlabSettings;
|
||||
import art.arcane.iris.builtin.terrain.WallSettings;
|
||||
import art.arcane.iris.builtin.terrain.HideOresSettings;
|
||||
import art.arcane.iris.builtin.terrain.OreSettings;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.modules.IrisChunk;
|
||||
import art.arcane.iris.core.modules.IrisPackWorld;
|
||||
import art.arcane.iris.engine.IrisComplex;
|
||||
import art.arcane.iris.engine.UpperDimensionContext;
|
||||
import art.arcane.iris.engine.actuator.ResolvedOres.YBand;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGenerator;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisOreGeneratorBounds;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.iris.engine.terrain.BiomeLayers;
|
||||
import art.arcane.iris.engine.terrain.TerrainPalettes;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.common.data.B;
|
||||
import art.arcane.iris.util.project.context.ChunkContext;
|
||||
@@ -51,7 +63,7 @@ import com.volmit.world.PackWorld;
|
||||
* Module {@code iris:terrain}: the chunk's ground, fluids and biome layers. Each column is filled from bedrock up
|
||||
* to its height and the fluid height with its biome's layers, with ore generators of the dimension, region and
|
||||
* biome replacing blocks on the way and the upper dimension's ground filled in from the top. The ore generators' noise
|
||||
* is built ahead of generation, in {@link #warmUp}.
|
||||
* and the rock and fluid palettes' noise are built ahead of generation, in {@link #warmUp}.
|
||||
*/
|
||||
public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
private static final String VERSION = "built-in";
|
||||
@@ -63,12 +75,25 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
|
||||
@Override
|
||||
public void register(FeatureRegistry registry) {
|
||||
registry.registerSettings(LayersSettings.class);
|
||||
registry.registerSettings(SeaLayersSettings.class);
|
||||
registry.registerSettings(CaveCeilingLayersSettings.class);
|
||||
registry.registerSettings(SlabSettings.class);
|
||||
registry.registerSettings(WallSettings.class);
|
||||
registry.registerSettings(LockLayersSettings.class);
|
||||
registry.registerSettings(LockLayersMaxSettings.class);
|
||||
registry.registerSettings(RockPaletteSettings.class);
|
||||
registry.registerSettings(FluidPaletteSettings.class);
|
||||
registry.registerSettings(OreSettings.class);
|
||||
registry.registerSettings(HideOresSettings.class);
|
||||
registry.registerLifecycle(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warmUp(PackWorld world) {
|
||||
new OreWarmUp(IrisPackWorld.of(world).engine()).warm();
|
||||
Engine engine = IrisPackWorld.of(world).engine();
|
||||
TerrainPalettes.of(engine).warm();
|
||||
new OreWarmUp(engine).warm();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,10 +111,20 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
private static final PlatformBlockState BEDROCK = B.getState("BEDROCK");
|
||||
|
||||
private final Engine engine;
|
||||
private final TerrainPalettes palettes;
|
||||
private final BiomeLayers layers;
|
||||
private final TerrainOres ores;
|
||||
private final RNG rng;
|
||||
|
||||
TerrainShaper(Engine engine) {
|
||||
this(engine, TerrainPalettes.of(engine), BiomeLayers.of(engine), TerrainOres.of(engine));
|
||||
}
|
||||
|
||||
TerrainShaper(Engine engine, TerrainPalettes palettes, BiomeLayers layers, TerrainOres ores) {
|
||||
this.engine = engine;
|
||||
this.palettes = palettes;
|
||||
this.layers = layers;
|
||||
this.ores = ores;
|
||||
this.rng = new RNG(engine.getSeedManager().getTerrain());
|
||||
}
|
||||
|
||||
@@ -115,19 +150,16 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
int fluidHeight = dimension.getFluidHeight();
|
||||
int clampedFluidHeight = Math.min(chunkHeight, fluidHeight);
|
||||
boolean bedrockEnabled = dimension.isBedrock();
|
||||
boolean hideOres = dimension.isHideOresForHiddenOre();
|
||||
boolean hideOres = HiddenOres.in(dimension);
|
||||
ChunkedDataCache<IrisBiome> biomeCache = context.getBiome();
|
||||
ChunkedDataCache<IrisRegion> regionCache = context.getRegion();
|
||||
ChunkedDataCache<PlatformBlockState> fluidCache = context.getFluid();
|
||||
ChunkedDataCache<PlatformBlockState> rockCache = context.getRock();
|
||||
int realX = xf + x;
|
||||
UpperDimensionContext upperContext = engine.getUpperContext();
|
||||
// Dimension-level ore lookups are chunk-invariant; resolving them per column paid
|
||||
// four accessor chains times 256 per chunk for constants.
|
||||
KList<IrisOreGenerator> dimensionSurfaceOres = hideOres ? null : dimension.getSurfaceOreGenerators();
|
||||
KList<IrisOreGenerator> dimensionUndergroundOres = hideOres ? null : dimension.getUndergroundOreGenerators();
|
||||
IrisOreGeneratorBounds dimensionSurfaceOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : dimension.getSurfaceOreGeneratorBounds();
|
||||
IrisOreGeneratorBounds dimensionUndergroundOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : dimension.getUndergroundOreGeneratorBounds();
|
||||
// the settings lookup times 256 per chunk for a constant.
|
||||
ResolvedOres dimensionOres = hideOres ? ResolvedOres.NONE : ores.of(dimension);
|
||||
YBand dimensionSurfaceBand = dimensionOres.surfaceBand();
|
||||
YBand dimensionUndergroundBand = dimensionOres.undergroundBand();
|
||||
|
||||
for (int zf = 0; zf < chunkDepth; zf++) {
|
||||
int realZ = zf + z;
|
||||
@@ -140,19 +172,17 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
}
|
||||
|
||||
int topY = Math.min(hf, chunkHeight - 1);
|
||||
PlatformBlockState fluid = fluidCache.get(xf, zf);
|
||||
PlatformBlockState rock = rockCache.get(xf, zf);
|
||||
PlatformBlockState fluid = palettes.fluidAt(realX, realZ);
|
||||
PlatformBlockState rock = palettes.rockAt(realX, realZ);
|
||||
PlatformBlockState mappedSurfaceBlock = complex.getImageMapRuntime().sampleSurfaceBlock(realX, realZ);
|
||||
KList<IrisOreGenerator> biomeSurfaceOres = hideOres ? null : biome.getSurfaceOreGenerators();
|
||||
KList<IrisOreGenerator> regionSurfaceOres = hideOres ? null : region.getSurfaceOreGenerators();
|
||||
KList<IrisOreGenerator> biomeUndergroundOres = hideOres ? null : biome.getUndergroundOreGenerators();
|
||||
KList<IrisOreGenerator> regionUndergroundOres = hideOres ? null : region.getUndergroundOreGenerators();
|
||||
IrisOreGeneratorBounds biomeSurfaceOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : biome.getSurfaceOreGeneratorBounds();
|
||||
IrisOreGeneratorBounds regionSurfaceOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : region.getSurfaceOreGeneratorBounds();
|
||||
IrisOreGeneratorBounds biomeUndergroundOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : biome.getUndergroundOreGeneratorBounds();
|
||||
IrisOreGeneratorBounds regionUndergroundOreBounds = hideOres ? IrisOreGeneratorBounds.EMPTY : region.getUndergroundOreGeneratorBounds();
|
||||
boolean hasSurfaceOres = biomeSurfaceOreBounds.hasOres() || regionSurfaceOreBounds.hasOres() || dimensionSurfaceOreBounds.hasOres();
|
||||
boolean hasUndergroundOres = biomeUndergroundOreBounds.hasOres() || regionUndergroundOreBounds.hasOres() || dimensionUndergroundOreBounds.hasOres();
|
||||
ResolvedOres biomeOres = hideOres ? ResolvedOres.NONE : ores.of(biome);
|
||||
ResolvedOres regionOres = hideOres ? ResolvedOres.NONE : ores.of(region);
|
||||
YBand biomeSurfaceBand = biomeOres.surfaceBand();
|
||||
YBand regionSurfaceBand = regionOres.surfaceBand();
|
||||
YBand biomeUndergroundBand = biomeOres.undergroundBand();
|
||||
YBand regionUndergroundBand = regionOres.undergroundBand();
|
||||
boolean hasSurfaceOres = biomeSurfaceBand.hasOres() || regionSurfaceBand.hasOres() || dimensionSurfaceBand.hasOres();
|
||||
boolean hasUndergroundOres = biomeUndergroundBand.hasOres() || regionUndergroundBand.hasOres() || dimensionUndergroundBand.hasOres();
|
||||
KList<PlatformBlockState> blocks = null;
|
||||
KList<PlatformBlockState> fblocks = null;
|
||||
|
||||
@@ -164,14 +194,14 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
|
||||
PlatformBlockState ore = null;
|
||||
if (hasSurfaceOres) {
|
||||
if (biomeSurfaceOreBounds.contains(i)) {
|
||||
ore = generateOres(biomeSurfaceOres, realX, i, realZ, localRng, data);
|
||||
if (biomeSurfaceBand.contains(i)) {
|
||||
ore = biomeOres.generateSurface(realX, i, realZ);
|
||||
}
|
||||
if (ore == null && regionSurfaceOreBounds.contains(i)) {
|
||||
ore = generateOres(regionSurfaceOres, realX, i, realZ, localRng, data);
|
||||
if (ore == null && regionSurfaceBand.contains(i)) {
|
||||
ore = regionOres.generateSurface(realX, i, realZ);
|
||||
}
|
||||
if (ore == null && dimensionSurfaceOreBounds.contains(i)) {
|
||||
ore = generateOres(dimensionSurfaceOres, realX, i, realZ, localRng, data);
|
||||
if (ore == null && dimensionSurfaceBand.contains(i)) {
|
||||
ore = dimensionOres.generateSurface(realX, i, realZ);
|
||||
}
|
||||
}
|
||||
if (ore != null) {
|
||||
@@ -182,7 +212,7 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
if (i > he && i <= hf) {
|
||||
int fdepth = hf - i;
|
||||
if (fblocks == null) {
|
||||
fblocks = biome.generateSeaLayers(realX, realZ, localRng, hf - he, data);
|
||||
fblocks = layers.generateSeaLayers(biome, realX, realZ, localRng, hf - he, data);
|
||||
}
|
||||
|
||||
if (fblocks.hasIndex(fdepth)) {
|
||||
@@ -200,7 +230,7 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
continue;
|
||||
}
|
||||
if (blocks == null) {
|
||||
blocks = biome.generateLayers(dimension, realX, realZ, localRng, he, he, data, complex);
|
||||
blocks = layers.generateLayers(biome, dimension, realX, realZ, localRng, he, he, data, complex);
|
||||
}
|
||||
|
||||
if (blocks.hasIndex(depth)) {
|
||||
@@ -209,14 +239,14 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
}
|
||||
|
||||
if (hasUndergroundOres) {
|
||||
if (biomeUndergroundOreBounds.contains(i)) {
|
||||
ore = generateOres(biomeUndergroundOres, realX, i, realZ, localRng, data);
|
||||
if (biomeUndergroundBand.contains(i)) {
|
||||
ore = biomeOres.generateUnderground(realX, i, realZ);
|
||||
}
|
||||
if (ore == null && regionUndergroundOreBounds.contains(i)) {
|
||||
ore = generateOres(regionUndergroundOres, realX, i, realZ, localRng, data);
|
||||
if (ore == null && regionUndergroundBand.contains(i)) {
|
||||
ore = regionOres.generateUnderground(realX, i, realZ);
|
||||
}
|
||||
if (ore == null && dimensionUndergroundOreBounds.contains(i)) {
|
||||
ore = generateOres(dimensionUndergroundOres, realX, i, realZ, localRng, data);
|
||||
if (ore == null && dimensionUndergroundBand.contains(i)) {
|
||||
ore = dimensionOres.generateUnderground(realX, i, realZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,11 +265,11 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
|
||||
if (upperSurfaceY < chunkHeight - 1) {
|
||||
IrisBiome upperBiome = upperContext.getUpperBiome(realX, realZ);
|
||||
PlatformBlockState upperRock = upperContext.getRockBlock(realX, realZ);
|
||||
PlatformBlockState upperRock = palettes.upperRockAt(upperContext, realX, realZ);
|
||||
PlatformBlockState upperMappedSurface = upperContext.getSurfaceBlock(realX, realZ);
|
||||
int upperThickness = chunkHeight - 1 - upperSurfaceY;
|
||||
KList<PlatformBlockState> upperBlocks = upperBiome != null
|
||||
? upperBiome.generateLayers(upperContext.getDimension(),
|
||||
? layers.generateLayers(upperBiome, upperContext.getDimension(),
|
||||
realX, realZ, localRng, upperThickness, upperThickness,
|
||||
upperContext.getData(), complex)
|
||||
: null;
|
||||
@@ -264,22 +294,5 @@ public final class TerrainModule implements IrisModule, ModuleLifecycle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private PlatformBlockState generateOres(KList<IrisOreGenerator> oreGenerators, int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (oreGenerators == null || oreGenerators.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int oreCount = oreGenerators.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = oreGenerators.get(oreIndex);
|
||||
PlatformBlockState ore = oreGenerator.generate(x, y, z, rng, data);
|
||||
if (ore != null) {
|
||||
return ore;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.actuator;
|
||||
|
||||
import art.arcane.iris.builtin.terrain.OreSettings;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* What the terrain module keeps for one world: the ore generators of its dimension, regions and biomes made ready
|
||||
* ({@link ResolvedOres}), built from their {@link OreSettings} when first asked for or ahead of generation by {@link OreWarmUp}.
|
||||
*/
|
||||
final class TerrainOres {
|
||||
private final Engine engine;
|
||||
private final Map<OreSettings, ResolvedOres> resolved = new ConcurrentHashMap<>();
|
||||
|
||||
TerrainOres(Engine engine) {
|
||||
this.engine = engine;
|
||||
}
|
||||
|
||||
/** The ores of the world {@code engine} generates now. */
|
||||
static TerrainOres of(Engine engine) {
|
||||
return engine.getGeneration().state(TerrainOres.class, TerrainOres::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* The ore generators {@code owner}, a dimension, region or biome, declares; {@link ResolvedOres#NONE} when it declares none. The
|
||||
* terrain asks this for two owners per column, so a resolved set is read without taking the map's lock.
|
||||
*/
|
||||
ResolvedOres of(IrisRegistrant owner) {
|
||||
OreSettings settings = owner.getModuleSettings().find(OreSettings.class).orElse(null);
|
||||
if (settings == null) {
|
||||
return ResolvedOres.NONE;
|
||||
}
|
||||
ResolvedOres existing = resolved.get(settings);
|
||||
if (existing != null) {
|
||||
return existing;
|
||||
}
|
||||
return resolved.computeIfAbsent(settings, declared -> ResolvedOres.of(declared, engine));
|
||||
}
|
||||
}
|
||||
@@ -18,20 +18,25 @@
|
||||
|
||||
package art.arcane.iris.engine.loot;
|
||||
|
||||
import art.arcane.iris.builtin.loot.BlockDrop;
|
||||
import art.arcane.iris.builtin.loot.BlockDropSettings;
|
||||
import art.arcane.iris.builtin.loot.LootEntry;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.core.modules.IrisPackWorld;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.loot.IrisBlockDrops;
|
||||
import art.arcane.iris.engine.framework.LootResolver;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.item.ItemDrop;
|
||||
import com.volmit.service.BlockDrops;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* How {@code iris:loot} drops items for broken blocks: the block drops of the biome, the region and the dimension, the
|
||||
@@ -44,23 +49,53 @@ public final class BlockDropping implements BlockDrops {
|
||||
int x = broken.position().x();
|
||||
int y = broken.position().y();
|
||||
int z = broken.position().z();
|
||||
PlatformBlockState block = IrisPlatforms.get().registries().block(broken.block().key());
|
||||
String brokenKey = IrisPlatforms.get().registries().block(broken.block().key()).key();
|
||||
ResolvedDrops resolved = world.state(ResolvedDrops.class, ignored -> new ResolvedDrops());
|
||||
|
||||
IrisBiome biome = engine.getBiome(x, y, z);
|
||||
List<IrisBlockDrops> providers = dropsFor(biome.getBlockDrops(), block, engine);
|
||||
if (providers.stream().noneMatch(IrisBlockDrops::isSkipParents)) {
|
||||
List<ResolvedBlockDrop> providers = dropsFor(biome, brokenKey, resolved, world);
|
||||
if (providers.stream().noneMatch(provider -> provider.drop().skipParents())) {
|
||||
IrisRegion region = engine.getRegion(x, z);
|
||||
providers.addAll(dropsFor(region.getBlockDrops(), block, engine));
|
||||
providers.addAll(dropsFor(engine.getDimension().getBlockDrops(), block, engine));
|
||||
providers.addAll(dropsFor(region, brokenKey, resolved, world));
|
||||
providers.addAll(dropsFor(engine.getDimension(), brokenKey, resolved, world));
|
||||
}
|
||||
|
||||
LootItems items = new LootItems(world.resources().items(), false);
|
||||
List<ItemDrop> drops = new ArrayList<>();
|
||||
providers.forEach(provider -> provider.fillDrops(items, drops));
|
||||
return new Result(drops, providers.stream().anyMatch(IrisBlockDrops::isReplaceVanillaDrops));
|
||||
providers.forEach(provider -> fillDrops(provider.drop(), items, drops));
|
||||
return new Result(drops, providers.stream().anyMatch(provider -> provider.drop().replaceVanillaDrops()));
|
||||
}
|
||||
|
||||
private static List<IrisBlockDrops> dropsFor(KList<IrisBlockDrops> candidates, PlatformBlockState block, Engine engine) {
|
||||
return new KList<>(candidates.stream().filter(drops -> drops.shouldDropFor(block, engine.getData())).toList());
|
||||
/** Adds the items of the drops that pass their rarity to {@code into}. */
|
||||
private static void fillDrops(BlockDrop drop, LootItems items, List<ItemDrop> into) {
|
||||
for (LootEntry entry : drop.drops()) {
|
||||
if (!LootResolver.oneIn(RNG.r, entry.rarity())) {
|
||||
continue;
|
||||
}
|
||||
ItemDrop given = items.give(entry, RNG.r);
|
||||
if (given != null) {
|
||||
into.add(given);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<ResolvedBlockDrop> dropsFor(IrisRegistrant owner, String brokenKey, ResolvedDrops resolved, PackWorld world) {
|
||||
List<ResolvedBlockDrop> matching = new ArrayList<>();
|
||||
for (BlockDrop drop : owner.getModuleSettings().find(BlockDropSettings.class).map(BlockDropSettings::drops).orElse(List.of())) {
|
||||
ResolvedBlockDrop candidate = resolved.of(drop, world);
|
||||
if (candidate.dropsFor(brokenKey)) {
|
||||
matching.add(candidate);
|
||||
}
|
||||
}
|
||||
return matching;
|
||||
}
|
||||
|
||||
/** The drops of the world with their blocks resolved, once per drop. */
|
||||
private static final class ResolvedDrops {
|
||||
private final ConcurrentMap<BlockDrop, ResolvedBlockDrop> byDrop = new ConcurrentHashMap<>();
|
||||
|
||||
private ResolvedBlockDrop of(BlockDrop drop, PackWorld world) {
|
||||
return byDrop.computeIfAbsent(drop, key -> ResolvedBlockDrop.of(key, world.resources().blocks()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,22 +18,22 @@
|
||||
|
||||
package art.arcane.iris.engine.loot;
|
||||
|
||||
import art.arcane.iris.builtin.loot.LootTable;
|
||||
import art.arcane.iris.core.modules.IrisPackWorld;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.LootResolver;
|
||||
import art.arcane.iris.engine.framework.PlacedObject;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootTable;
|
||||
import art.arcane.iris.engine.object.loot.IrisVanillaLootTable;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.item.ItemDrop;
|
||||
import com.volmit.service.Loot;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* How {@code iris:loot} fills containers: the tables of the object placed around a container, then those of the
|
||||
@@ -47,36 +47,42 @@ public final class LootGiving implements Loot {
|
||||
int x = site.position().x();
|
||||
int z = site.position().z();
|
||||
int relativeY = site.position().y();
|
||||
RNG rng = LootResolver.containerRng(lootSeed(engine), x, relativeY + engine.getMinHeight(), z);
|
||||
int worldY = relativeY + engine.getMinHeight();
|
||||
RNG rng = LootResolver.containerRng(lootSeed(engine), x, worldY, z);
|
||||
|
||||
List<IrisLootTable> tables = new KList<>();
|
||||
List<Source> sources = new ArrayList<>();
|
||||
boolean objectLootDefined = site.nativeLootDefined();
|
||||
IrisObjectPlacement placement = site.container() == null ? null : placementAt(engine, x, relativeY, z);
|
||||
if (placement != null) {
|
||||
objectLootDefined = objectLootDefined || placement.getLoot().isNotEmpty() || placement.getVanillaLoot().isNotEmpty();
|
||||
IrisLootTable table = placement.getTable(platformState(site), engine.getData(), rng);
|
||||
if (table != null) {
|
||||
tables.add(table);
|
||||
Source picked = placementLoot(world, engine).pick(placement.getVanillaLoot(), placement.getLoot(), platformState(site), rng, x, worldY, z);
|
||||
if (picked != null) {
|
||||
sources.add(picked);
|
||||
if (placement.isOverrideGlobalLoot()) {
|
||||
return sourcesOf(engine, site, List.of(table));
|
||||
return sources;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LootTables.resolveEnvironmentSources(tables, engine, rng, x, relativeY, z, objectLootDefined, table -> table);
|
||||
return sourcesOf(engine, site, tables);
|
||||
LootTables.resolveEnvironmentSources(sources, engine, rng, x, relativeY, z, objectLootDefined, Table::new);
|
||||
return sources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDrop> items(PackWorld world, Site site, String key) {
|
||||
Engine engine = engine(world);
|
||||
IrisLootTable table = LootResources.table(engine.getData(), key);
|
||||
LootTable table = LootResources.table(engine.getData(), key);
|
||||
if (table == null) {
|
||||
return List.of();
|
||||
}
|
||||
int worldY = site.position().y() + engine.getMinHeight();
|
||||
return new LootItems(world.resources().items(), site.debug())
|
||||
.draw(table, lootSeed(engine), site.position().x(), worldY, site.position().z());
|
||||
.draw(key, table, lootSeed(engine), site.position().x(), worldY, site.position().z());
|
||||
}
|
||||
|
||||
private static PlacementLoot placementLoot(PackWorld world, Engine engine) {
|
||||
PlatformLootTables platformTables = world.state(PlatformLootTables.class, ignored -> new PlatformLootTables());
|
||||
return new PlacementLoot(engine.getData(), platformTables::keys, lootSeed(engine));
|
||||
}
|
||||
|
||||
private static IrisObjectPlacement placementAt(Engine engine, int x, int relativeY, int z) {
|
||||
@@ -84,22 +90,6 @@ public final class LootGiving implements Loot {
|
||||
return placed == null ? null : placed.getPlacement();
|
||||
}
|
||||
|
||||
private static List<Source> sourcesOf(Engine engine, Site site, List<IrisLootTable> tables) {
|
||||
int worldY = site.position().y() + engine.getMinHeight();
|
||||
List<Source> sources = new KList<>();
|
||||
for (IrisLootTable table : tables) {
|
||||
if (table instanceof IrisVanillaLootTable vanilla) {
|
||||
long seed = LootTables.seed(lootSeed(engine), vanilla, site.position().x(), worldY, site.position().z());
|
||||
sources.add(new PlatformTable(vanilla.getLootTableKey(), seed));
|
||||
continue;
|
||||
}
|
||||
if (table != null && table.getLoadKey() != null) {
|
||||
sources.add(new Table(table.getLoadKey()));
|
||||
}
|
||||
}
|
||||
return sources;
|
||||
}
|
||||
|
||||
private static PlatformBlockState platformState(Site site) {
|
||||
return IrisPlatforms.get().registries().block(site.container().key());
|
||||
}
|
||||
@@ -111,4 +101,18 @@ public final class LootGiving implements Loot {
|
||||
private static Engine engine(PackWorld world) {
|
||||
return IrisPackWorld.of(world).engine();
|
||||
}
|
||||
|
||||
/** The loot table keys of the platform, which do not change while a world runs. */
|
||||
private static final class PlatformLootTables {
|
||||
private volatile Set<String> keys;
|
||||
|
||||
private Set<String> keys() {
|
||||
Set<String> known = keys;
|
||||
if (known == null) {
|
||||
known = PlacementLoot.platformTableKeys();
|
||||
keys = known;
|
||||
}
|
||||
return known;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
package art.arcane.iris.engine.loot;
|
||||
|
||||
import art.arcane.iris.builtin.loot.ItemAttributeModifier;
|
||||
import art.arcane.iris.builtin.loot.LootEnchantment;
|
||||
import art.arcane.iris.builtin.loot.LootEntry;
|
||||
import art.arcane.iris.builtin.loot.LootSlot;
|
||||
import art.arcane.iris.builtin.loot.LootTable;
|
||||
import art.arcane.iris.engine.framework.LootResolver;
|
||||
import art.arcane.iris.engine.object.entity.IrisAttributeModifier;
|
||||
import art.arcane.iris.engine.object.loot.IrisEnchantment;
|
||||
import art.arcane.iris.engine.object.loot.InventorySlotType;
|
||||
import art.arcane.iris.engine.object.loot.IrisLoot;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootTable;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.item.ItemAttribute;
|
||||
import com.volmit.item.ItemDrop;
|
||||
@@ -54,26 +54,28 @@ public final class LootItems {
|
||||
}
|
||||
|
||||
/**
|
||||
* The items {@code table} gives at the spot {@code x}, {@code y}, {@code z} (world coordinates): picks entries
|
||||
* from the table's own random stream until it has the number of items the table asks for or runs out of tries.
|
||||
* The items {@code table}, which the pack names {@code tableKey}, gives at the spot {@code x}, {@code y}, {@code z}
|
||||
* (world coordinates): picks entries from the table's own random stream until it has the number of items the table
|
||||
* asks for or runs out of tries.
|
||||
*/
|
||||
public List<ItemDrop> draw(IrisLootTable table, long lootSeed, int x, int y, int z) {
|
||||
public List<ItemDrop> draw(String tableKey, LootTable table, long lootSeed, int x, int y, int z) {
|
||||
List<ItemDrop> drops = new ArrayList<>();
|
||||
List<IrisLoot> entries = table.getLoot();
|
||||
if (entries.isEmpty() || table.getMaxTries() <= 0) {
|
||||
List<LootEntry> entries = table.loot();
|
||||
if (entries.isEmpty() || table.maxTries() <= 0) {
|
||||
return drops;
|
||||
}
|
||||
|
||||
RNG rng = LootTables.rng(lootSeed, table, x, y, z);
|
||||
int wanted = Math.max(0, LootResolver.inclusive(rng, table.getMinPicked(), table.getMaxPicked()));
|
||||
String identity = LootTables.identity(tableKey);
|
||||
RNG rng = LootTables.rng(lootSeed, identity, x, y, z);
|
||||
int wanted = Math.max(0, LootResolver.inclusive(rng, table.minPicked(), table.maxPicked()));
|
||||
int tries = 0;
|
||||
while (drops.size() < wanted && tries++ < table.getMaxTries()) {
|
||||
while (drops.size() < wanted && tries++ < table.maxTries()) {
|
||||
int index = rng.nextInt(entries.size());
|
||||
IrisLoot entry = entries.get(index);
|
||||
if (entry == null || entry.getSlotTypes() != InventorySlotType.STORAGE) {
|
||||
LootEntry entry = entries.get(index);
|
||||
if (entry == null || entry.slotTypes() != LootSlot.STORAGE) {
|
||||
continue;
|
||||
}
|
||||
ItemDrop drop = drawEntry(entry, table, rng, lootSeed, index, x, y, z);
|
||||
ItemDrop drop = drawEntry(entry, table, identity, rng, lootSeed, index, x, y, z);
|
||||
if (drop != null) {
|
||||
drops.add(drop);
|
||||
}
|
||||
@@ -82,66 +84,67 @@ public final class LootItems {
|
||||
}
|
||||
|
||||
/** The item {@code entry} gives when nothing else decides whether it does, such as a block's drop or a mob's equipment; null for no item. */
|
||||
public ItemDrop give(IrisLoot entry, RNG rng) {
|
||||
public ItemDrop give(LootEntry entry, RNG rng) {
|
||||
return resolve(entry, rng, null);
|
||||
}
|
||||
|
||||
private ItemDrop drawEntry(IrisLoot entry, IrisLootTable table, RNG rng, long lootSeed, int index, int x, int y, int z) {
|
||||
long combinedRarity = LootResolver.combinedRarity(entry.getRarity(), table.getRarity());
|
||||
if (!LootTables.spatialOneIn(lootSeed, table, index, x, y, z, combinedRarity)) {
|
||||
private ItemDrop drawEntry(LootEntry entry, LootTable table, String identity, RNG rng, long lootSeed, int index, int x, int y, int z) {
|
||||
long combinedRarity = LootResolver.combinedRarity(entry.rarity(), table.rarity());
|
||||
if (!LootTables.spatialOneIn(lootSeed, identity, index, x, y, z, combinedRarity)) {
|
||||
return null;
|
||||
}
|
||||
return resolve(entry, rng, table);
|
||||
}
|
||||
|
||||
private ItemDrop resolve(IrisLoot entry, RNG rng, IrisLootTable table) {
|
||||
String type = entry.getTypeKey();
|
||||
private ItemDrop resolve(LootEntry entry, RNG rng, LootTable table) {
|
||||
String type = entry.type();
|
||||
OptionalInt maxDurability = items.maxDurability(type);
|
||||
if (maxDurability.isEmpty() || isAir(type)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int amount = Math.max(MIN_AMOUNT, LootResolver.inclusive(rng, entry.getMinAmount(), entry.getMaxAmount()));
|
||||
int amount = Math.max(MIN_AMOUNT, LootResolver.inclusive(rng, entry.minAmount(), entry.maxAmount()));
|
||||
List<ItemEnchantment> enchantments = drawEnchantments(entry, rng);
|
||||
List<ItemAttribute> attributes = drawAttributes(entry, rng);
|
||||
Double damage = maxDurability.getAsInt() > 0 ? 1D - rng.d(entry.getMinDurability(), entry.getMaxDurability()) : null;
|
||||
return new ItemDrop(type, amount, entry.getDisplayName(), entry.getLore(), enchantments, attributes,
|
||||
entry.isUnbreakable(), entry.getItemFlags(), entry.getCustomModel(), damage, entry.getLeatherColor(),
|
||||
entry.getDyeColorKey(), entry.getCustomNbt(), debug ? sourceOf(entry, table) : null);
|
||||
Double damage = maxDurability.getAsInt() > 0 ? 1D - rng.d(entry.minDurability(), entry.maxDurability()) : null;
|
||||
return new ItemDrop(type, amount, entry.displayName(), entry.lore(), enchantments, attributes,
|
||||
entry.unbreakable(), entry.itemFlags(), entry.customModel(), damage, entry.leatherColor(),
|
||||
entry.dyeColor(), entry.customNbt(), debug ? sourceOf(entry, table) : null);
|
||||
}
|
||||
|
||||
private static List<ItemEnchantment> drawEnchantments(IrisLoot entry, RNG rng) {
|
||||
private static List<ItemEnchantment> drawEnchantments(LootEntry entry, RNG rng) {
|
||||
List<ItemEnchantment> enchantments = new ArrayList<>();
|
||||
for (IrisEnchantment enchantment : entry.getEnchantments()) {
|
||||
String key = enchantment.getEnchantment();
|
||||
if (key == null || key.isBlank() || rng.nextDouble() >= enchantment.getChance()) {
|
||||
for (LootEnchantment enchantment : entry.enchantments()) {
|
||||
String key = enchantment.enchantment();
|
||||
if (key == null || key.isBlank() || rng.nextDouble() >= enchantment.chance()) {
|
||||
continue;
|
||||
}
|
||||
enchantments.add(new ItemEnchantment(key, Math.max(1, enchantment.getLevel(rng))));
|
||||
int level = LootResolver.inclusive(rng, enchantment.minLevel(), enchantment.maxLevel());
|
||||
enchantments.add(new ItemEnchantment(key, Math.max(1, level)));
|
||||
}
|
||||
return enchantments;
|
||||
}
|
||||
|
||||
private static List<ItemAttribute> drawAttributes(IrisLoot entry, RNG rng) {
|
||||
private static List<ItemAttribute> drawAttributes(LootEntry entry, RNG rng) {
|
||||
List<ItemAttribute> attributes = new ArrayList<>();
|
||||
for (IrisAttributeModifier modifier : entry.getAttributes()) {
|
||||
if (rng.nextDouble() >= modifier.getChance()) {
|
||||
for (ItemAttributeModifier modifier : entry.attributes()) {
|
||||
if (rng.nextDouble() >= modifier.chance()) {
|
||||
continue;
|
||||
}
|
||||
String attribute = modifier.getAttribute();
|
||||
String attribute = modifier.attribute();
|
||||
if (attribute == null || attribute.isBlank()) {
|
||||
continue;
|
||||
}
|
||||
attributes.add(new ItemAttribute(attribute, modifier.getName(), modifier.getOperation(), modifier.getAmount(rng)));
|
||||
attributes.add(new ItemAttribute(attribute, modifier.name(), modifier.operation(), rng.d(modifier.minAmount(), modifier.maxAmount())));
|
||||
}
|
||||
return attributes;
|
||||
}
|
||||
|
||||
private static ItemDrop.Source sourceOf(IrisLoot entry, IrisLootTable table) {
|
||||
private static ItemDrop.Source sourceOf(LootEntry entry, LootTable table) {
|
||||
if (table == null) {
|
||||
return new ItemDrop.Source(null, 0, entry.getRarity());
|
||||
return new ItemDrop.Source(null, 0, entry.rarity());
|
||||
}
|
||||
return new ItemDrop.Source(table.getName(), table.getRarity(), entry.getRarity());
|
||||
return new ItemDrop.Source(table.name(), table.rarity(), entry.rarity());
|
||||
}
|
||||
|
||||
private static boolean isAir(String type) {
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package art.arcane.iris.engine.loot;
|
||||
|
||||
import art.arcane.iris.builtin.loot.BlockDropSettings;
|
||||
import art.arcane.iris.builtin.loot.LootSettings;
|
||||
import com.volmit.FeatureRegistry;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
@@ -26,9 +28,10 @@ import com.volmit.service.Loot;
|
||||
import com.volmit.stage.StageGraph;
|
||||
|
||||
/**
|
||||
* Module {@code iris:loot}: the loot tables of the pack ({@link LootResources}) and the items they and the block drops
|
||||
* of the dimension, regions and biomes give. It checks the tables and the references to them ({@link LootValidator}). It has no generation stage; Iris asks it through {@link Loot} when a container is filled and through
|
||||
* {@link BlockDrops} when a player breaks a block.
|
||||
* Module {@code iris:loot}: the loot tables of the pack ({@link LootResources}), the {@link LootSettings} and
|
||||
* {@link BlockDropSettings} that dimensions, regions and biomes declare, and the items they give. It checks the tables
|
||||
* and the references to them ({@link LootValidator}). It has no generation stage; Iris asks it through {@link Loot} when
|
||||
* a container is filled and through {@link BlockDrops} when a player breaks a block.
|
||||
*/
|
||||
public final class LootModule implements IrisModule {
|
||||
private static final String VERSION = "built-in";
|
||||
@@ -44,6 +47,8 @@ public final class LootModule implements IrisModule {
|
||||
|
||||
@Override
|
||||
public void register(FeatureRegistry registry) {
|
||||
registry.registerSettings(LootSettings.class);
|
||||
registry.registerSettings(BlockDropSettings.class);
|
||||
LootResources.kinds().forEach(registry::registerResourceKind);
|
||||
registry.registerValidator(new LootValidator());
|
||||
registry.registerService(Loot.class, new LootGiving());
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
|
||||
package art.arcane.iris.engine.loot;
|
||||
|
||||
import art.arcane.iris.builtin.loot.LootTable;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.modules.IrisPackResources;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootTable;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.resource.ResourceKind;
|
||||
|
||||
@@ -37,7 +36,7 @@ import java.util.List;
|
||||
*/
|
||||
public final class LootResources {
|
||||
/** Loot tables, in {@code loot/}. */
|
||||
public static final ResourceKind<IrisLootTable> TABLES = ResourceKind.of("iris:loot/table", "loot", IrisLootTable.class);
|
||||
public static final ResourceKind<LootTable> TABLES = ResourceKind.of("iris:loot/table", "loot", LootTable.class);
|
||||
|
||||
private LootResources() {
|
||||
}
|
||||
@@ -47,7 +46,7 @@ public final class LootResources {
|
||||
return List.of(TABLES);
|
||||
}
|
||||
|
||||
public static IrisLootTable table(IrisData data, String key) {
|
||||
public static LootTable table(IrisData data, String key) {
|
||||
if (key == null || key.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
@@ -59,18 +58,6 @@ public final class LootResources {
|
||||
}
|
||||
}
|
||||
|
||||
/** The tables of the pack named by {@code keys}, in order, without the ones the pack lacks. */
|
||||
public static KList<IrisLootTable> tables(IrisData data, List<String> keys) {
|
||||
KList<IrisLootTable> tables = new KList<>();
|
||||
for (String key : keys) {
|
||||
IrisLootTable table = table(data, key);
|
||||
if (table != null) {
|
||||
tables.add(table);
|
||||
}
|
||||
}
|
||||
return tables;
|
||||
}
|
||||
|
||||
/** The key of every loot table of the pack, in key order. */
|
||||
public static List<String> tableKeys(IrisData data) {
|
||||
return data.getPackResources().ids(TABLES.type()).stream().map(ResourceId::path).toList();
|
||||
|
||||
@@ -18,14 +18,13 @@
|
||||
|
||||
package art.arcane.iris.engine.loot;
|
||||
|
||||
import art.arcane.iris.builtin.loot.LootMode;
|
||||
import art.arcane.iris.builtin.loot.LootSettings;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.LootResolver;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootMode;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootReference;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootTable;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,42 +33,46 @@ import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Which loot tables a place in the world draws from, and the random streams that draw from them: the part of loot
|
||||
* that reads the pack's tables, loot references and layout. The streams themselves are
|
||||
* {@link LootResolver}'s; here a table is named by its {@linkplain #identity identity}.
|
||||
* that reads the pack's tables, loot settings and layout. The streams themselves are {@link LootResolver}'s; here a
|
||||
* table is named by its {@linkplain #identity identity}, the key the pack names it by.
|
||||
*/
|
||||
public final class LootTables {
|
||||
private static final String VANILLA_IDENTITY_PREFIX = "Vanilla ";
|
||||
|
||||
private LootTables() {
|
||||
}
|
||||
|
||||
/** What names a table in the random streams: its key, else its name. */
|
||||
public static String identity(IrisLootTable table) {
|
||||
if (table == null) {
|
||||
return "";
|
||||
}
|
||||
String loadKey = table.getLoadKey();
|
||||
if (loadKey != null && !loadKey.isBlank()) {
|
||||
return loadKey;
|
||||
}
|
||||
String name = table.getName();
|
||||
return name == null ? "" : name;
|
||||
/** What names a table in the random streams: the key a pack table is named by. */
|
||||
public static String identity(String tableKey) {
|
||||
return tableKey;
|
||||
}
|
||||
|
||||
public static RNG rng(long lootSeed, IrisLootTable table, int x, int y, int z) {
|
||||
return LootResolver.tableRng(lootSeed, identity(table), x, y, z);
|
||||
/** What names a table of the platform in the random streams. */
|
||||
public static String platformIdentity(String platformKey) {
|
||||
return VANILLA_IDENTITY_PREFIX + platformKey;
|
||||
}
|
||||
|
||||
public static long seed(long lootSeed, IrisLootTable table, int x, int y, int z) {
|
||||
return LootResolver.tableSeed(lootSeed, identity(table), x, y, z);
|
||||
public static RNG rng(long lootSeed, String identity, int x, int y, int z) {
|
||||
return LootResolver.tableRng(lootSeed, identity, x, y, z);
|
||||
}
|
||||
|
||||
public static boolean spatialOneIn(long lootSeed, IrisLootTable table, int entryIndex, int x, int y, int z, long rarity) {
|
||||
return LootResolver.spatialOneIn(lootSeed, identity(table), entryIndex, x, y, z, rarity);
|
||||
public static long seed(long lootSeed, String identity, int x, int y, int z) {
|
||||
return LootResolver.tableSeed(lootSeed, identity, x, y, z);
|
||||
}
|
||||
|
||||
public static boolean spatialOneIn(long lootSeed, String identity, int entryIndex, int x, int y, int z, long rarity) {
|
||||
return LootResolver.spatialOneIn(lootSeed, identity, entryIndex, x, y, z, rarity);
|
||||
}
|
||||
|
||||
/** The loot settings a dimension, region or biome declares; the defaults, which add nothing, when it declares none. */
|
||||
public static LootSettings settingsOf(IrisRegistrant owner) {
|
||||
return owner.getModuleSettings().find(LootSettings.class).orElseGet(LootSettings::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the tables of the dimension, the region, the surface biome and (below the surface) the cave biome at a
|
||||
* column to {@code sources}, as their loot references say, then scales their number by the areas' multipliers.
|
||||
* {@code mapper} turns a table into the caller's own source; a null result skips it.
|
||||
* column to {@code sources}, as their loot settings say, then scales their number by the areas' multipliers.
|
||||
* {@code mapper} turns the key of a table into the caller's own source; a null result skips it.
|
||||
*/
|
||||
public static <T> void resolveEnvironmentSources(
|
||||
List<T> sources,
|
||||
@@ -79,7 +82,7 @@ public final class LootTables {
|
||||
int relativeY,
|
||||
int z,
|
||||
boolean objectLootDefined,
|
||||
Function<IrisLootTable, T> mapper
|
||||
Function<String, T> mapper
|
||||
) {
|
||||
IrisRegion region = engine.getComplex().getRegionStream().get(x, z);
|
||||
IrisBiome surfaceBiome = engine.getComplex().getTrueBiomeStream().get(x, z);
|
||||
@@ -91,20 +94,21 @@ public final class LootTables {
|
||||
contextualBiome = surfaceBiome;
|
||||
}
|
||||
|
||||
LootSettings dimensionLoot = settingsOf(engine.getDimension());
|
||||
LootSettings regionLoot = settingsOf(region);
|
||||
LootSettings surfaceLoot = settingsOf(surfaceBiome);
|
||||
boolean distinctContextualBiome = !sameBiome(surfaceBiome, contextualBiome);
|
||||
double multiplier = engine.getDimension().getLoot().getMultiplier()
|
||||
* region.getLoot().getMultiplier()
|
||||
* surfaceBiome.getLoot().getMultiplier();
|
||||
double multiplier = dimensionLoot.multiplier() * regionLoot.multiplier() * surfaceLoot.multiplier();
|
||||
if (distinctContextualBiome) {
|
||||
multiplier *= contextualBiome.getLoot().getMultiplier();
|
||||
multiplier *= settingsOf(contextualBiome).multiplier();
|
||||
}
|
||||
|
||||
boolean fallback = !objectLootDefined;
|
||||
injectReference(sources, engine.getDimension().getLoot(), engine, mapper, fallback);
|
||||
injectReference(sources, region.getLoot(), engine, mapper, fallback);
|
||||
injectReference(sources, surfaceBiome.getLoot(), engine, mapper, fallback);
|
||||
injectReference(sources, dimensionLoot, engine, mapper, fallback);
|
||||
injectReference(sources, regionLoot, engine, mapper, fallback);
|
||||
injectReference(sources, surfaceLoot, engine, mapper, fallback);
|
||||
if (distinctContextualBiome) {
|
||||
injectReference(sources, contextualBiome.getLoot(), engine, mapper, fallback);
|
||||
injectReference(sources, settingsOf(contextualBiome), engine, mapper, fallback);
|
||||
}
|
||||
LootResolver.scaleSources(sources, multiplier, rng);
|
||||
}
|
||||
@@ -113,17 +117,17 @@ public final class LootTables {
|
||||
public static <T> void injectSources(
|
||||
List<T> sources,
|
||||
List<? extends T> additions,
|
||||
IrisLootMode mode,
|
||||
LootMode mode,
|
||||
boolean fallback
|
||||
) {
|
||||
if (mode == IrisLootMode.FALLBACK && !fallback) {
|
||||
if (mode == LootMode.FALLBACK && !fallback) {
|
||||
return;
|
||||
}
|
||||
if (mode == IrisLootMode.CLEAR) {
|
||||
if (mode == LootMode.CLEAR) {
|
||||
sources.clear();
|
||||
return;
|
||||
}
|
||||
if (mode == IrisLootMode.REPLACE) {
|
||||
if (mode == LootMode.REPLACE) {
|
||||
sources.clear();
|
||||
}
|
||||
sources.addAll(additions);
|
||||
@@ -141,22 +145,16 @@ public final class LootTables {
|
||||
|
||||
private static <T> void injectReference(
|
||||
List<T> sources,
|
||||
IrisLootReference reference,
|
||||
LootSettings loot,
|
||||
Engine engine,
|
||||
Function<IrisLootTable, T> mapper,
|
||||
Function<String, T> mapper,
|
||||
boolean fallback
|
||||
) {
|
||||
KList<IrisLootTable> tables = reference.getLootTables(engine.getComplex());
|
||||
KList<T> additions = new KList<>();
|
||||
for (IrisLootTable table : tables) {
|
||||
if (table == null) {
|
||||
continue;
|
||||
}
|
||||
T source = mapper.apply(table);
|
||||
if (source != null) {
|
||||
additions.add(source);
|
||||
}
|
||||
}
|
||||
injectSources(sources, additions, reference.getMode(), fallback);
|
||||
List<T> additions = loot.tables().stream()
|
||||
.filter(key -> LootResources.table(engine.getData(), key) != null)
|
||||
.map(mapper)
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
injectSources(sources, additions, loot.mode(), fallback);
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,9 @@ package art.arcane.iris.engine.loot;
|
||||
import art.arcane.iris.core.modules.IrisValidationContext;
|
||||
import art.arcane.iris.core.pack.PackIntegerChecks;
|
||||
import art.arcane.iris.core.pack.PackValidationIo;
|
||||
import art.arcane.iris.engine.object.loot.IrisLoot;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootReference;
|
||||
import art.arcane.iris.engine.object.loot.IrisLootTable;
|
||||
import art.arcane.iris.builtin.loot.LootEntry;
|
||||
import art.arcane.iris.builtin.loot.LootSettings;
|
||||
import art.arcane.iris.builtin.loot.LootTable;
|
||||
import art.arcane.volmlib.util.json.JSONArray;
|
||||
import art.arcane.volmlib.util.json.JSONObject;
|
||||
import com.volmit.validation.Problem;
|
||||
@@ -162,9 +162,9 @@ public final class LootValidator implements Validator {
|
||||
PackIntegerChecks.requireMinimum(path + ".minPicked", minimumPicked, 0, blockingErrors);
|
||||
PackIntegerChecks.requireMinimum(path + ".maxPicked", maximumPicked, 1, blockingErrors);
|
||||
PackIntegerChecks.requireMinimum(path + ".maxTries", maximumTries, 1, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(path + ".minPicked", minimumPicked, IrisLootTable.MAX_PICKED, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(path + ".maxPicked", maximumPicked, IrisLootTable.MAX_PICKED, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(path + ".maxTries", maximumTries, IrisLootTable.MAX_TRIES, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(path + ".minPicked", minimumPicked, LootTable.MAX_PICKED, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(path + ".maxPicked", maximumPicked, LootTable.MAX_PICKED, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(path + ".maxTries", maximumTries, LootTable.MAX_TRIES, blockingErrors);
|
||||
PackIntegerChecks.requireOrdered(path + ".minPicked", minimumPicked, path + ".maxPicked", maximumPicked, blockingErrors);
|
||||
|
||||
JSONArray entries = table.optJSONArray("loot");
|
||||
@@ -189,8 +189,8 @@ public final class LootValidator implements Validator {
|
||||
PackIntegerChecks.requireMinimum(entryPath + ".rarity", entryRarity, 1, blockingErrors);
|
||||
PackIntegerChecks.requireMinimum(entryPath + ".minAmount", minimumAmount, 1, blockingErrors);
|
||||
PackIntegerChecks.requireMinimum(entryPath + ".maxAmount", maximumAmount, 1, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(entryPath + ".minAmount", minimumAmount, IrisLoot.MAX_AMOUNT, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(entryPath + ".maxAmount", maximumAmount, IrisLoot.MAX_AMOUNT, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(entryPath + ".minAmount", minimumAmount, LootEntry.MAX_AMOUNT, blockingErrors);
|
||||
PackIntegerChecks.requireMaximum(entryPath + ".maxAmount", maximumAmount, LootEntry.MAX_AMOUNT, blockingErrors);
|
||||
PackIntegerChecks.requireOrdered(entryPath + ".minAmount", minimumAmount,
|
||||
entryPath + ".maxAmount", maximumAmount, blockingErrors);
|
||||
validateLootEnchantments(entryPath, entry.opt("enchantments"), blockingErrors);
|
||||
@@ -256,9 +256,9 @@ public final class LootValidator implements Validator {
|
||||
if (!(rawMultiplier instanceof Number multiplier)
|
||||
|| !Double.isFinite(multiplier.doubleValue())
|
||||
|| multiplier.doubleValue() < 0D
|
||||
|| multiplier.doubleValue() > IrisLootReference.MAX_MULTIPLIER) {
|
||||
|| multiplier.doubleValue() > LootSettings.MAX_MULTIPLIER) {
|
||||
blockingErrors.add(path + ".multiplier must be a finite number from 0 to "
|
||||
+ (int) IrisLootReference.MAX_MULTIPLIER + ".");
|
||||
+ (int) LootSettings.MAX_MULTIPLIER + ".");
|
||||
}
|
||||
}
|
||||
if (!reference.has("tables")) {
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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.loot;
|
||||
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.engine.framework.LootResolver;
|
||||
import art.arcane.iris.engine.object.loot.IObjectLoot;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.service.Loot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* The loot table an object placement gives to one of its containers: the placement's tables and the platform's own,
|
||||
* each with the blocks it applies to and a weight. A table that names the container's exact block wins over one that
|
||||
* names the container's kind of block, which wins over one that names no blocks; among equals the weights pick.
|
||||
*/
|
||||
final class PlacementLoot {
|
||||
private static final String VANILLA_NAMESPACE = "minecraft:";
|
||||
private static final char NAMESPACE_SEPARATOR = ':';
|
||||
private static final char PROPERTIES_START = '[';
|
||||
|
||||
private final IrisData data;
|
||||
private final Supplier<Set<String>> platformTables;
|
||||
private final long lootSeed;
|
||||
|
||||
/** @param platformTables the keys of the loot tables the platform has, asked for only when a placement names one */
|
||||
PlacementLoot(IrisData data, Supplier<Set<String>> platformTables, long lootSeed) {
|
||||
this.data = data;
|
||||
this.platformTables = platformTables;
|
||||
this.lootSeed = lootSeed;
|
||||
}
|
||||
|
||||
/** The platform's loot table keys, which a placement may name, in the form a placement names them. */
|
||||
static Set<String> platformTableKeys() {
|
||||
return Set.copyOf(IrisPlatforms.get().registries().lootTableKeys());
|
||||
}
|
||||
|
||||
/**
|
||||
* The table a placement, whose platform tables are {@code platformLoot} and whose pack tables are {@code packLoot},
|
||||
* gives {@code container}, a storage chest, at the spot {@code x}, {@code worldY}, {@code z}; null when it gives
|
||||
* it none.
|
||||
*/
|
||||
Loot.Source pick(List<? extends IObjectLoot> platformLoot, List<? extends IObjectLoot> packLoot, PlatformBlockState container,
|
||||
RNG rng, int x, int worldY, int z) {
|
||||
Candidates candidates = new Candidates(container);
|
||||
add(candidates, platformLoot, name -> platformSource(name, x, worldY, z));
|
||||
add(candidates, packLoot, this::packSource);
|
||||
List<Candidate> pool = candidates.pool();
|
||||
Candidate picked = LootResolver.pickWeighted(pool, Candidate::weight, rng);
|
||||
return picked == null ? null : picked.source();
|
||||
}
|
||||
|
||||
private void add(Candidates candidates, List<? extends IObjectLoot> entries, Function<String, Loot.Source> sourceOf) {
|
||||
for (IObjectLoot entry : entries) {
|
||||
if (entry == null || entry.getWeight() <= 0) {
|
||||
continue;
|
||||
}
|
||||
Loot.Source source = sourceOf.apply(entry.getName());
|
||||
if (source == null) {
|
||||
IrisLogging.warn("Couldn't find loot table " + entry.getName());
|
||||
continue;
|
||||
}
|
||||
candidates.add(entry, data, new Candidate(source, entry.getWeight()));
|
||||
}
|
||||
}
|
||||
|
||||
private Loot.Source packSource(String key) {
|
||||
return LootResources.table(data, key) == null ? null : new Loot.Table(key);
|
||||
}
|
||||
|
||||
private Loot.Source platformSource(String name, int x, int worldY, int z) {
|
||||
String key = platformKey(name);
|
||||
if (key == null || !platformTables.get().contains(key)) {
|
||||
return null;
|
||||
}
|
||||
return new Loot.PlatformTable(key, LootTables.seed(lootSeed, LootTables.platformIdentity(key), x, worldY, z));
|
||||
}
|
||||
|
||||
/** A placement's name for a platform table as the platform's key for it, or null for a name that cannot be one. */
|
||||
static String platformKey(String name) {
|
||||
if (name == null || name.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
return name.indexOf(NAMESPACE_SEPARATOR) < 0 ? VANILLA_NAMESPACE + name : name;
|
||||
}
|
||||
|
||||
private record Candidate(Loot.Source source, int weight) {
|
||||
}
|
||||
|
||||
/** The candidates for one container, in the groups the placement gives them. */
|
||||
private static final class Candidates {
|
||||
private final String containerKey;
|
||||
private final String containerMaterial;
|
||||
private final List<Candidate> exact = new ArrayList<>();
|
||||
private final List<Candidate> basic = new ArrayList<>();
|
||||
private final List<Candidate> global = new ArrayList<>();
|
||||
|
||||
private Candidates(PlatformBlockState container) {
|
||||
this.containerKey = container.key();
|
||||
this.containerMaterial = materialOf(containerKey);
|
||||
}
|
||||
|
||||
void add(IObjectLoot entry, IrisData data, Candidate candidate) {
|
||||
List<PlatformBlockState> filter = entry.getFilter(data);
|
||||
if (filter.isEmpty()) {
|
||||
global.add(candidate);
|
||||
return;
|
||||
}
|
||||
for (PlatformBlockState filterState : filter) {
|
||||
if (entry.isExact() && filterState.key().equals(containerKey)) {
|
||||
exact.add(candidate);
|
||||
} else if (!entry.isExact() && materialOf(filterState.key()).equals(containerMaterial)) {
|
||||
basic.add(candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Candidate> pool() {
|
||||
if (!exact.isEmpty()) {
|
||||
return exact;
|
||||
}
|
||||
return basic.isEmpty() ? global : basic;
|
||||
}
|
||||
|
||||
private static String materialOf(String blockKey) {
|
||||
int properties = blockKey.indexOf(PROPERTIES_START);
|
||||
return properties < 0 ? blockKey : blockKey.substring(0, properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.loot;
|
||||
|
||||
import art.arcane.iris.builtin.loot.BlockDrop;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockSpec;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/** A {@link BlockDrop} with the blocks it names resolved to the platform's: which broken blocks it drops for. */
|
||||
final class ResolvedBlockDrop {
|
||||
private static final char PROPERTIES_START = '[';
|
||||
|
||||
private final BlockDrop drop;
|
||||
private final boolean exact;
|
||||
private final Set<String> blocks;
|
||||
|
||||
private ResolvedBlockDrop(BlockDrop drop, Set<String> blocks) {
|
||||
this.drop = drop;
|
||||
this.exact = drop.exactBlocks();
|
||||
this.blocks = blocks;
|
||||
}
|
||||
|
||||
/** @param blocks the pack's blocks, which the drop's block specs resolve against */
|
||||
static ResolvedBlockDrop of(BlockDrop drop, BlockRegistry blocks) {
|
||||
Set<String> keys = new LinkedHashSet<>();
|
||||
for (BlockSpec spec : drop.blocks()) {
|
||||
PlatformBlockState state = IrisPlatforms.get().registries().block(blocks.resolve(spec).key());
|
||||
if (state != null) {
|
||||
keys.add(comparable(state.key(), drop.exactBlocks()));
|
||||
}
|
||||
}
|
||||
return new ResolvedBlockDrop(drop, keys);
|
||||
}
|
||||
|
||||
BlockDrop drop() {
|
||||
return drop;
|
||||
}
|
||||
|
||||
/** Whether the drop applies to {@code brokenKey}, the platform's key for the broken block: its exact state, or just its kind of block. */
|
||||
boolean dropsFor(String brokenKey) {
|
||||
return blocks.contains(comparable(brokenKey, exact));
|
||||
}
|
||||
|
||||
private static String comparable(String key, boolean exact) {
|
||||
if (exact) {
|
||||
return key;
|
||||
}
|
||||
int properties = key.indexOf(PROPERTIES_START);
|
||||
return properties < 0 ? key : key.substring(0, properties);
|
||||
}
|
||||
}
|
||||
@@ -19,13 +19,18 @@
|
||||
package art.arcane.iris.engine.mantle.components;
|
||||
|
||||
import art.arcane.iris.builtin.carve.CaveProfile;
|
||||
import art.arcane.iris.core.modules.IrisValues;
|
||||
import art.arcane.iris.engine.IrisComplex;
|
||||
import art.arcane.iris.engine.UpperDimensionContext;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.mantle.MantleWriter;
|
||||
import art.arcane.iris.engine.terrain.TerrainPalettes;
|
||||
import art.arcane.iris.engine.object.terrain.carving.CaveProfiles;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingEntry;
|
||||
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
|
||||
import art.arcane.iris.engine.object.terrain.carving.ResolvedCarvingEntry;
|
||||
import art.arcane.iris.engine.modifier.CaveBiomeBands;
|
||||
import art.arcane.iris.engine.object.terrain.carving.CarvingBands;
|
||||
import art.arcane.iris.engine.object.terrain.carving.CarvingResolver;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
import art.arcane.iris.engine.object.value.IrisRange;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
@@ -89,7 +94,7 @@ public class CaveCarving {
|
||||
/** Carves the caves of the chunk at chunk coordinates {@code x}, {@code z} into {@code writer}. */
|
||||
public void carve(MantleWriter writer, int x, int z, ChunkContext context) {
|
||||
IrisComplex complex = context.getComplex();
|
||||
IrisDimensionCarvingResolver.State resolverState = new IrisDimensionCarvingResolver.State();
|
||||
CarvingResolver.State resolverState = new CarvingResolver.State();
|
||||
BlendScratch blendScratch = BLEND_SCRATCH.get();
|
||||
int[] chunkSurfaceHeights = prepareChunkSurfaceHeights(x, z, context, blendScratch.chunkSurfaceHeights);
|
||||
PrecisionStopwatch resolveStopwatch = PrecisionStopwatch.start();
|
||||
@@ -200,7 +205,7 @@ public class CaveCarving {
|
||||
}
|
||||
}
|
||||
|
||||
private List<WeightedProfile> resolveWeightedProfiles(int chunkX, int chunkZ, IrisComplex complex, IrisDimensionCarvingResolver.State resolverState) {
|
||||
private List<WeightedProfile> resolveWeightedProfiles(int chunkX, int chunkZ, IrisComplex complex, CarvingResolver.State resolverState) {
|
||||
BlendScratch blendScratch = BLEND_SCRATCH.get();
|
||||
CaveProfile[] profileField = blendScratch.profileField;
|
||||
Map<CaveProfile, double[]> columnProfileWeights = blendScratch.columnProfileWeights;
|
||||
@@ -296,40 +301,40 @@ public class CaveCarving {
|
||||
return resolvedProfiles;
|
||||
}
|
||||
|
||||
private List<WeightedProfile> resolveDimensionCarvingProfiles(int chunkX, int chunkZ, IrisDimensionCarvingResolver.State resolverState, BlendScratch blendScratch) {
|
||||
private List<WeightedProfile> resolveDimensionCarvingProfiles(int chunkX, int chunkZ, CarvingResolver.State resolverState, BlendScratch blendScratch) {
|
||||
List<WeightedProfile> weightedProfiles = new ArrayList<>();
|
||||
List<IrisDimensionCarvingEntry> entries = engine.getDimension().getCarving();
|
||||
if (entries == null || entries.isEmpty()) {
|
||||
List<ResolvedCarvingEntry> entries = CarvingBands.of(engine).entries();
|
||||
if (entries.isEmpty()) {
|
||||
return weightedProfiles;
|
||||
}
|
||||
|
||||
Map<IrisDimensionCarvingEntry, IrisDimensionCarvingEntry[]> dimensionColumnPlans = blendScratch.dimensionColumnPlans;
|
||||
Map<ResolvedCarvingEntry, ResolvedCarvingEntry[]> dimensionColumnPlans = blendScratch.dimensionColumnPlans;
|
||||
dimensionColumnPlans.clear();
|
||||
|
||||
for (IrisDimensionCarvingEntry entry : entries) {
|
||||
if (entry == null || !entry.isEnabled()) {
|
||||
for (ResolvedCarvingEntry entry : entries) {
|
||||
if (!entry.enabled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IrisBiome rootBiome = IrisDimensionCarvingResolver.resolveEntryBiome(engine, entry, resolverState);
|
||||
IrisBiome rootBiome = CarvingResolver.resolveEntryBiome(engine, entry, resolverState);
|
||||
if (rootBiome == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IrisDimensionCarvingEntry[] columnPlan = dimensionColumnPlans.computeIfAbsent(entry, key -> new IrisDimensionCarvingEntry[CHUNK_AREA]);
|
||||
ResolvedCarvingEntry[] columnPlan = dimensionColumnPlans.computeIfAbsent(entry, key -> new ResolvedCarvingEntry[CHUNK_AREA]);
|
||||
buildDimensionColumnPlan(columnPlan, chunkX, chunkZ, entry, resolverState);
|
||||
|
||||
Map<CaveProfile, double[]> rootProfileColumnWeights = new IdentityHashMap<>();
|
||||
List<CaveProfile> rootProfileOrder = new ArrayList<>();
|
||||
IrisRange worldYRange = entry.getWorldYRange();
|
||||
IrisRange worldYRange = entry.worldYRange() == null ? null : IrisValues.range(entry.worldYRange());
|
||||
for (int columnIndex = 0; columnIndex < CHUNK_AREA; columnIndex++) {
|
||||
IrisDimensionCarvingEntry resolvedEntry = columnPlan[columnIndex];
|
||||
IrisBiome resolvedBiome = IrisDimensionCarvingResolver.resolveEntryBiome(engine, resolvedEntry, resolverState);
|
||||
ResolvedCarvingEntry resolvedEntry = columnPlan[columnIndex];
|
||||
IrisBiome resolvedBiome = CarvingResolver.resolveEntryBiome(engine, resolvedEntry, resolverState);
|
||||
if (resolvedBiome == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CaveProfile profile = resolvedBiome.getCaveProfile();
|
||||
CaveProfile profile = CaveProfiles.declaredBy(resolvedBiome);
|
||||
if (!isProfileEnabled(profile)) {
|
||||
continue;
|
||||
}
|
||||
@@ -351,7 +356,7 @@ public class CaveCarving {
|
||||
return weightedProfiles;
|
||||
}
|
||||
|
||||
private void buildDimensionColumnPlan(IrisDimensionCarvingEntry[] columnPlan, int chunkX, int chunkZ, IrisDimensionCarvingEntry entry, IrisDimensionCarvingResolver.State resolverState) {
|
||||
private void buildDimensionColumnPlan(ResolvedCarvingEntry[] columnPlan, int chunkX, int chunkZ, ResolvedCarvingEntry entry, CarvingResolver.State resolverState) {
|
||||
int baseX = PowerOfTwoCoordinates.chunkToBlock(chunkX);
|
||||
int baseZ = PowerOfTwoCoordinates.chunkToBlock(chunkZ);
|
||||
for (int localX = 0; localX < CHUNK_SIZE; localX++) {
|
||||
@@ -359,12 +364,12 @@ public class CaveCarving {
|
||||
for (int localZ = 0; localZ < CHUNK_SIZE; localZ++) {
|
||||
int worldZ = baseZ + localZ;
|
||||
int columnIndex = PowerOfTwoCoordinates.packLocal16(localX, localZ);
|
||||
columnPlan[columnIndex] = IrisDimensionCarvingResolver.resolveFromRoot(engine, entry, worldX, worldZ, resolverState);
|
||||
columnPlan[columnIndex] = CarvingResolver.resolveFromRoot(engine, entry, worldX, worldZ, resolverState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fillProfileField(CaveProfile[] profileField, int chunkX, int chunkZ, IrisComplex complex, IrisDimensionCarvingResolver.State resolverState, BlendScratch blendScratch) {
|
||||
private void fillProfileField(CaveProfile[] profileField, int chunkX, int chunkZ, IrisComplex complex, CarvingResolver.State resolverState, BlendScratch blendScratch) {
|
||||
int startX = PowerOfTwoCoordinates.chunkToBlock(chunkX) - BLEND_RADIUS;
|
||||
int startZ = PowerOfTwoCoordinates.chunkToBlock(chunkZ) - BLEND_RADIUS;
|
||||
prefillProfileFieldSamples(startX, startZ, complex, blendScratch);
|
||||
@@ -404,23 +409,23 @@ public class CaveCarving {
|
||||
IrisRegion region,
|
||||
IrisBiome surfaceBiome,
|
||||
IrisBiome caveBiome,
|
||||
IrisDimensionCarvingResolver.State resolverState
|
||||
CarvingResolver.State resolverState
|
||||
) {
|
||||
CaveProfile resolved = null;
|
||||
CaveProfile dimensionProfile = engine.getDimension().getCaveProfile();
|
||||
CaveProfile dimensionProfile = CaveProfiles.declaredBy(engine.getDimension());
|
||||
if (isProfileEnabled(dimensionProfile)) {
|
||||
resolved = dimensionProfile;
|
||||
}
|
||||
|
||||
if (region != null) {
|
||||
CaveProfile regionProfile = region.getCaveProfile();
|
||||
CaveProfile regionProfile = CaveProfiles.declaredBy(region);
|
||||
if (isProfileEnabled(regionProfile)) {
|
||||
resolved = regionProfile;
|
||||
}
|
||||
}
|
||||
|
||||
if (surfaceBiome != null) {
|
||||
CaveProfile surfaceProfile = surfaceBiome.getCaveProfile();
|
||||
CaveProfile surfaceProfile = CaveProfiles.declaredBy(surfaceBiome);
|
||||
if (isProfileEnabled(surfaceProfile)) {
|
||||
resolved = surfaceProfile;
|
||||
}
|
||||
@@ -429,11 +434,11 @@ public class CaveCarving {
|
||||
int roundedSurfaceY = (int) Math.round(surfaceHeight);
|
||||
int sampleY = Math.max(1, roundedSurfaceY - 56);
|
||||
int worldY = sampleY + engine.getWorld().minHeight();
|
||||
IrisDimensionCarvingEntry rootCarvingEntry = IrisDimensionCarvingResolver.resolveRootEntry(engine, worldY, resolverState);
|
||||
ResolvedCarvingEntry rootCarvingEntry = CarvingResolver.resolveRootEntry(engine, worldY, resolverState);
|
||||
IrisBiome resolvedCarvingBiome = null;
|
||||
if (rootCarvingEntry != null) {
|
||||
IrisDimensionCarvingEntry resolvedCarvingEntry = IrisDimensionCarvingResolver.resolveFromRoot(engine, rootCarvingEntry, worldX, worldZ, resolverState);
|
||||
resolvedCarvingBiome = IrisDimensionCarvingResolver.resolveEntryBiome(engine, resolvedCarvingEntry, resolverState);
|
||||
ResolvedCarvingEntry resolvedCarvingEntry = CarvingResolver.resolveFromRoot(engine, rootCarvingEntry, worldX, worldZ, resolverState);
|
||||
resolvedCarvingBiome = CarvingResolver.resolveEntryBiome(engine, resolvedCarvingEntry, resolverState);
|
||||
if (resolvedCarvingBiome != null) {
|
||||
caveBiome = resolvedCarvingBiome;
|
||||
}
|
||||
@@ -447,7 +452,7 @@ public class CaveCarving {
|
||||
if (depthBelowSurface <= 0) {
|
||||
effectiveCaveBiome = surfaceBiome;
|
||||
} else {
|
||||
int minDepth = Math.max(0, caveBiome.getCaveMinDepthBelowSurface());
|
||||
int minDepth = Math.max(0, CaveBiomeBands.minDepthBelowSurface(caveBiome));
|
||||
if (depthBelowSurface < minDepth) {
|
||||
effectiveCaveBiome = surfaceBiome;
|
||||
}
|
||||
@@ -455,7 +460,7 @@ public class CaveCarving {
|
||||
}
|
||||
}
|
||||
|
||||
CaveProfile caveProfile = effectiveCaveBiome.getCaveProfile();
|
||||
CaveProfile caveProfile = CaveProfiles.declaredBy(effectiveCaveBiome);
|
||||
if (isProfileEnabled(caveProfile)) {
|
||||
resolved = caveProfile;
|
||||
}
|
||||
@@ -466,7 +471,7 @@ public class CaveCarving {
|
||||
|
||||
private void prefillProfileFieldSamples(int startX, int startZ, IrisComplex complex, BlendScratch blendScratch) {
|
||||
fillFieldHeights(complex.getHeightStream(), startX, startZ, blendScratch.fieldSurfaceHeights);
|
||||
fillFieldFluidPresence(complex.getFluidStream(), startX, startZ, blendScratch.fieldHasFluid);
|
||||
fillFieldFluidPresence(TerrainPalettes.of(engine), startX, startZ, blendScratch.fieldHasFluid);
|
||||
fillFieldObjects(complex.getRegionStream(), startX, startZ, blendScratch.fieldRegions);
|
||||
fillFieldObjects(complex.getTrueBiomeStream(), startX, startZ, blendScratch.fieldSurfaceBiomes);
|
||||
fillFieldObjects(complex.getCaveBiomeStream(), startX, startZ, blendScratch.fieldCaveBiomes);
|
||||
@@ -490,11 +495,11 @@ public class CaveCarving {
|
||||
}
|
||||
}
|
||||
|
||||
private void fillFieldFluidPresence(ProceduralStream<PlatformBlockState> stream, int startX, int startZ, boolean[] target) {
|
||||
private void fillFieldFluidPresence(TerrainPalettes palettes, int startX, int startZ, boolean[] target) {
|
||||
for (int fieldX = 0; fieldX < FIELD_SIZE; fieldX++) {
|
||||
int worldX = startX + fieldX;
|
||||
for (int fieldZ = 0; fieldZ < FIELD_SIZE; fieldZ++) {
|
||||
target[(fieldX * FIELD_SIZE) + fieldZ] = B.isFluid(stream.get(worldX, startZ + fieldZ));
|
||||
target[(fieldX * FIELD_SIZE) + fieldZ] = B.isFluid(palettes.fluidAt(worldX, startZ + fieldZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -680,7 +685,7 @@ public class CaveCarving {
|
||||
private final CaveProfile[] kernelProfiles = new CaveProfile[KERNEL_SIZE];
|
||||
private final double[] kernelProfileWeights = new double[KERNEL_SIZE];
|
||||
private final IdentityHashMap<CaveProfile, double[]> columnProfileWeights = new IdentityHashMap<>();
|
||||
private final IdentityHashMap<IrisDimensionCarvingEntry, IrisDimensionCarvingEntry[]> dimensionColumnPlans = new IdentityHashMap<>();
|
||||
private final IdentityHashMap<ResolvedCarvingEntry, ResolvedCarvingEntry[]> dimensionColumnPlans = new IdentityHashMap<>();
|
||||
private final IdentityHashMap<CaveProfile, Boolean> activeProfiles = new IdentityHashMap<>();
|
||||
private final List<CaveProfile> profileOrder = new ArrayList<>();
|
||||
private final double[] fieldSurfaceHeights = new double[FIELD_SIZE * FIELD_SIZE];
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import art.arcane.iris.engine.data.cache.Cache;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.mantle.EngineMantle;
|
||||
import art.arcane.iris.engine.modifier.FloatingIslands;
|
||||
import art.arcane.iris.engine.object.terrain.floating.FloatingChildren;
|
||||
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandBoundarySampler;
|
||||
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
@@ -56,7 +57,7 @@ final class FloatingIslandSampleResolver implements IslandObjectPlacer.SamplePro
|
||||
return sampleCache.get(key);
|
||||
}
|
||||
IrisBiome parent = parent(x, z);
|
||||
if (parent == null || parent.getFloatingChildBiomes() == null || parent.getFloatingChildBiomes().isEmpty()) {
|
||||
if (parent == null || FloatingChildren.declaredBy(parent).isEmpty()) {
|
||||
resolvedSamples.add(key);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -543,8 +543,8 @@ public class FloatingObjectPlacing {
|
||||
try {
|
||||
IrisData data = engine.getData();
|
||||
for (IrisBiome biome : engine.getDimension().getReachableBiomes(engine)) {
|
||||
List<FloatingChildBiome> settings = biome.getFloatingChildBiomes();
|
||||
if (settings == null || settings.isEmpty()) {
|
||||
List<FloatingChildBiome> settings = FloatingChildren.declaredBy(biome);
|
||||
if (settings.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
for (ResolvedFloatingChild entry : FloatingChildren.of(engine).of(settings)) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import art.arcane.iris.builtin.carve.CaveAnchorMode;
|
||||
import art.arcane.iris.builtin.carve.CaveProfile;
|
||||
import art.arcane.iris.builtin.anchor.ObjectPlaceMode;
|
||||
import art.arcane.iris.builtin.prepare.AxisRotationClamp;
|
||||
import art.arcane.iris.engine.object.terrain.carving.CaveProfiles;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectVacuum;
|
||||
import art.arcane.iris.core.IrisSettings;
|
||||
@@ -78,6 +79,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
* placement reach of any object the dimension can place.
|
||||
*/
|
||||
public class ObjectPlacing {
|
||||
private static final CaveProfile DEFAULT_CAVE_PROFILE = new CaveProfile();
|
||||
private static final long CAVE_REJECT_LOG_THROTTLE_MS = 5000L;
|
||||
private static final int BEDROCK_CLEARANCE = 6;
|
||||
private static final byte LIQUID_FORCED_AIR = 3;
|
||||
@@ -235,8 +237,8 @@ public class ObjectPlacing {
|
||||
int rejected = 0;
|
||||
int nullObjects = 0;
|
||||
int errors = 0;
|
||||
CaveProfile biomeCaveProfile = resolveCaveProfile(caveBiome.getCaveProfile(), region.getCaveProfile());
|
||||
CaveProfile regionCaveProfile = resolveCaveProfile(region.getCaveProfile(), caveBiome.getCaveProfile());
|
||||
CaveProfile biomeCaveProfile = resolveCaveProfile(CaveProfiles.declaredBy(caveBiome), CaveProfiles.declaredBy(region));
|
||||
CaveProfile regionCaveProfile = resolveCaveProfile(CaveProfiles.declaredBy(region), CaveProfiles.declaredBy(caveBiome));
|
||||
CaveAnchorCache caveAnchorCache = new CaveAnchorCache();
|
||||
|
||||
for (IrisObjectPlacement i : surfaceBiome.getSurfaceObjects()) {
|
||||
@@ -384,12 +386,12 @@ public class ObjectPlacing {
|
||||
|
||||
@ChunkCoordinates
|
||||
private void placeProceduralObjects(MantleWriter writer, RNG rng, int x, int z, IrisBiome surfaceBiome, IrisBiome caveBiome, IrisRegion region) {
|
||||
CaveProfile surfaceCaveProfile = resolveCaveProfile(surfaceBiome.getCaveProfile(), region.getCaveProfile());
|
||||
CaveProfile regionCaveProfile = resolveCaveProfile(region.getCaveProfile(), caveBiome == null ? null : caveBiome.getCaveProfile());
|
||||
CaveProfile surfaceCaveProfile = resolveCaveProfile(CaveProfiles.declaredBy(surfaceBiome), CaveProfiles.declaredBy(region));
|
||||
CaveProfile regionCaveProfile = resolveCaveProfile(CaveProfiles.declaredBy(region), caveBiome == null ? null : CaveProfiles.declaredBy(caveBiome));
|
||||
placeProceduralFrom(writer, rng, x, z, surfaceBiome.getProceduralObjects(), surfaceBiome.getName(), surfaceCaveProfile, surfaceBiome.getLoadKey());
|
||||
placeProceduralFrom(writer, rng, x, z, region.getProceduralObjects(), region.getName(), regionCaveProfile, null);
|
||||
if (caveBiome != null && caveBiome != surfaceBiome) {
|
||||
CaveProfile caveProfile = resolveCaveProfile(caveBiome.getCaveProfile(), region.getCaveProfile());
|
||||
CaveProfile caveProfile = resolveCaveProfile(CaveProfiles.declaredBy(caveBiome), CaveProfiles.declaredBy(region));
|
||||
placeProceduralFrom(writer, rng, x, z, caveBiome.getProceduralObjects(), caveBiome.getName(), caveProfile, caveBiome.getLoadKey());
|
||||
}
|
||||
}
|
||||
@@ -1319,7 +1321,7 @@ public class ObjectPlacing {
|
||||
}
|
||||
|
||||
private CaveProfile resolveCaveProfile(CaveProfile preferred, CaveProfile secondary) {
|
||||
CaveProfile dimensionProfile = engine.getDimension().getCaveProfile();
|
||||
CaveProfile dimensionProfile = CaveProfiles.declaredBy(engine.getDimension());
|
||||
if (preferred != null && preferred.enabled()) {
|
||||
return preferred;
|
||||
}
|
||||
@@ -1332,7 +1334,7 @@ public class ObjectPlacing {
|
||||
return dimensionProfile;
|
||||
}
|
||||
|
||||
return new CaveProfile();
|
||||
return DEFAULT_CAVE_PROFILE;
|
||||
}
|
||||
|
||||
private CaveAnchorMode resolveAnchorMode(IrisObjectPlacement objectPlacement, CaveProfile caveProfile) {
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.carve.CaveFieldModule;
|
||||
import art.arcane.iris.builtin.carve.CarvingBiomeSettings;
|
||||
import art.arcane.iris.builtin.carve.CarvingEnabledSettings;
|
||||
import art.arcane.iris.builtin.carve.CarvingSettings;
|
||||
import art.arcane.iris.builtin.carve.CaveDepthSettings;
|
||||
import art.arcane.iris.builtin.carve.CaveProfile;
|
||||
import com.volmit.FeatureRegistry;
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
@@ -28,6 +31,7 @@ import art.arcane.iris.engine.mantle.components.CaveCarving;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.service.CaveBiomes;
|
||||
import com.volmit.stage.ChunkStageContext;
|
||||
import com.volmit.stage.MantleStageContext;
|
||||
import com.volmit.stage.StageGraph;
|
||||
@@ -51,8 +55,12 @@ public final class CarveModule implements IrisModule {
|
||||
|
||||
@Override
|
||||
public void register(FeatureRegistry registry) {
|
||||
registry.registerHeldType(CaveProfile.class);
|
||||
registry.registerHeldType(CaveFieldModule.class);
|
||||
registry.registerSettings(CaveProfile.class);
|
||||
registry.registerSettings(CarvingSettings.class);
|
||||
registry.registerSettings(CarvingEnabledSettings.class);
|
||||
registry.registerSettings(CarvingBiomeSettings.class);
|
||||
registry.registerSettings(CaveDepthSettings.class);
|
||||
registry.registerService(CaveBiomes.class, new CaveBiomeBands());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,6 +91,6 @@ public final class CarveModule implements IrisModule {
|
||||
* also does: Iris then skips this stage's mantle pass like any disabled component.
|
||||
*/
|
||||
private static boolean carves(IrisDimension dimension) {
|
||||
return dimension.isCarvingEnabled();
|
||||
return dimension.getModuleSettings().find(CarvingEnabledSettings.class).map(CarvingEnabledSettings::enabled).orElse(true);
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,13 @@ package art.arcane.iris.engine.modifier;
|
||||
import art.arcane.iris.engine.UpperDimensionContext;
|
||||
import art.arcane.iris.builtin.decorant.DecorationPart;
|
||||
import art.arcane.iris.engine.decorator.BiomeDecorators;
|
||||
import art.arcane.iris.engine.terrain.BiomeLayers;
|
||||
import art.arcane.iris.engine.terrain.TerrainPalettes;
|
||||
import art.arcane.iris.engine.decorator.IrisCeilingDecorator;
|
||||
import art.arcane.iris.engine.decorator.IrisSurfaceDecorator;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.world.biome.InferredType;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
|
||||
import art.arcane.iris.util.project.context.ChunkContext;
|
||||
import art.arcane.iris.util.common.data.B;
|
||||
import art.arcane.volmlib.util.documentation.ChunkCoordinates;
|
||||
@@ -66,6 +67,8 @@ public class CaveApplying {
|
||||
private final PlatformBlockState AIR = B.getState("CAVE_AIR");
|
||||
private final PlatformBlockState LAVA = B.getState("LAVA");
|
||||
private final BiomeDecorators decorators;
|
||||
private final BiomeLayers layers;
|
||||
private final TerrainPalettes palettes;
|
||||
private final IrisSurfaceDecorator surfaceDecorator;
|
||||
private final IrisCeilingDecorator ceilingDecorator;
|
||||
|
||||
@@ -73,6 +76,8 @@ public class CaveApplying {
|
||||
this.engine = engine;
|
||||
rng = new RNG(engine.getSeedManager().getCarve());
|
||||
decorators = BiomeDecorators.of(engine);
|
||||
layers = BiomeLayers.of(engine);
|
||||
palettes = TerrainPalettes.of(engine);
|
||||
surfaceDecorator = new IrisSurfaceDecorator(engine);
|
||||
ceilingDecorator = new IrisCeilingDecorator(engine);
|
||||
}
|
||||
@@ -82,7 +87,6 @@ public class CaveApplying {
|
||||
public void apply(int x, int z, Hunk<PlatformBlockState> output, boolean multicore, ChunkContext context) {
|
||||
PrecisionStopwatch caveStopwatch = PrecisionStopwatch.start();
|
||||
Mantle<Matter> mantle = engine.getMantle().getMantle();
|
||||
IrisDimensionCarvingResolver.State resolverState = new IrisDimensionCarvingResolver.State();
|
||||
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache = new Long2ObjectOpenHashMap<>(2048);
|
||||
IrisCarveScratch scratch = SCRATCH.get();
|
||||
scratch.reset();
|
||||
@@ -151,7 +155,7 @@ public class CaveApplying {
|
||||
if (explicitCarveIntent) {
|
||||
// Only a fluid cavern consumes the fluid sample, and on the maintenance path that
|
||||
// sample is a full procedural stream evaluation, so never take it per voxel.
|
||||
PlatformBlockState fluid = isFluidIntent(cavern) ? context.getFluid().get(rx, rz) : null;
|
||||
PlatformBlockState fluid = isFluidIntent(cavern) ? palettes.fluidAt(chunkBlockX + rx, chunkBlockZ + rz) : null;
|
||||
output.setRaw(rx, yy, rz, resolveExplicitCarveState(cavern, fluid, LAVA, AIR));
|
||||
} else if (usesDefaultLava(caveLavaHeight, yy)) {
|
||||
output.setRaw(rx, yy, rz, LAVA);
|
||||
@@ -174,11 +178,11 @@ public class CaveApplying {
|
||||
int worldZ = rz + chunkBlockZ;
|
||||
String customBiome = cavern.getCustomBiome();
|
||||
IrisBiome biome = customBiome.isEmpty()
|
||||
? resolveCaveBiome(caveBiomeCache, worldX, yy, worldZ, resolverState)
|
||||
? resolveCaveBiome(caveBiomeCache, worldX, yy, worldZ)
|
||||
: resolveCustomBiome(customBiomeCache, customBiome);
|
||||
|
||||
if (biome != null) {
|
||||
PlatformBlockState data = biome.getWall().get(rng, worldX, yy, worldZ, engine.getData());
|
||||
PlatformBlockState data = layers.wall(biome).get(rng, worldX, yy, worldZ);
|
||||
int columnIndex = PowerOfTwoCoordinates.packLocal16(rx, rz);
|
||||
|
||||
if (data != null && B.isSolid(output.getRaw(rx, yy, rz)) && yy < surfaceHeights[columnIndex]) {
|
||||
@@ -188,14 +192,14 @@ public class CaveApplying {
|
||||
});
|
||||
|
||||
for (int columnIndex = 0; columnIndex < 256; columnIndex++) {
|
||||
processColumnFromMask(output, mantleChunk, mantle, columnMasks[columnIndex], columnIndex, x, z, resolverState, caveBiomeCache, customBiomeCache);
|
||||
processColumnFromMask(output, mantleChunk, mantle, columnMasks[columnIndex], columnIndex, x, z, caveBiomeCache, customBiomeCache);
|
||||
}
|
||||
|
||||
for (int columnIndex = 0; columnIndex < 256; columnIndex++) {
|
||||
if (boundaryMasks[columnIndex].isEmpty() || !columnMasks[columnIndex].isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
processBoundaryColumnFromMask(output, boundaryMasks[columnIndex], walls, columnIndex, x, z, resolverState, caveBiomeCache, customBiomeCache);
|
||||
processBoundaryColumnFromMask(output, boundaryMasks[columnIndex], walls, columnIndex, x, z, caveBiomeCache, customBiomeCache);
|
||||
}
|
||||
|
||||
// Surface-break carving must not leave an ore cap suspended across the opening.
|
||||
@@ -409,7 +413,6 @@ public class CaveApplying {
|
||||
int columnIndex,
|
||||
int chunkX,
|
||||
int chunkZ,
|
||||
IrisDimensionCarvingResolver.State resolverState,
|
||||
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache,
|
||||
Map<String, IrisBiome> customBiomeCache
|
||||
) {
|
||||
@@ -438,7 +441,7 @@ public class CaveApplying {
|
||||
zone.ceiling = buf;
|
||||
} else {
|
||||
if (zone.isValid(engine)) {
|
||||
processZone(output, mc, mantle, zone, rx, rz, worldX, worldZ, resolverState, caveBiomeCache, customBiomeCache);
|
||||
processZone(output, mc, mantle, zone, rx, rz, worldX, worldZ, caveBiomeCache, customBiomeCache);
|
||||
}
|
||||
zone = new CaveZone();
|
||||
zone.setFloor(y);
|
||||
@@ -450,7 +453,7 @@ public class CaveApplying {
|
||||
}
|
||||
|
||||
if (zone.isValid(engine)) {
|
||||
processZone(output, mc, mantle, zone, rx, rz, worldX, worldZ, resolverState, caveBiomeCache, customBiomeCache);
|
||||
processZone(output, mc, mantle, zone, rx, rz, worldX, worldZ, caveBiomeCache, customBiomeCache);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +464,6 @@ public class CaveApplying {
|
||||
int columnIndex,
|
||||
int chunkX,
|
||||
int chunkZ,
|
||||
IrisDimensionCarvingResolver.State resolverState,
|
||||
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache,
|
||||
Map<String, IrisBiome> customBiomeCache
|
||||
) {
|
||||
@@ -482,14 +484,14 @@ public class CaveApplying {
|
||||
if (y == zoneCeiling + 1) {
|
||||
zoneCeiling = y;
|
||||
} else {
|
||||
paintBoundaryZone(output, walls, rx, rz, worldX, worldZ, zoneFloor, zoneCeiling, resolverState, caveBiomeCache, customBiomeCache);
|
||||
paintBoundaryZone(output, walls, rx, rz, worldX, worldZ, zoneFloor, zoneCeiling, caveBiomeCache, customBiomeCache);
|
||||
zoneFloor = y;
|
||||
zoneCeiling = y;
|
||||
}
|
||||
y = boundaryMask.nextSetBit(y + 1);
|
||||
}
|
||||
|
||||
paintBoundaryZone(output, walls, rx, rz, worldX, worldZ, zoneFloor, zoneCeiling, resolverState, caveBiomeCache, customBiomeCache);
|
||||
paintBoundaryZone(output, walls, rx, rz, worldX, worldZ, zoneFloor, zoneCeiling, caveBiomeCache, customBiomeCache);
|
||||
}
|
||||
|
||||
private void paintBoundaryZone(
|
||||
@@ -501,22 +503,21 @@ public class CaveApplying {
|
||||
int worldZ,
|
||||
int zoneFloor,
|
||||
int zoneCeiling,
|
||||
IrisDimensionCarvingResolver.State resolverState,
|
||||
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache,
|
||||
Map<String, IrisBiome> customBiomeCache
|
||||
) {
|
||||
IrisBiome floorBiome = resolveCaveBoundaryBiome(
|
||||
walls.get(rx, zoneFloor, rz), worldX, zoneFloor, worldZ,
|
||||
resolverState, caveBiomeCache, customBiomeCache);
|
||||
caveBiomeCache, customBiomeCache);
|
||||
IrisBiome ceilingBiome = resolveCaveBoundaryBiome(
|
||||
walls.get(rx, zoneCeiling, rz), worldX, zoneCeiling, worldZ,
|
||||
resolverState, caveBiomeCache, customBiomeCache);
|
||||
caveBiomeCache, customBiomeCache);
|
||||
if (floorBiome == null && ceilingBiome == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (floorBiome != null) {
|
||||
KList<PlatformBlockState> floorLayers = floorBiome.generateLayers(
|
||||
KList<PlatformBlockState> floorLayers = layers.generateLayers(floorBiome,
|
||||
engine.getDimension(), worldX, worldZ, rng, 3, zoneFloor, engine.getData(), engine.getComplex());
|
||||
for (int i = 0; i < zoneFloor - 1; i++) {
|
||||
if (!floorLayers.hasIndex(i)) {
|
||||
@@ -541,7 +542,7 @@ public class CaveApplying {
|
||||
|
||||
if (ceilingBiome != null) {
|
||||
int worldMaxY = engine.getWorld().maxHeight() - engine.getWorld().minHeight();
|
||||
KList<PlatformBlockState> ceilingLayers = ceilingBiome.generateCeilingLayers(
|
||||
KList<PlatformBlockState> ceilingLayers = layers.generateCeilingLayers(ceilingBiome,
|
||||
engine.getDimension(), worldX, worldZ, rng, 3, zoneCeiling, engine.getData(), engine.getComplex());
|
||||
for (int i = 0; i < ceilingLayers.size(); i++) {
|
||||
int ceilingY = zoneCeiling + i + 1;
|
||||
@@ -574,7 +575,7 @@ public class CaveApplying {
|
||||
return (h & 15L) == 0L;
|
||||
}
|
||||
|
||||
private void processZone(Hunk<PlatformBlockState> output, MantleChunk<Matter> mc, Mantle<Matter> mantle, CaveZone zone, int rx, int rz, int xx, int zz, IrisDimensionCarvingResolver.State resolverState, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
|
||||
private void processZone(Hunk<PlatformBlockState> output, MantleChunk<Matter> mc, Mantle<Matter> mantle, CaveZone zone, int rx, int rz, int xx, int zz, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
|
||||
int maxY = output.getHeight();
|
||||
|
||||
if (zone.ceiling + 1 < maxY && B.isDecorant(output.getRaw(rx, zone.ceiling + 1, rz))) {
|
||||
@@ -596,14 +597,14 @@ public class CaveApplying {
|
||||
mantle.set(xx, zone.floor, zz, MarkerMatter.CAVE_FLOOR);
|
||||
}
|
||||
|
||||
IrisBiome floorBiome = resolveCaveBoundaryBiome(mc, rx, zone.floor, rz, xx, zz, resolverState, caveBiomeCache, customBiomeCache);
|
||||
IrisBiome ceilingBiome = resolveCaveBoundaryBiome(mc, rx, zone.ceiling, rz, xx, zz, resolverState, caveBiomeCache, customBiomeCache);
|
||||
IrisBiome floorBiome = resolveCaveBoundaryBiome(mc, rx, zone.floor, rz, xx, zz, caveBiomeCache, customBiomeCache);
|
||||
IrisBiome ceilingBiome = resolveCaveBoundaryBiome(mc, rx, zone.ceiling, rz, xx, zz, caveBiomeCache, customBiomeCache);
|
||||
if (floorBiome == null && ceilingBiome == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (floorBiome != null) {
|
||||
KList<PlatformBlockState> floorBlocks = floorBiome.generateLayers(engine.getDimension(), xx, zz, rng, 3, zone.floor, engine.getData(), engine.getComplex());
|
||||
KList<PlatformBlockState> floorBlocks = layers.generateLayers(floorBiome, engine.getDimension(), xx, zz, rng, 3, zone.floor, engine.getData(), engine.getComplex());
|
||||
for (int i = 0; i < zone.floor - 1; i++) {
|
||||
if (!floorBlocks.hasIndex(i)) {
|
||||
break;
|
||||
@@ -623,7 +624,7 @@ public class CaveApplying {
|
||||
}
|
||||
|
||||
if (ceilingBiome != null) {
|
||||
KList<PlatformBlockState> ceilingBlocks = ceilingBiome.generateCeilingLayers(engine.getDimension(), xx, zz, rng, 3, zone.ceiling, engine.getData(), engine.getComplex());
|
||||
KList<PlatformBlockState> ceilingBlocks = layers.generateCeilingLayers(ceilingBiome, engine.getDimension(), xx, zz, rng, 3, zone.ceiling, engine.getData(), engine.getComplex());
|
||||
for (int i = 0; i < ceilingBlocks.size(); i++) {
|
||||
int cy = zone.ceiling + i + 1;
|
||||
if (cy >= maxY) {
|
||||
@@ -651,10 +652,10 @@ public class CaveApplying {
|
||||
}
|
||||
}
|
||||
|
||||
IrisBiome resolveCaveBoundaryBiome(MantleChunk<Matter> mantleChunk, int x, int y, int z, int worldX, int worldZ, IrisDimensionCarvingResolver.State resolverState, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
|
||||
IrisBiome resolveCaveBoundaryBiome(MantleChunk<Matter> mantleChunk, int x, int y, int z, int worldX, int worldZ, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
|
||||
MatterCavern cavern = dataIfPresent(mantleChunk, x, y, z, MatterCavern.class);
|
||||
return resolveCaveBoundaryBiome(
|
||||
cavern, worldX, y, worldZ, resolverState, caveBiomeCache, customBiomeCache);
|
||||
cavern, worldX, y, worldZ, caveBiomeCache, customBiomeCache);
|
||||
}
|
||||
|
||||
private static <T> T dataIfPresent(MantleChunk<Matter> mantleChunk, int x, int y, int z, Class<T> type) {
|
||||
@@ -669,11 +670,11 @@ public class CaveApplying {
|
||||
return matter.<T>getSlice(type).get(x & 15, y & 15, z & 15);
|
||||
}
|
||||
|
||||
IrisBiome resolveCaveBoundaryBiome(MatterCavern cavern, int worldX, int y, int worldZ, IrisDimensionCarvingResolver.State resolverState, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
|
||||
IrisBiome resolveCaveBoundaryBiome(MatterCavern cavern, int worldX, int y, int worldZ, Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, Map<String, IrisBiome> customBiomeCache) {
|
||||
if (cavern != null && !cavern.getCustomBiome().isEmpty()) {
|
||||
return resolveCustomBiome(customBiomeCache, cavern.getCustomBiome());
|
||||
}
|
||||
return resolveCaveBiome(caveBiomeCache, worldX, y, worldZ, resolverState);
|
||||
return resolveCaveBiome(caveBiomeCache, worldX, y, worldZ);
|
||||
}
|
||||
|
||||
static boolean canReplaceCaveFloorLayer(Hunk<PlatformBlockState> output, int x, int y, int z, PlatformBlockState layer) {
|
||||
@@ -695,16 +696,16 @@ public class CaveApplying {
|
||||
return state != null && state.hasGravity();
|
||||
}
|
||||
|
||||
private IrisBiome resolveCaveBiome(Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, int x, int y, int z, IrisDimensionCarvingResolver.State resolverState) {
|
||||
IrisBiome center = sampleCaveBiome(caveBiomeCache, x, y, z, resolverState);
|
||||
private IrisBiome resolveCaveBiome(Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, int x, int y, int z) {
|
||||
IrisBiome center = sampleCaveBiome(caveBiomeCache, x, y, z);
|
||||
if (center == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IrisBiome xPos = sampleCaveBiome(caveBiomeCache, x + CAVE_BIOME_BLEND_RADIUS, y, z, resolverState);
|
||||
IrisBiome xNeg = sampleCaveBiome(caveBiomeCache, x - CAVE_BIOME_BLEND_RADIUS, y, z, resolverState);
|
||||
IrisBiome zPos = sampleCaveBiome(caveBiomeCache, x, y, z + CAVE_BIOME_BLEND_RADIUS, resolverState);
|
||||
IrisBiome zNeg = sampleCaveBiome(caveBiomeCache, x, y, z - CAVE_BIOME_BLEND_RADIUS, resolverState);
|
||||
IrisBiome xPos = sampleCaveBiome(caveBiomeCache, x + CAVE_BIOME_BLEND_RADIUS, y, z);
|
||||
IrisBiome xNeg = sampleCaveBiome(caveBiomeCache, x - CAVE_BIOME_BLEND_RADIUS, y, z);
|
||||
IrisBiome zPos = sampleCaveBiome(caveBiomeCache, x, y, z + CAVE_BIOME_BLEND_RADIUS);
|
||||
IrisBiome zNeg = sampleCaveBiome(caveBiomeCache, x, y, z - CAVE_BIOME_BLEND_RADIUS);
|
||||
|
||||
if (xPos == center && xNeg == center && zPos == center && zNeg == center) {
|
||||
return center;
|
||||
@@ -727,14 +728,14 @@ public class CaveApplying {
|
||||
return zNeg != null ? zNeg : center;
|
||||
}
|
||||
|
||||
private IrisBiome sampleCaveBiome(Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, int x, int y, int z, IrisDimensionCarvingResolver.State resolverState) {
|
||||
private IrisBiome sampleCaveBiome(Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache, int x, int y, int z) {
|
||||
long key = BlockPosition.toLong(x, y, z);
|
||||
IrisBiome cachedBiome = caveBiomeCache.get(key);
|
||||
if (cachedBiome != null) {
|
||||
return cachedBiome;
|
||||
}
|
||||
|
||||
IrisBiome resolvedBiome = engine.getCaveBiome(x, y, z, resolverState);
|
||||
IrisBiome resolvedBiome = engine.getCaveBiome(x, y, z);
|
||||
if (resolvedBiome != null) {
|
||||
caveBiomeCache.put(key, resolvedBiome);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.carve.CaveDepthSettings;
|
||||
import art.arcane.iris.core.modules.IrisPackWorld;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.terrain.carving.CarvingResolver;
|
||||
import art.arcane.iris.engine.object.terrain.carving.ResolvedCarvingEntry;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import com.volmit.service.CaveBiomes;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* What the carve module tells the host about cave biomes ({@link CaveBiomes}): the biome of the dimension's carving band at a
|
||||
* position, and how far below the surface a biome's caves begin.
|
||||
*/
|
||||
public final class CaveBiomeBands implements CaveBiomes {
|
||||
@Override
|
||||
public Optional<String> overriddenBiome(PackWorld world, int x, int y, int z) {
|
||||
Engine engine = IrisPackWorld.of(world).engine();
|
||||
ResolvedCarvingEntry rootEntry = CarvingResolver.resolveRootEntry(engine, y + engine.getWorld().minHeight(), null);
|
||||
if (rootEntry == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
ResolvedCarvingEntry entry = CarvingResolver.resolveFromRoot(engine, rootEntry, x, z, null);
|
||||
if (CarvingResolver.resolveEntryBiome(engine, entry, null) == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(entry.biomeKey().trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minDepthBelowSurface(PackWorld world, String biomeKey) {
|
||||
IrisBiome biome = IrisPackWorld.of(world).engine().getData().getBiomeLoader().load(biomeKey);
|
||||
return biome == null ? 0 : minDepthBelowSurface(biome);
|
||||
}
|
||||
|
||||
/** How many blocks below the surface {@code biome}'s caves begin, as its {@code caveMinDepthBelowSurface} says; 0 where it says none. */
|
||||
public static int minDepthBelowSurface(IrisBiome biome) {
|
||||
return biome.getModuleSettings().find(CaveDepthSettings.class).map(CaveDepthSettings::depth).orElse(0);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,11 @@ package art.arcane.iris.engine.modifier;
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.builtin.deposit.DepositGenerator;
|
||||
import art.arcane.iris.builtin.deposit.DepositSettings;
|
||||
import art.arcane.iris.builtin.deposit.DepositVariantSettings;
|
||||
import art.arcane.iris.builtin.deposit.OreFrequencySettings;
|
||||
import art.arcane.iris.builtin.deposit.OreSizeSettings;
|
||||
import art.arcane.iris.core.modules.IrisChunk;
|
||||
import com.volmit.FeatureRegistry;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
@@ -48,6 +52,13 @@ public final class DepositModule implements IrisModule {
|
||||
return ModuleInfo.of("iris:deposit", "Deposits", VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(FeatureRegistry registry) {
|
||||
registry.registerSettings(DepositVariantSettings.class);
|
||||
registry.registerSettings(OreFrequencySettings.class);
|
||||
registry.registerSettings(OreSizeSettings.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void install(StageGraph graph) {
|
||||
graph.define(IrisStages.Deposit.ORES)
|
||||
|
||||
@@ -21,12 +21,15 @@ package art.arcane.iris.engine.modifier;
|
||||
import art.arcane.iris.builtin.deposit.DepositGenerator;
|
||||
import art.arcane.iris.builtin.deposit.DepositHeightDistribution;
|
||||
import art.arcane.iris.builtin.deposit.DepositPlacementScope;
|
||||
import art.arcane.iris.builtin.deposit.DepositVariant;
|
||||
import art.arcane.iris.builtin.deposit.DepositVariantSettings;
|
||||
import art.arcane.iris.builtin.deposit.OreFrequencySettings;
|
||||
import art.arcane.iris.builtin.deposit.OreSizeSettings;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.EngineAssignedComponent;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.terrain.deposit.IrisDepositVariant;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.engine.object.terrain.carving.IrisDimensionCarvingResolver;
|
||||
import art.arcane.iris.engine.object.prefab.IrisObject;
|
||||
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
|
||||
import art.arcane.iris.engine.object.world.region.IrisRegion;
|
||||
@@ -52,7 +55,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class DepositPlacer extends EngineAssignedComponent {
|
||||
private final RNG rng;
|
||||
private static final double UNCHANGED_ORE_MULTIPLIER = 1D;
|
||||
|
||||
private final Map<DepositGenerator, ResolvedDeposit> resolved = new ConcurrentHashMap<>();
|
||||
private final Map<DepositVariant, ResolvedDepositVariant> variants = new ConcurrentHashMap<>();
|
||||
|
||||
public DepositPlacer(Engine engine) {
|
||||
super(engine, "Deposit");
|
||||
@@ -95,7 +101,6 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
}
|
||||
|
||||
public void generate(DepositGenerator k, MantleChunk chunk, Hunk<PlatformBlockState> data, RNG rng, int cx, int cz, boolean safe, HeightMap he, ChunkContext context) {
|
||||
IrisDimensionCarvingResolver.State carvingState = new IrisDimensionCarvingResolver.State();
|
||||
ResolvedDeposit deposit = resolved(k);
|
||||
if (k.spawnChance() < rng.d())
|
||||
return;
|
||||
@@ -141,8 +146,7 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
boolean oreDeposit = deposit.isOre();
|
||||
IrisBiome surfaceBiome = context.getBiome().get(x, z);
|
||||
IrisBiome depositBiome = oreDeposit || k.usesCaveBiomeFilter()
|
||||
? getEngine().getCaveBiome(
|
||||
(cx << 4) + x, biomeY, (cz << 4) + z, carvingState)
|
||||
? getEngine().getCaveBiome((cx << 4) + x, biomeY, (cz << 4) + z)
|
||||
: null;
|
||||
if (!deposit.matchesBiome(surfaceBiome, depositBiome)) {
|
||||
continue;
|
||||
@@ -150,13 +154,13 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
|
||||
if (oreDeposit) {
|
||||
if (depositBiome != null) {
|
||||
double frequencyMultiplier = depositBiome.getOreDepositFrequencyMultiplier();
|
||||
double frequencyMultiplier = oreFrequencyMultiplier(depositBiome);
|
||||
if (frequencyMultiplier < 1D
|
||||
&& !passesOreFrequency(frequencyMultiplier, rng.d())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double sizeMultiplier = depositBiome.getOreDepositSizeMultiplier();
|
||||
double sizeMultiplier = oreSizeMultiplier(depositBiome);
|
||||
if (sizeMultiplier != 1D) {
|
||||
IrisObject scaledClump = deposit.clump(rng, sizeMultiplier);
|
||||
int scaledDimension = scaledClump.getW();
|
||||
@@ -204,7 +208,7 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
if (chunk.get(nx, ny, nz, MatterCavern.class) == null) {
|
||||
PlatformBlockState ore = clump.getBlocks().get(j);
|
||||
PlatformBlockState remapped = resolveDepositVariant(
|
||||
cx, cz, nx, ny, nz, ore, dimension, context, carvingState);
|
||||
cx, cz, nx, ny, nz, ore, dimension, context);
|
||||
PlatformBlockState finalBlock = remapped != null
|
||||
? remapped
|
||||
: B.toDeepSlateOre(current, ore);
|
||||
@@ -310,14 +314,14 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
return Math.max(minimum, Math.min(center, maximum));
|
||||
}
|
||||
|
||||
private PlatformBlockState resolveDepositVariant(int cx, int cz, int nx, int localY, int nz, PlatformBlockState ore, IrisDimension dimension, ChunkContext context, IrisDimensionCarvingResolver.State carvingState) {
|
||||
private PlatformBlockState resolveDepositVariant(int cx, int cz, int nx, int localY, int nz, PlatformBlockState ore, IrisDimension dimension, ChunkContext context) {
|
||||
int worldX = (cx << 4) + nx;
|
||||
int worldZ = (cz << 4) + nz;
|
||||
int worldY = absoluteWorldY(getEngine().getMinHeight(), localY);
|
||||
|
||||
IrisBiome biome = getEngine().getCaveBiome(worldX, localY, worldZ, carvingState);
|
||||
IrisBiome biome = getEngine().getCaveBiome(worldX, localY, worldZ);
|
||||
if (biome != null) {
|
||||
PlatformBlockState match = matchDepositVariant(biome.getDepositVariants(), ore, worldY);
|
||||
PlatformBlockState match = matchDepositVariant(biome, ore, worldY);
|
||||
if (match != null) {
|
||||
return match;
|
||||
}
|
||||
@@ -325,14 +329,14 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
|
||||
IrisRegion region = context.getRegion().get(nx, nz);
|
||||
if (region != null) {
|
||||
PlatformBlockState match = matchDepositVariant(region.getDepositVariants(), ore, worldY);
|
||||
PlatformBlockState match = matchDepositVariant(region, ore, worldY);
|
||||
if (match != null) {
|
||||
return match;
|
||||
}
|
||||
}
|
||||
|
||||
if (dimension != null) {
|
||||
PlatformBlockState match = matchDepositVariant(dimension.getDepositVariants(), ore, worldY);
|
||||
PlatformBlockState match = matchDepositVariant(dimension, ore, worldY);
|
||||
if (match != null) {
|
||||
return match;
|
||||
}
|
||||
@@ -341,17 +345,14 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
return null;
|
||||
}
|
||||
|
||||
private PlatformBlockState matchDepositVariant(java.util.List<IrisDepositVariant> variants, PlatformBlockState ore, int y) {
|
||||
if (variants == null || variants.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (IrisDepositVariant variant : variants) {
|
||||
if (y < variant.getMinHeight() || y > variant.getMaxHeight()) {
|
||||
private PlatformBlockState matchDepositVariant(IrisRegistrant owner, PlatformBlockState ore, int y) {
|
||||
for (DepositVariant declared : variantsOf(owner)) {
|
||||
ResolvedDepositVariant variant = variants.computeIfAbsent(declared, ResolvedDepositVariant::new);
|
||||
if (!variant.appliesAt(y)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlatformBlockState swapped = variant.remapOrNull(ore, getData());
|
||||
PlatformBlockState swapped = variant.remapOrNull(ore);
|
||||
if (swapped != null) {
|
||||
return swapped;
|
||||
}
|
||||
@@ -359,4 +360,16 @@ public class DepositPlacer extends EngineAssignedComponent {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<DepositVariant> variantsOf(IrisRegistrant owner) {
|
||||
return owner.getModuleSettings().find(DepositVariantSettings.class).map(DepositVariantSettings::variants).orElse(List.of());
|
||||
}
|
||||
|
||||
private static double oreFrequencyMultiplier(IrisBiome biome) {
|
||||
return biome.getModuleSettings().find(OreFrequencySettings.class).map(OreFrequencySettings::multiplier).orElse(UNCHANGED_ORE_MULTIPLIER);
|
||||
}
|
||||
|
||||
private static double oreSizeMultiplier(IrisBiome biome) {
|
||||
return biome.getModuleSettings().find(OreSizeSettings.class).map(OreSizeSettings::multiplier).orElse(UNCHANGED_ORE_MULTIPLIER);
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,11 @@
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
|
||||
import art.arcane.iris.engine.object.terrain.floating.FloatingChildren;
|
||||
import art.arcane.iris.engine.object.terrain.floating.ResolvedFloatingChild;
|
||||
import art.arcane.iris.builtin.floating.FloatingBottomPaletteMode;
|
||||
import art.arcane.iris.builtin.prepare.SlopeClip;
|
||||
import art.arcane.iris.builtin.terrain.PaletteLayer;
|
||||
import art.arcane.iris.engine.object.world.biome.custom.IrisBiomeCustom;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.engine.IrisComplex;
|
||||
@@ -32,7 +34,8 @@ import art.arcane.iris.engine.framework.EngineDecorator;
|
||||
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandBoundarySampler;
|
||||
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandSample;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.engine.object.terrain.IrisBiomePaletteLayer;
|
||||
import art.arcane.iris.engine.terrain.BiomeLayers;
|
||||
import art.arcane.iris.engine.terrain.ResolvedLayer;
|
||||
import art.arcane.iris.builtin.decorant.DecorationPart;
|
||||
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
@@ -64,15 +67,16 @@ public class FloatingIslands {
|
||||
private final Engine engine;
|
||||
private final RNG rng;
|
||||
private final EngineDecorator seaSurfaceDecorator;
|
||||
private final BiomeLayers biomeLayers;
|
||||
|
||||
private static KList<PlatformBlockState> generateBottomPaletteLayers(ResolvedFloatingChild entry, IrisDimension dimension, double wx, double wz, RNG random, int paletteDepth, IrisData data, IrisComplex complex) {
|
||||
private KList<PlatformBlockState> generateBottomPaletteLayers(ResolvedFloatingChild entry, IrisDimension dimension, double wx, double wz, RNG random, int paletteDepth, IrisData data, IrisComplex complex) {
|
||||
if (entry == null || entry.settings().bottomPaletteMode() != FloatingBottomPaletteMode.CUSTOM || entry.settings().bottomPalette() == null || entry.settings().bottomPalette().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return generatePaletteLayers(dimension, 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 KList<PlatformBlockState> generatePaletteLayers(IrisDimension dimension, KList<PaletteLayer> layers, double wx, double wz, RNG random, int maxDepth, IrisData data, IrisComplex complex) {
|
||||
KList<PlatformBlockState> generated = new KList<>();
|
||||
if (layers == null || layers.isEmpty() || maxDepth <= 0) {
|
||||
return generated;
|
||||
@@ -80,13 +84,13 @@ public class FloatingIslands {
|
||||
|
||||
int generatorSeed = 7235;
|
||||
for (int i = 0; i < layers.size(); i++) {
|
||||
IrisBiomePaletteLayer layer = layers.get(i);
|
||||
CNG heightGenerator = layer.getHeightGenerator(random.nextParallelRNG((generatorSeed++) * generatorSeed * generatorSeed * generatorSeed), data);
|
||||
ResolvedLayer layer = biomeLayers.resolve(layers.get(i));
|
||||
CNG heightGenerator = layer.heightNoise(random.nextParallelRNG((generatorSeed++) * generatorSeed * generatorSeed * generatorSeed));
|
||||
if (heightGenerator == null) {
|
||||
continue;
|
||||
}
|
||||
double layerDepth = heightGenerator.fit(layer.getMinHeight(), layer.getMaxHeight(), wx / layer.getZoom(), wz / layer.getZoom());
|
||||
SlopeClip slopeClip = layer.getSlopeCondition();
|
||||
double layerDepth = heightGenerator.fit(layer.minHeight(), layer.maxHeight(), wx / layer.zoom(), wz / layer.zoom());
|
||||
SlopeClip slopeClip = layer.slopeCondition();
|
||||
|
||||
if (slopeClip != null && !slopeClip.isDefault() && complex != null && !slopeClip.isValid(complex.getSlopeStream().get(wx, wz))) {
|
||||
layerDepth = 0;
|
||||
@@ -102,7 +106,7 @@ public class FloatingIslands {
|
||||
}
|
||||
|
||||
try {
|
||||
generated.add(layer.get(random.nextParallelRNG(i + j), (wx + j) / layer.getZoom(), j, (wz - j) / layer.getZoom(), data));
|
||||
generated.add(layer.get(random.nextParallelRNG(i + j), (wx + j) / layer.zoom(), j, (wz - j) / layer.zoom()));
|
||||
} catch (Throwable e) {
|
||||
IrisLogging.reportError(e);
|
||||
}
|
||||
@@ -183,9 +187,9 @@ public class FloatingIslands {
|
||||
IrisBiome target = entry == null ? parent : entry.getRealBiome(parent, data);
|
||||
int entrySeed = entry == null || entry.settings().biome() == null ? 0 : entry.settings().biome().hashCode();
|
||||
RNG layerRng = rng.nextParallelRNG((int) (colSeed ^ 0x7A4E ^ entrySeed));
|
||||
KList<PlatformBlockState> topBlocks = target == null ? null : target.generateLayers(dimension, wx, wz, layerRng, paletteDepth, paletteDepth, data, complex);
|
||||
KList<PlatformBlockState> topBlocks = target == null ? null : biomeLayers.generateLayers(target, dimension, wx, wz, layerRng, paletteDepth, paletteDepth, data, complex);
|
||||
if (topBlocks == null || topBlocks.isEmpty()) {
|
||||
topBlocks = parent.generateLayers(dimension, wx, wz, layerRng, paletteDepth, paletteDepth, data, complex);
|
||||
topBlocks = biomeLayers.generateLayers(parent, dimension, wx, wz, layerRng, paletteDepth, paletteDepth, data, complex);
|
||||
}
|
||||
KList<PlatformBlockState> bottomBlocks = generateBottomPaletteLayers(entry, dimension, wx, wz, layerRng, paletteDepth, data, complex);
|
||||
return new PaletteContext(topBlocks, bottomBlocks, B.getState("minecraft:stone"));
|
||||
@@ -207,6 +211,7 @@ public class FloatingIslands {
|
||||
this.engine = engine;
|
||||
rng = new RNG(engine.getSeedManager().getTerrain() ^ 0x7EB0A73F1DCE514DL);
|
||||
seaSurfaceDecorator = new IrisSeaSurfaceDecorator(engine);
|
||||
biomeLayers = BiomeLayers.of(engine);
|
||||
}
|
||||
|
||||
/** Fills the islands' solids into the chunk whose first block is {@code x}, {@code z}. */
|
||||
@@ -225,7 +230,7 @@ public class FloatingIslands {
|
||||
int wx = x + xf;
|
||||
int wz = z + zf;
|
||||
IrisBiome parent = boundarySampler.parent(wx, wz);
|
||||
if (parent == null || parent.getFloatingChildBiomes() == null || parent.getFloatingChildBiomes().isEmpty()) {
|
||||
if (parent == null || FloatingChildren.declaredBy(parent).isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
FloatingIslandSample sample = FloatingIslandSample.sampleMemoized(parent, wx, wz, chunkHeight, baseSeed, data, engine, boundarySampler);
|
||||
@@ -310,7 +315,7 @@ public class FloatingIslands {
|
||||
int wx = x + xf;
|
||||
int wz = z + zf;
|
||||
IrisBiome parent = boundarySampler.parent(wx, wz);
|
||||
if (parent == null || parent.getFloatingChildBiomes() == null || parent.getFloatingChildBiomes().isEmpty()) {
|
||||
if (parent == null || FloatingChildren.declaredBy(parent).isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
FloatingIslandSample sample = FloatingIslandSample.sampleMemoized(parent, wx, wz, chunkHeight, baseSeed, data, engine, boundarySampler);
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.floating.FloatingChildBiome;
|
||||
import art.arcane.iris.builtin.floating.FloatingChildSettings;
|
||||
import art.arcane.iris.builtin.floating.MergeFloatingChildrenSettings;
|
||||
import com.volmit.FeatureRegistry;
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.core.modules.IrisChunk;
|
||||
@@ -50,7 +51,8 @@ public final class FloatingModule implements IrisModule {
|
||||
|
||||
@Override
|
||||
public void register(FeatureRegistry registry) {
|
||||
registry.registerHeldType(FloatingChildBiome.class);
|
||||
registry.registerSettings(FloatingChildSettings.class);
|
||||
registry.registerSettings(MergeFloatingChildrenSettings.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.builtin.PendingSettings;
|
||||
import art.arcane.iris.builtin.terrain.HideOresSettings;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
@@ -44,6 +44,7 @@ import java.util.Map;
|
||||
public final class PerfectionModule implements IrisModule {
|
||||
private static final String VERSION = "built-in";
|
||||
private static final String HALF = "half";
|
||||
private static final int CENTER = 7;
|
||||
private static final BlockState AIR = new BlockState("minecraft:air");
|
||||
private static final Map<ResourceId, BlockState> ORE_BASES = oreBases();
|
||||
|
||||
@@ -59,7 +60,7 @@ public final class PerfectionModule implements IrisModule {
|
||||
|
||||
private static void perfect(ChunkStageContext context) {
|
||||
Hunk<BlockState> blocks = context.hunk(BlockState.class);
|
||||
if (PendingSettings.of(context.world()).hidesOres()) {
|
||||
if (hidesOres(context)) {
|
||||
hideOres(blocks, new IdentityHashMap<>());
|
||||
}
|
||||
Surfaces surfaces = new Surfaces(blocks, context.resources().blocks(), new IdentityHashMap<>());
|
||||
@@ -69,6 +70,12 @@ public final class PerfectionModule implements IrisModule {
|
||||
} while (removed);
|
||||
}
|
||||
|
||||
/** The dimension's {@code hideOresForHiddenOre}, which every column of the chunk shares. */
|
||||
private static boolean hidesOres(ChunkStageContext context) {
|
||||
return context.settings().at(HideOresSettings.class, context.originX() + CENTER, context.originZ() + CENTER).stream()
|
||||
.anyMatch(entry -> entry.value().hide());
|
||||
}
|
||||
|
||||
/** {@code hidden} remembers per state instance what it is hidden as, itself for a block that is no ore. */
|
||||
private static void hideOres(Hunk<BlockState> blocks, Map<BlockState, BlockState> hidden) {
|
||||
for (int x = 0; x < blocks.getWidth(); x++) {
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.IrisStages;
|
||||
import art.arcane.iris.builtin.post.PostProcessingSettings;
|
||||
import art.arcane.iris.builtin.post.PostProcessingSlabsSettings;
|
||||
import art.arcane.iris.builtin.post.PostProcessingWallsSettings;
|
||||
import com.volmit.FeatureRegistry;
|
||||
import com.volmit.IrisModule;
|
||||
import com.volmit.ModuleInfo;
|
||||
import com.volmit.stage.StageGraph;
|
||||
@@ -32,6 +36,13 @@ public final class PostModule implements IrisModule {
|
||||
return ModuleInfo.of("iris:post", "Post-processing", VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(FeatureRegistry registry) {
|
||||
registry.registerSettings(PostProcessingSettings.class);
|
||||
registry.registerSettings(PostProcessingSlabsSettings.class);
|
||||
registry.registerSettings(PostProcessingWallsSettings.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void install(StageGraph graph) {
|
||||
graph.define(IrisStages.Post.SMOOTH).requires(IrisStages.Carve.APPLY).run(SurfaceSmoothing::smooth);
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.deposit.DepositVariant;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.procedural.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.util.common.data.B;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* One {@link DepositVariant} made ready: its source and replacement block ids resolved to the platform's blocks, built once on
|
||||
* first use. A rule whose source or replacement the platform does not know remaps nothing.
|
||||
*/
|
||||
final class ResolvedDepositVariant {
|
||||
private final DepositVariant settings;
|
||||
private final AtomicCache<Map<String, PlatformBlockState>> remapped = new AtomicCache<>();
|
||||
|
||||
ResolvedDepositVariant(DepositVariant settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
boolean appliesAt(int worldY) {
|
||||
return worldY >= settings.minHeight() && worldY <= settings.maxHeight();
|
||||
}
|
||||
|
||||
/** The block {@code ore} is rewritten to, or null when the rule does not remap its material. */
|
||||
PlatformBlockState remapOrNull(PlatformBlockState ore) {
|
||||
if (ore == null || settings.remap().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return remapped.aquire(this::resolveRemap).get(IrisProceduralBlocks.materialKey(ore));
|
||||
}
|
||||
|
||||
private Map<String, PlatformBlockState> resolveRemap() {
|
||||
Map<String, PlatformBlockState> resolved = new HashMap<>();
|
||||
for (Map.Entry<String, String> entry : settings.remap().entrySet()) {
|
||||
PlatformBlockState source = B.getStateOrNull(entry.getKey(), false);
|
||||
PlatformBlockState target = B.getStateOrNull(entry.getValue(), true);
|
||||
if (source == null || target == null) {
|
||||
continue;
|
||||
}
|
||||
resolved.put(IrisProceduralBlocks.materialKey(source), target);
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
}
|
||||
@@ -18,18 +18,27 @@
|
||||
|
||||
package art.arcane.iris.engine.modifier;
|
||||
|
||||
import art.arcane.iris.builtin.PendingSettings;
|
||||
import art.arcane.iris.builtin.PendingSettings.BiomeLayer;
|
||||
import art.arcane.iris.builtin.IrisSeed;
|
||||
import art.arcane.iris.builtin.post.PostProcessingSlabsSettings;
|
||||
import art.arcane.iris.builtin.post.PostProcessingWallsSettings;
|
||||
import art.arcane.iris.builtin.terrain.LayerBlocks;
|
||||
import art.arcane.iris.builtin.terrain.PaletteLayer;
|
||||
import art.arcane.iris.builtin.terrain.SlabSettings;
|
||||
import art.arcane.iris.builtin.terrain.WallSettings;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.IrisFeature;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.block.BlockTrait;
|
||||
import com.volmit.hunk.Hunk;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.stage.ChunkStageContext;
|
||||
import com.volmit.world.TerrainSampler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Smooths the carved surface of one chunk for {@link PostModule}: floating nibs, single-block bumps and potholes,
|
||||
@@ -45,6 +54,11 @@ final class SurfaceSmoothing {
|
||||
private static final String SLAB_SUFFIX = "_slab";
|
||||
private static final String WATERLOGGED = "waterlogged";
|
||||
private static final String TRUE = "true";
|
||||
private static final int CENTER = 7;
|
||||
/** A biome without a wall or slab picks no block. */
|
||||
private static final PaletteLayer NO_LAYER = PaletteLayer.withoutBlocks();
|
||||
/** Walls and slabs are picked once per column: the first signature of a layer's noise. */
|
||||
private static final int COLUMN_SIGNATURE = 0;
|
||||
/** The face properties of a connecting block, such as a vine's, each with the neighbour it faces. */
|
||||
private static final List<Face> FACES = List.of(new Face("north", 0, 0, -1), new Face("east", 1, 0, 0),
|
||||
new Face("south", 0, 0, 1), new Face("west", -1, 0, 0), new Face("up", 0, 1, 0), new Face("down", 0, -1, 0));
|
||||
@@ -52,7 +66,9 @@ final class SurfaceSmoothing {
|
||||
private final Hunk<BlockState> blocks;
|
||||
private final BlockRegistry registry;
|
||||
private final TerrainSampler terrain;
|
||||
private final PendingSettings settings;
|
||||
private final FeatureSettings settings;
|
||||
private final LayerBlocks layerBlocks;
|
||||
private final RNG postRandom;
|
||||
private final int originX;
|
||||
private final int originZ;
|
||||
private final int planeWidth;
|
||||
@@ -65,13 +81,15 @@ final class SurfaceSmoothing {
|
||||
this.blocks = context.hunk(BlockState.class);
|
||||
this.registry = context.resources().blocks();
|
||||
this.terrain = context.terrain();
|
||||
this.settings = PendingSettings.of(context.world());
|
||||
this.settings = context.settings();
|
||||
this.layerBlocks = LayerBlocks.of(context.world());
|
||||
this.postRandom = new RNG(IrisSeed.POST.of(context.world()));
|
||||
this.originX = context.originX();
|
||||
this.originZ = context.originZ();
|
||||
this.planeWidth = blocks.getWidth() + 2;
|
||||
this.heights = heightPlane();
|
||||
this.walls = settings.postProcessingWalls();
|
||||
this.slabs = settings.postProcessingSlabs();
|
||||
this.walls = enabled(PostProcessingWallsSettings.class, PostProcessingWallsSettings::enabled, PostProcessingWallsSettings.DEFAULT_ENABLED);
|
||||
this.slabs = enabled(PostProcessingSlabsSettings.class, PostProcessingSlabsSettings::enabled, PostProcessingSlabsSettings.DEFAULT_ENABLED);
|
||||
this.fluidHeight = terrain.fluidHeight();
|
||||
}
|
||||
|
||||
@@ -93,6 +111,24 @@ final class SurfaceSmoothing {
|
||||
* resolve the same height up to five times. Resolve the padded plane once instead. The four diagonal
|
||||
* corners are never read, so they are left unresolved.
|
||||
*/
|
||||
/** A switch of the dimension, which every column of the chunk shares. */
|
||||
private <S extends IrisFeature> boolean enabled(Class<S> type, Function<S, Boolean> enabled, boolean byDefault) {
|
||||
List<Entry<S>> entries = settings.at(type, originX + CENTER, originZ + CENTER);
|
||||
return entries.isEmpty() ? byDefault : enabled.apply(entries.getFirst().value());
|
||||
}
|
||||
|
||||
/** The biome layer of the column's surface biome that {@code type} holds, or none. */
|
||||
private <S extends IrisFeature> PaletteLayer biomeLayer(Class<S> type, Function<S, PaletteLayer> layer, int x, int z) {
|
||||
List<Entry<S>> entries = settings.at(type, x, z);
|
||||
return entries.isEmpty() ? NO_LAYER : layer.apply(entries.getLast().value());
|
||||
}
|
||||
|
||||
/** The layer's block at the position, picked with the world's post-processing random, or null when it has none. */
|
||||
private BlockState pick(PaletteLayer layer, double x, double y, double z) {
|
||||
int index = layerBlocks.pick(layer, postRandom, COLUMN_SIGNATURE, x, y, z);
|
||||
return index == LayerBlocks.NONE ? null : layerBlocks.blocks(layer).get(index);
|
||||
}
|
||||
|
||||
private int[] heightPlane() {
|
||||
int width = blocks.getWidth();
|
||||
int depth = blocks.getDepth();
|
||||
@@ -180,15 +216,15 @@ final class SurfaceSmoothing {
|
||||
if (ha >= h - 2 && hb >= h - 2 && hc >= h - 2 && hd >= h - 2) {
|
||||
return;
|
||||
}
|
||||
Optional<BiomeLayer> wall = settings.wall(x, z);
|
||||
if (wall.isEmpty()) {
|
||||
PaletteLayer wall = biomeLayer(WallSettings.class, WallSettings::layer, x, z);
|
||||
if (wall.palette().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
boolean brokeGround = false;
|
||||
int max = Math.abs(Math.max(h - ha, Math.max(h - hb, Math.max(h - hc, h - hd))));
|
||||
for (int i = h; i > h - max; i--) {
|
||||
Optional<BlockState> block = wall.get().at(x + i, i + h, z + i);
|
||||
if (block.isEmpty()) {
|
||||
BlockState block = pick(wall, x + i, i + h, z + i);
|
||||
if (block == null) {
|
||||
continue;
|
||||
}
|
||||
if (isAirOrWater(x, i, z)) {
|
||||
@@ -197,7 +233,7 @@ final class SurfaceSmoothing {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
set(x, i, z, block.get());
|
||||
set(x, i, z, block);
|
||||
brokeGround = true;
|
||||
}
|
||||
}
|
||||
@@ -210,15 +246,14 @@ final class SurfaceSmoothing {
|
||||
if (!step) {
|
||||
return h;
|
||||
}
|
||||
BiomeLayer slab = settings.slab(x, z);
|
||||
if (!slab.allowsSlope(terrain.column(x, z).slope())) {
|
||||
PaletteLayer slab = biomeLayer(SlabSettings.class, SlabSettings::layer, x, z);
|
||||
if (!slab.slopeCondition().isValid(terrain.column(x, z).slope())) {
|
||||
return h;
|
||||
}
|
||||
Optional<BlockState> picked = slab.at(x, h, z);
|
||||
if (picked.isEmpty()) {
|
||||
BlockState block = pick(slab, x, h, z);
|
||||
if (block == null) {
|
||||
return h;
|
||||
}
|
||||
BlockState block = picked.get();
|
||||
boolean cancel = has(block, BlockTrait.AIR)
|
||||
|| block.material().equals(SNOW_ID) && h + 1 <= fluidHeight
|
||||
|| isSnowLayer(x, h, z);
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
package art.arcane.iris.engine.object.annotations;
|
||||
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@@ -31,5 +29,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
@Retention(RUNTIME)
|
||||
@Target({PARAMETER, TYPE, FIELD})
|
||||
public @interface RegistryListResource {
|
||||
Class<? extends IrisRegistrant> value();
|
||||
/** The class pack resources of the kind are read into: an Iris resource or the class of a module resource kind. */
|
||||
Class<?> value();
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity;
|
||||
|
||||
import art.arcane.iris.engine.object.marker.IrisCommandRegistry;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.annotations.DependsOn;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListPotionEffect;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import art.arcane.volmlib.util.scheduling.ChronoLatch;
|
||||
import art.arcane.iris.util.common.data.registry.RegistryUtil;
|
||||
import art.arcane.iris.util.common.scheduling.J;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@Snippet("effect")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("An iris effect")
|
||||
@Data
|
||||
public class IrisEffect {
|
||||
private final transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
|
||||
private final transient AtomicCache<ChronoLatch> latch = new AtomicCache<>();
|
||||
private final transient AtomicCache<Particle> particleEffectResolved = new AtomicCache<>();
|
||||
private final transient AtomicCache<Sound> soundResolved = new AtomicCache<>();
|
||||
@RegistryListPotionEffect
|
||||
@Desc("The potion effect to apply in this area")
|
||||
private String potionEffect = "";
|
||||
@Desc("The particle effect to apply in the area")
|
||||
private String particleEffect = null;
|
||||
@DependsOn({"particleEffect"})
|
||||
@MinNumber(-32)
|
||||
@MaxNumber(32)
|
||||
@Desc("Randomly offset from the surface to this surface+value")
|
||||
private int particleOffset = 0;
|
||||
@DependsOn({"particleEffect"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltX = 0;
|
||||
@DependsOn({"particleEffect"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltY = 0;
|
||||
@DependsOn({"particleEffect"})
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltZ = 0;
|
||||
@DependsOn({"particleEffect"})
|
||||
@Desc("Randomize the altX by -altX to altX")
|
||||
private boolean randomAltX = true;
|
||||
@DependsOn({"particleEffect"})
|
||||
@Desc("Randomize the altY by -altY to altY")
|
||||
private boolean randomAltY = false;
|
||||
@DependsOn({"particleEffect"})
|
||||
@Desc("Randomize the altZ by -altZ to altZ")
|
||||
private boolean randomAltZ = true;
|
||||
@Desc("The sound to play")
|
||||
private String sound = null;
|
||||
@DependsOn({"sound"})
|
||||
@MinNumber(0)
|
||||
@MaxNumber(512)
|
||||
@Desc("The max distance from the player the sound will play")
|
||||
private int soundDistance = 12;
|
||||
@DependsOn({"sound", "maxPitch"})
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.99)
|
||||
@Desc("The minimum sound pitch")
|
||||
private double minPitch = 0.5D;
|
||||
@DependsOn({"sound", "minVolume"})
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.99)
|
||||
@Desc("The max sound pitch")
|
||||
private double maxPitch = 1.5D;
|
||||
@DependsOn({"sound"})
|
||||
@MinNumber(0.001)
|
||||
@MaxNumber(512)
|
||||
@Desc("The sound volume.")
|
||||
private double volume = 1.5D;
|
||||
@DependsOn({"particleEffect"})
|
||||
@MinNumber(0)
|
||||
@MaxNumber(512)
|
||||
@Desc("The particle count. Try setting to zero for using the alt xyz to a motion value instead of an offset")
|
||||
private int particleCount = 0;
|
||||
@DependsOn({"particleEffect"})
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("How far away from the player particles can play")
|
||||
private int particleDistance = 20;
|
||||
@DependsOn({"particleEffect"})
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@Desc("How wide the particles can play (player's view left and right) RADIUS")
|
||||
private int particleDistanceWidth = 24;
|
||||
@DependsOn({"particleEffect"})
|
||||
@Desc("An extra value for some particles... Which bukkit doesn't even document.")
|
||||
private double extra = 0;
|
||||
@DependsOn({"potionEffect"})
|
||||
@MinNumber(-1)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The Potion Strength or -1 to disable")
|
||||
private int potionStrength = -1;
|
||||
@DependsOn({"potionEffect", "potionTicksMin"})
|
||||
@MinNumber(1)
|
||||
@Desc("The max time the potion will last for")
|
||||
private int potionTicksMax = 155;
|
||||
@DependsOn({"potionEffect", "potionTicksMax"})
|
||||
@MinNumber(1)
|
||||
@Desc("The min time the potion will last for")
|
||||
private int potionTicksMin = 75;
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@Desc("The effect interval in milliseconds")
|
||||
private int interval = 150;
|
||||
@DependsOn({"particleEffect"})
|
||||
@MinNumber(0)
|
||||
@MaxNumber(16)
|
||||
@Desc("The effect distance start away")
|
||||
private int particleAway = 5;
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@Desc("The chance is 1 in CHANCE per interval")
|
||||
private int chance = 50;
|
||||
@Desc("Run commands, with configurable location parameters")
|
||||
private IrisCommandRegistry commandRegistry = null;
|
||||
|
||||
|
||||
public boolean canTick() {
|
||||
return latch.aquire(() -> new ChronoLatch(interval)).flip();
|
||||
}
|
||||
|
||||
public boolean shouldApplyNow() {
|
||||
return canTick() && RNG.r.nextInt(chance) == 0;
|
||||
}
|
||||
|
||||
public String getParticleEffectKey() {
|
||||
return particleEffect;
|
||||
}
|
||||
|
||||
public String getSoundKey() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
public Particle getParticleEffect() {
|
||||
if (particleEffect == null) {
|
||||
return null;
|
||||
}
|
||||
return particleEffectResolved.aquire(() -> resolveKeyed(Particle.class, particleEffect));
|
||||
}
|
||||
|
||||
public Sound getSound() {
|
||||
if (sound == null) {
|
||||
return null;
|
||||
}
|
||||
return soundResolved.aquire(() -> resolveKeyed(Sound.class, sound));
|
||||
}
|
||||
|
||||
private static <T> T resolveKeyed(Class<T> type, String key) {
|
||||
NamespacedKey namespacedKey = NamespacedKey.fromString(key);
|
||||
return namespacedKey == null ? null : RegistryUtil.lookup(type).get(namespacedKey);
|
||||
}
|
||||
|
||||
public PotionEffectType getRealType() {
|
||||
return pt.aquire(() ->
|
||||
{
|
||||
if (getPotionEffect() == null || getPotionEffect().isEmpty()) {
|
||||
return PotionEffectType.LUCK;
|
||||
}
|
||||
|
||||
try {
|
||||
PotionEffectType resolved = PotionEffectTypes.resolve(getPotionEffect());
|
||||
if (resolved != null) {
|
||||
return resolved;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
IrisLogging.reportError(e);
|
||||
}
|
||||
|
||||
if (PotionEffectTypes.shouldWarn(getPotionEffect())) {
|
||||
IrisLogging.warn("Unknown Potion Effect Type: \"" + getPotionEffect() + "\". Valid types: " + PotionEffectTypes.knownTypesList());
|
||||
}
|
||||
|
||||
return PotionEffectType.LUCK;
|
||||
});
|
||||
}
|
||||
|
||||
private static final class BukkitFx {
|
||||
private static void run(Player p, Runnable r) {
|
||||
J.runEntity(p, r);
|
||||
}
|
||||
}
|
||||
|
||||
public void apply(Player p, Engine g) {
|
||||
if (!shouldApplyNow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BukkitFx.run(p, () -> {
|
||||
Sound soundType = getSound();
|
||||
Particle particleType = getParticleEffect();
|
||||
if (soundType != null) {
|
||||
Location part = p.getLocation().clone().add(RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance));
|
||||
p.playSound(part, soundType, (float) volume, (float) RNG.r.d(minPitch, maxPitch));
|
||||
}
|
||||
|
||||
if (particleType != null) {
|
||||
Location part = p.getLocation().clone().add(p.getLocation().getDirection().clone().multiply(RNG.r.i(particleDistance) + particleAway)).clone().add(p.getLocation().getDirection().clone().rotateAroundY(Math.toRadians(90)).multiply(RNG.r.d(-particleDistanceWidth, particleDistanceWidth)));
|
||||
|
||||
part.setY(Math.round(g.getHeight(part.getBlockX(), part.getBlockZ())) + 1);
|
||||
part.add(RNG.r.d(), 0, RNG.r.d());
|
||||
int offset = p.getWorld().getMinHeight();
|
||||
if (extra != 0) {
|
||||
p.spawnParticle(particleType, part.getX(), part.getY() + offset + RNG.r.i(particleOffset),
|
||||
part.getZ(),
|
||||
particleCount,
|
||||
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
|
||||
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
|
||||
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ,
|
||||
extra);
|
||||
} else {
|
||||
p.spawnParticle(particleType, part.getX(), part.getY() + offset + RNG.r.i(particleOffset), part.getZ(),
|
||||
particleCount,
|
||||
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
|
||||
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
|
||||
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ);
|
||||
}
|
||||
}
|
||||
|
||||
if (commandRegistry != null) {
|
||||
commandRegistry.run(p);
|
||||
}
|
||||
|
||||
if (potionStrength > -1) {
|
||||
if (p.hasPotionEffect(getRealType())) {
|
||||
PotionEffect e = p.getPotionEffect(getRealType());
|
||||
if (e != null && e.getAmplifier() > getPotionStrength()) {
|
||||
return;
|
||||
}
|
||||
|
||||
p.removePotionEffect(getRealType());
|
||||
}
|
||||
|
||||
p.addPotionEffect(new PotionEffect(getRealType(),
|
||||
RNG.r.i(Math.min(potionTicksMax, potionTicksMin),
|
||||
Math.max(potionTicksMax, potionTicksMin)),
|
||||
getPotionStrength(),
|
||||
true, false, false));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity;
|
||||
|
||||
import art.arcane.iris.engine.spawn.SpawnResources;
|
||||
import art.arcane.iris.engine.object.entity.spawn.IrisSpawner;
|
||||
import art.arcane.iris.engine.object.marker.IrisMarker;
|
||||
import art.arcane.iris.engine.object.value.IRare;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListResource;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("entity-spawn")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents an entity spawn during initial chunk generation")
|
||||
@Data
|
||||
public class IrisEntitySpawn implements IRare {
|
||||
private final transient AtomicCache<RNG> rng = new AtomicCache<>();
|
||||
private final transient AtomicCache<IrisEntity> ent = new AtomicCache<>();
|
||||
@RegistryListResource(IrisEntity.class)
|
||||
@Required
|
||||
@Desc("The entity")
|
||||
private String entity = "";
|
||||
@MinNumber(1)
|
||||
@Desc("The 1 in RARITY chance for this entity to spawn")
|
||||
private int rarity = 1;
|
||||
@MinNumber(1)
|
||||
@Desc("The minumum of this entity to spawn")
|
||||
private int minSpawns = 1;
|
||||
@MinNumber(1)
|
||||
@Desc("The max of this entity to spawn")
|
||||
private int maxSpawns = 1;
|
||||
private transient IrisSpawner referenceSpawner;
|
||||
private transient IrisMarker referenceMarker;
|
||||
|
||||
public IrisEntity getRealEntity(Engine g) {
|
||||
return ent.aquire(() -> SpawnResources.entity(g.getData(), getEntity()));
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity;
|
||||
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListPotionEffect;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@Snippet("potion-effect")
|
||||
@Desc("An iris potion effect")
|
||||
@Data
|
||||
public class IrisPotionEffect {
|
||||
private final transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
|
||||
@Required
|
||||
@RegistryListPotionEffect
|
||||
@Desc("The potion effect to apply in this area")
|
||||
private String potionEffect = "";
|
||||
@Required
|
||||
@MinNumber(-1)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The Potion Strength or -1 to disable")
|
||||
private int strength = -1;
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@Desc("The time the potion will last for")
|
||||
private int ticks = 200;
|
||||
@Desc("Is the effect ambient")
|
||||
private boolean ambient = false;
|
||||
@Desc("Is the effect showing particles")
|
||||
private boolean particles = true;
|
||||
|
||||
public PotionEffectType getRealType() {
|
||||
return pt.aquire(() ->
|
||||
{
|
||||
if (getPotionEffect() == null || getPotionEffect().isEmpty()) {
|
||||
return PotionEffectType.LUCK;
|
||||
}
|
||||
|
||||
try {
|
||||
PotionEffectType resolved = PotionEffectTypes.resolve(getPotionEffect());
|
||||
if (resolved != null) {
|
||||
return resolved;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
IrisLogging.reportError(e);
|
||||
}
|
||||
|
||||
if (PotionEffectTypes.shouldWarn(getPotionEffect())) {
|
||||
IrisLogging.warn("Unknown Potion Effect Type: \"" + getPotionEffect() + "\". Valid types: " + PotionEffectTypes.knownTypesList());
|
||||
}
|
||||
|
||||
return PotionEffectType.LUCK;
|
||||
});
|
||||
}
|
||||
|
||||
public void apply(LivingEntity p) {
|
||||
if (strength > -1) {
|
||||
if (p.hasPotionEffect(getRealType())) {
|
||||
PotionEffect e = p.getPotionEffect(getRealType());
|
||||
if (e.getAmplifier() > strength) {
|
||||
return;
|
||||
}
|
||||
|
||||
p.removePotionEffect(getRealType());
|
||||
}
|
||||
|
||||
p.addPotionEffect(new PotionEffect(getRealType(), ticks, strength, ambient, particles, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity;
|
||||
|
||||
import art.arcane.iris.util.common.reflect.KeyedType;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public final class PotionEffectTypes {
|
||||
private static final Map<String, String> LEGACY_ALIASES;
|
||||
private static final Set<String> MISSING_WARNED = ConcurrentHashMap.newKeySet();
|
||||
|
||||
static {
|
||||
Map<String, String> m = new HashMap<>();
|
||||
m.put("SLOW", "SLOWNESS");
|
||||
m.put("FAST_DIGGING", "HASTE");
|
||||
m.put("SLOW_DIGGING", "MINING_FATIGUE");
|
||||
m.put("INCREASE_DAMAGE", "STRENGTH");
|
||||
m.put("HEAL", "INSTANT_HEALTH");
|
||||
m.put("HARM", "INSTANT_DAMAGE");
|
||||
m.put("JUMP", "JUMP_BOOST");
|
||||
m.put("CONFUSION", "NAUSEA");
|
||||
m.put("DAMAGE_RESISTANCE", "RESISTANCE");
|
||||
LEGACY_ALIASES = Collections.unmodifiableMap(m);
|
||||
}
|
||||
|
||||
private PotionEffectTypes() {
|
||||
}
|
||||
|
||||
public static String normalize(String input) {
|
||||
if (input == null) {
|
||||
return "";
|
||||
}
|
||||
String upper = input.trim().toUpperCase(Locale.ROOT).replace(' ', '_');
|
||||
if (upper.contains(":")) {
|
||||
upper = upper.substring(upper.indexOf(':') + 1);
|
||||
}
|
||||
return LEGACY_ALIASES.getOrDefault(upper, upper);
|
||||
}
|
||||
|
||||
public static PotionEffectType resolve(String rawName) {
|
||||
if (rawName == null || rawName.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
String wanted = normalize(rawName);
|
||||
for (PotionEffectType i : Registry.EFFECT) {
|
||||
NamespacedKey key = KeyedType.getKey(i);
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
String candidate = key.getKey().toUpperCase(Locale.ROOT).replace(' ', '_');
|
||||
if (candidate.equals(wanted)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String knownTypesList() {
|
||||
TreeSet<String> names = new TreeSet<>();
|
||||
for (PotionEffectType i : Registry.EFFECT) {
|
||||
NamespacedKey key = KeyedType.getKey(i);
|
||||
if (key != null) {
|
||||
names.add(key.getKey().toUpperCase(Locale.ROOT).replace(' ', '_'));
|
||||
}
|
||||
}
|
||||
return String.join(", ", names);
|
||||
}
|
||||
|
||||
public static boolean shouldWarn(String rawName) {
|
||||
return MISSING_WARNED.add(normalize(rawName));
|
||||
}
|
||||
}
|
||||
+3
-5
@@ -18,8 +18,6 @@
|
||||
|
||||
package art.arcane.iris.engine.object.entity.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.value.IrisRate;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.volmlib.util.math.M;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -28,11 +26,11 @@ public class IrisEngineSpawnerCooldown {
|
||||
private long lastSpawn = 0;
|
||||
private String spawner;
|
||||
|
||||
public void spawn(Engine engine) {
|
||||
public void spawn() {
|
||||
lastSpawn = M.ms();
|
||||
}
|
||||
|
||||
public boolean canSpawn(IrisRate s) {
|
||||
return M.ms() - lastSpawn > s.getInterval();
|
||||
public boolean canSpawn(long intervalMilliseconds) {
|
||||
return M.ms() - lastSpawn > intervalMilliseconds;
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.entity.spawn;
|
||||
|
||||
import art.arcane.iris.engine.object.entity.IrisEntitySpawn;
|
||||
import art.arcane.iris.engine.object.marker.IrisMarker;
|
||||
import art.arcane.iris.engine.object.value.IrisRange;
|
||||
import art.arcane.iris.engine.object.value.IrisRate;
|
||||
import art.arcane.iris.engine.object.world.IrisTimeBlock;
|
||||
import art.arcane.iris.engine.object.world.IrisWeather;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
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.spi.PlatformWorld;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents an entity spawn during initial chunk generation")
|
||||
@Data
|
||||
public class IrisSpawner extends IrisRegistrant {
|
||||
|
||||
private transient IrisMarker referenceMarker;
|
||||
|
||||
@ArrayType(min = 1, type = IrisEntitySpawn.class)
|
||||
@Desc("The entity spawns to add")
|
||||
private KList<IrisEntitySpawn> spawns = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = IrisEntitySpawn.class)
|
||||
@Desc("The entity spawns to add initially. EXECUTES PER CHUNK!")
|
||||
private KList<IrisEntitySpawn> initialSpawns = new KList<>();
|
||||
|
||||
@Desc("This spawner will not spawn in a given chunk if that chunk has more than the defined amount of living entities.")
|
||||
private int maxEntitiesPerChunk = 1;
|
||||
|
||||
@Desc("The block of 24 hour time to contain this spawn in.")
|
||||
private IrisTimeBlock timeBlock = new IrisTimeBlock();
|
||||
|
||||
@Desc("The weather condition required for this spawner to fire.")
|
||||
private IrisWeather weather = IrisWeather.ANY;
|
||||
|
||||
@Desc("The maximum rate this spawner can fire")
|
||||
private IrisRate maximumRate = new IrisRate();
|
||||
|
||||
@Desc("The maximum rate this spawner can fire on a specific chunk")
|
||||
private IrisRate maximumRatePerChunk = new IrisRate();
|
||||
|
||||
@Desc("The light levels this spawn is allowed to run in (0-15 inclusive)")
|
||||
private IrisRange allowedLightLevels = new IrisRange(0, 15);
|
||||
|
||||
@Desc("Where should these spawns be placed")
|
||||
private IrisSpawnGroup group = IrisSpawnGroup.NORMAL;
|
||||
|
||||
public boolean isValid(IrisBiome biome) {
|
||||
return switch (group) {
|
||||
case NORMAL -> switch (biome.getInferredType()) {
|
||||
case SHORE, SEA, CAVE -> false;
|
||||
case LAND -> true;
|
||||
};
|
||||
case CAVE -> true;
|
||||
case UNDERWATER -> switch (biome.getInferredType()) {
|
||||
case SHORE, LAND, CAVE -> false;
|
||||
case SEA -> true;
|
||||
};
|
||||
case BEACH -> switch (biome.getInferredType()) {
|
||||
case SHORE -> true;
|
||||
case LAND, CAVE, SEA -> false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
public boolean isValid(PlatformWorld world) {
|
||||
return timeBlock.isWithin(world) && weather.is(world);
|
||||
}
|
||||
|
||||
public boolean canSpawn(Engine engine) {
|
||||
PlatformWorld world = engine.getWorld().platformWorld();
|
||||
if (world == null || !isValid(world))
|
||||
return false;
|
||||
|
||||
IrisRate rate = getMaximumRate();
|
||||
return rate.isInfinite() || engine.getEngineData().getCooldown(this).canSpawn(rate);
|
||||
}
|
||||
|
||||
public boolean canSpawn(Engine engine, int x, int z) {
|
||||
if (!canSpawn(engine))
|
||||
return false;
|
||||
|
||||
IrisRate rate = getMaximumRatePerChunk();
|
||||
return rate.isInfinite() || engine.getEngineData().getChunk(x, z).getCooldown(this).canSpawn(rate);
|
||||
}
|
||||
|
||||
public void spawn(Engine engine) {
|
||||
if (getMaximumRate().isInfinite())
|
||||
return;
|
||||
|
||||
engine.getEngineData().getCooldown(this).spawn(engine);
|
||||
}
|
||||
|
||||
public void spawn(Engine engine, int x, int z) {
|
||||
spawn(engine);
|
||||
if (getMaximumRatePerChunk().isInfinite())
|
||||
return;
|
||||
|
||||
engine.getEngineData().getChunk(x, z).getCooldown(this).spawn(engine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFolderName() {
|
||||
return "spawners";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return "Spawner";
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package art.arcane.iris.engine.object.entity.spawn;
|
||||
|
||||
import art.arcane.iris.builtin.spawn.Spawner;
|
||||
import art.arcane.iris.engine.spawn.SpawnResources;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
@@ -10,10 +11,6 @@ import lombok.NonNull;
|
||||
public class IrisSpawnerCooldowns {
|
||||
private final KMap<String, IrisEngineSpawnerCooldown> cooldowns = new KMap<>();
|
||||
|
||||
public IrisEngineSpawnerCooldown getCooldown(@NonNull IrisSpawner spawner) {
|
||||
return getCooldown(spawner.getLoadKey());
|
||||
}
|
||||
|
||||
public IrisEngineSpawnerCooldown getCooldown(@NonNull String loadKey) {
|
||||
return cooldowns.computeIfAbsent(loadKey, k -> {
|
||||
IrisEngineSpawnerCooldown cd = new IrisEngineSpawnerCooldown();
|
||||
@@ -24,8 +21,8 @@ public class IrisSpawnerCooldowns {
|
||||
|
||||
public void cleanup(Engine engine) {
|
||||
cooldowns.values().removeIf(cd -> {
|
||||
IrisSpawner sp = SpawnResources.spawner(engine.getData(), cd.getSpawner());
|
||||
return sp == null || cd.canSpawn(sp.getMaximumRate());
|
||||
Spawner spawner = SpawnResources.spawner(engine.getData(), cd.getSpawner());
|
||||
return spawner == null || cd.canSpawn(spawner.maximumRate().interval());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
|
||||
import art.arcane.iris.engine.object.material.IrisBlockData;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.framework.LootResolver;
|
||||
import art.arcane.iris.engine.loot.LootItems;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.volmit.item.ItemDrop;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Snippet("block-drops")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents a block drop list")
|
||||
@Data
|
||||
public class IrisBlockDrops {
|
||||
private final transient AtomicCache<KList<PlatformBlockState>> data = new AtomicCache<>();
|
||||
@Required
|
||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||
@Desc("The blocks that drop loot")
|
||||
private KList<IrisBlockData> blocks = new KList<>();
|
||||
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
|
||||
private boolean exactBlocks = false;
|
||||
@Desc("Add in specific items to drop")
|
||||
@ArrayType(min = 1, type = IrisLoot.class)
|
||||
private KList<IrisLoot> drops = new KList<>();
|
||||
@Desc("If this is in a biome, setting skipParents to true will ignore the drops in the region and dimension for this block type. The default (false) will allow all three nodes to fire and add to a list of drops.")
|
||||
private boolean skipParents = false;
|
||||
@Desc("Removes the default vanilla block drops and only drops the given items & any parent loot tables specified for this block type.")
|
||||
private boolean replaceVanillaDrops = false;
|
||||
|
||||
public boolean shouldDropFor(PlatformBlockState broken, IrisData rdata) {
|
||||
KList<PlatformBlockState> list = this.data.aquire(() -> {
|
||||
KList<PlatformBlockState> b = new KList<>();
|
||||
|
||||
for (IrisBlockData i : getBlocks()) {
|
||||
PlatformBlockState state = i.getBlockData(rdata);
|
||||
|
||||
if (state != null) {
|
||||
b.add(state);
|
||||
}
|
||||
}
|
||||
|
||||
return b.removeDuplicates();
|
||||
});
|
||||
|
||||
for (PlatformBlockState i : list) {
|
||||
if (exactBlocks ? i.key().equals(broken.key()) : materialOf(i).equals(materialOf(broken))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Adds the items of the drops that pass their rarity to {@code d}. */
|
||||
public void fillDrops(LootItems items, List<ItemDrop> d) {
|
||||
for (IrisLoot i : getDrops()) {
|
||||
if (!LootResolver.oneIn(RNG.r, i.getRarity())) {
|
||||
continue;
|
||||
}
|
||||
ItemDrop drop = items.give(i, RNG.r);
|
||||
if (drop != null) {
|
||||
d.add(drop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String materialOf(PlatformBlockState state) {
|
||||
String key = state.key();
|
||||
int properties = key.indexOf('[');
|
||||
return properties < 0 ? key : key.substring(0, properties);
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
|
||||
import art.arcane.iris.engine.object.entity.IrisAttributeModifier;
|
||||
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.RegistryListItemType;
|
||||
import art.arcane.iris.engine.object.annotations.Required;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("loot")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents a loot entry")
|
||||
@Data
|
||||
@EqualsAndHashCode(doNotUseGetters = true)
|
||||
@ToString(doNotUseGetters = true)
|
||||
public class IrisLoot {
|
||||
public static final int MAX_AMOUNT = 64;
|
||||
|
||||
@Desc("The target inventory slot types to fill this loot with. World generation only ever fills STORAGE; the other values are inert during worldgen.")
|
||||
private InventorySlotType slotTypes = InventorySlotType.STORAGE;
|
||||
@MinNumber(1)
|
||||
@Desc("The sub rarity of this loot. Calculated after this loot table has been picked.")
|
||||
private int rarity = 1;
|
||||
@MinNumber(1)
|
||||
@MaxNumber(MAX_AMOUNT)
|
||||
@Desc("Minimum amount of this loot, from 1 to 64")
|
||||
private int minAmount = 1;
|
||||
@MinNumber(1)
|
||||
@MaxNumber(MAX_AMOUNT)
|
||||
@Desc("Maximum amount of this loot, from 1 to 64")
|
||||
private int maxAmount = 1;
|
||||
@MinNumber(1)
|
||||
@Desc("The display name of this item")
|
||||
private String displayName = null;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Minimum durability percent")
|
||||
private double minDurability = 0;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Maximum durability percent")
|
||||
private double maxDurability = 1;
|
||||
@Desc("Define a custom model identifier 1.14+ only")
|
||||
private Integer customModel = null;
|
||||
@Desc("Set this to true to prevent it from being broken")
|
||||
private boolean unbreakable = false;
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@Desc("The item flags to add")
|
||||
private KList<String> itemFlags = new KList<>();
|
||||
@Desc("Apply enchantments to this item")
|
||||
@ArrayType(min = 1, type = IrisEnchantment.class)
|
||||
private KList<IrisEnchantment> enchantments = new KList<>();
|
||||
@Desc("Apply attribute modifiers to this item")
|
||||
@ArrayType(min = 1, type = IrisAttributeModifier.class)
|
||||
private KList<IrisAttributeModifier> attributes = new KList<>();
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@Desc("Add lore to this item")
|
||||
private KList<String> lore = new KList<>();
|
||||
@RegistryListItemType
|
||||
@Required
|
||||
@Desc("This is the item or block type. Does not accept minecraft:*, only materials such as DIAMOND_SWORD or DIRT. The exception are modded materials, as they require a namespace.")
|
||||
private String type = "";
|
||||
@Desc("The dye color")
|
||||
private String dyeColor = null;
|
||||
@Desc("The leather armor color")
|
||||
private String leatherColor = null;
|
||||
@Desc("Defines a custom NBT Tag for the item.")
|
||||
private KMap<String, Object> customNbt;
|
||||
|
||||
/**
|
||||
* The authored item key, exactly as written in the pack. Each platform resolves it against its own item registry.
|
||||
*/
|
||||
public String getTypeKey() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The authored dye colour name, or null when unset.
|
||||
*/
|
||||
public String getDyeColorKey() {
|
||||
return dyeColor;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.engine.object.loot;
|
||||
|
||||
import art.arcane.iris.engine.loot.LootResources;
|
||||
import art.arcane.iris.engine.data.cache.AtomicCache;
|
||||
import art.arcane.iris.engine.object.annotations.ArrayType;
|
||||
import art.arcane.iris.engine.object.annotations.Desc;
|
||||
import art.arcane.iris.engine.object.annotations.MaxNumber;
|
||||
import art.arcane.iris.engine.object.annotations.MinNumber;
|
||||
import art.arcane.iris.engine.object.annotations.RegistryListResource;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.iris.util.common.data.DataProvider;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("loot-registry")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents a loot entry")
|
||||
@Data
|
||||
public class IrisLootReference {
|
||||
public static final double MAX_MULTIPLIER = 16D;
|
||||
|
||||
private final transient AtomicCache<KList<IrisLootTable>> tt = new AtomicCache<>();
|
||||
@Desc("ADD = add on top of parent tables. REPLACE = clear parent tables, then add these. CLEAR = clear parent tables and add nothing, even if tables are listed. FALLBACK = only used when nothing else defined a table.")
|
||||
private IrisLootMode mode = IrisLootMode.ADD;
|
||||
@RegistryListResource(IrisLootTable.class)
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@Desc("Add loot table registries here")
|
||||
private KList<String> tables = new KList<>();
|
||||
@MinNumber(0)
|
||||
@MaxNumber(MAX_MULTIPLIER)
|
||||
@Desc("Scale loot sources in this area from 0 to 16 times their normal count")
|
||||
private double multiplier = 1D;
|
||||
|
||||
public KList<IrisLootTable> getLootTables(DataProvider g) {
|
||||
return tt.aquire(() ->
|
||||
{
|
||||
KList<IrisLootTable> t = new KList<>();
|
||||
|
||||
for (String i : tables) {
|
||||
t.add(LootResources.table(g.getData(), i));
|
||||
}
|
||||
|
||||
return t;
|
||||
});
|
||||
}
|
||||
}
|
||||
Loaded 100 of 140 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user