mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Structure fit moves into iris:structure behind the VanillaStructures service
The module now owns every way a platform start meets the terrain: the surface fit (SOURCE beard, VACUUM and its foundation repair), terrain integration (SOURCE bury and encapsulate, ENCASE, BORE, FORCE_CARVE with the organic carve), rigid piece support, legacy template air and stilts, all written against StructureFit and BlockAccess in the new structure/fit package. Where a start sits (shift, band, burial) and how far it reaches are module answers too. The fit settings become the module's own: StructureTerrain, StructureTerrainMode, StructureCarveShape, StructureStilts and StructureYBand replace the Iris classes and the API values, with the same JSON. A start carries its fit as a memo (terrain JSON, stilts JSON) so every chunk it reaches fits it the same way. The jigsaw overrides of a placement are the API's JigsawOverrides.
This commit is contained in:
1 parent
13aa3ccc68
commit
3d7b82c2cb
34 files changed
+3113
-371
No files matched your search
@@ -24,9 +24,6 @@ import com.volmit.config.MinItems;
|
||||
import com.volmit.config.MinNumber;
|
||||
import com.volmit.config.Ref;
|
||||
import com.volmit.config.Reference;
|
||||
import com.volmit.vanilla.StructureStilts;
|
||||
import com.volmit.vanilla.StructureTerrain;
|
||||
import com.volmit.vanilla.YBand;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -45,7 +42,7 @@ public final class StructureAdjustment {
|
||||
private int yShift = 0;
|
||||
|
||||
@Desc("Optional absolute world Y band. The structure is relocated so its vertical midpoint lands inside the band, deterministically from its start chunk and clamped to the world's build bounds. Precedence: preserveSourceY wins over yBand, and yBand wins over both yShift and Iris burial repositioning. Structures with a fixed vanilla alignment (ocean monument sea level, desert and jungle pyramid surface fit) ignore it.")
|
||||
private YBand yBand = null;
|
||||
private StructureYBand yBand = null;
|
||||
|
||||
@Desc("When true, skip Iris burial repositioning so the structure keeps the Y its own vanilla placement chose. Underground structures are otherwise pushed below the lowest solid column across their whole footprint, which hides terrain-aware structures such as mineshafts that intentionally breach cliffs and surfaces. Vertical shifts still apply on top of the preserved Y: this dimension's undergroundYShift plus every matching adjustment's yShift.")
|
||||
private boolean preserveSourceY = false;
|
||||
@@ -59,7 +56,7 @@ public final class StructureAdjustment {
|
||||
public StructureAdjustment() {
|
||||
}
|
||||
|
||||
public StructureAdjustment(List<String> match, int yShift, YBand yBand, boolean preserveSourceY, StructureStilts stilt,
|
||||
public StructureAdjustment(List<String> match, int yShift, StructureYBand yBand, boolean preserveSourceY, StructureStilts stilt,
|
||||
StructureTerrain terrain) {
|
||||
this.match = List.copyOf(match);
|
||||
this.yShift = yShift;
|
||||
@@ -78,7 +75,7 @@ public final class StructureAdjustment {
|
||||
return yShift;
|
||||
}
|
||||
|
||||
public Optional<YBand> yBand() {
|
||||
public Optional<StructureYBand> yBand() {
|
||||
return Optional.ofNullable(yBand);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package art.arcane.iris.builtin.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Controls the shape of the expanded terrain carve around an overbored structure.")
|
||||
public enum StructureCarveShape {
|
||||
@Desc("Carves the full expanded rectangular volume with straight walls, ceiling, and floor.")
|
||||
BOX,
|
||||
|
||||
@Desc("Carves a smooth rounded volume around the structure without erosion noise.")
|
||||
ROUNDED,
|
||||
|
||||
@Desc("Carves a rounded volume whose outer boundary is eroded by deterministic noise.")
|
||||
ERODED;
|
||||
|
||||
private static final double ERODED_CEILING_GROWTH = 0.8D;
|
||||
|
||||
public double maximumCeilingScale() {
|
||||
return maximumCeilingScale(1D);
|
||||
}
|
||||
|
||||
/** How far above its configured head room a carve of this shape may reach, as a multiple of it. */
|
||||
public double maximumCeilingScale(double erosionStrength) {
|
||||
double strength = Double.isFinite(erosionStrength)
|
||||
? Math.max(0D, Math.min(1D, erosionStrength)) : 1D;
|
||||
return switch (this) {
|
||||
case BOX, ROUNDED -> 1D;
|
||||
case ERODED -> 1D + ERODED_CEILING_GROWTH * strength;
|
||||
};
|
||||
}
|
||||
|
||||
public int maximumCeilingExtension(int configuredHeight) {
|
||||
return maximumCeilingExtension(configuredHeight, 1D);
|
||||
}
|
||||
|
||||
public int maximumCeilingExtension(int configuredHeight, double erosionStrength) {
|
||||
return (int) Math.ceil(Math.max(0, configuredHeight) * maximumCeilingScale(erosionStrength));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.structure;
|
||||
|
||||
import com.volmit.block.BlockSpec;
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Foundation columns built beneath a structure's pieces after they are placed, as packs write it:
|
||||
* {"maxDepth": 32, "palette": {"palette": [{"block": "stone_bricks"}]}, "spacing": 2}. Held by structure placements and
|
||||
* by the {@code importedStructures} adjustments; ownership records keep its JSON for the starts they track.
|
||||
*/
|
||||
@Desc("Defines foundation columns placed beneath a structure.")
|
||||
public final class StructureStilts {
|
||||
private static final String DEFAULT_BLOCK = "minecraft:cobblestone";
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(4064)
|
||||
@Desc("Maximum number of blocks each foundation column may descend while searching for solid ground.")
|
||||
private int maxDepth = 64;
|
||||
|
||||
@Desc("Block palette used for foundation columns.")
|
||||
private PaletteSpec palette = PaletteSpec.of(List.of(BlockSpec.of(DEFAULT_BLOCK)));
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(64)
|
||||
@Desc("Horizontal spacing between support columns. One fills every eligible foundation column; larger values create sparse stilts.")
|
||||
private int spacing = 1;
|
||||
|
||||
@Desc("For Iris-authored structures, whether solid partial blocks such as slabs, stairs, and walls may seed foundation columns instead of requiring a fully occluding base block.")
|
||||
private boolean supportNonOccluding = false;
|
||||
|
||||
public StructureStilts() {
|
||||
}
|
||||
|
||||
public int maxDepth() {
|
||||
return maxDepth;
|
||||
}
|
||||
|
||||
/** The blocks of the columns; empty when the pack wrote {@code "palette": null}. */
|
||||
public Optional<PaletteSpec> palette() {
|
||||
return Optional.ofNullable(palette);
|
||||
}
|
||||
|
||||
public int spacing() {
|
||||
return spacing;
|
||||
}
|
||||
|
||||
public boolean supportNonOccluding() {
|
||||
return supportNonOccluding;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* 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.structure;
|
||||
|
||||
import com.volmit.block.PaletteSpec;
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* How a structure meets the terrain, as packs write it: {"mode": "FORCE_CARVE", "horizontalPadding": 4, "shape": "ERODED"}.
|
||||
* Held by structure placements and by the {@code importedStructures} adjustments; ownership records keep its JSON for
|
||||
* the starts they track, so its field names and defaults are the persisted format.
|
||||
*/
|
||||
@Desc("Terrain integration applied after a structure graph is assembled and before its pieces are placed.")
|
||||
public final class StructureTerrain {
|
||||
private static final double AUTO_LOBE_FREQUENCY_RATIO = 0.3D;
|
||||
private static final double DEFAULT_EROSION_STRENGTH = 0.8D;
|
||||
private static final double DEFAULT_EROSION_FREQUENCY = 0.07D;
|
||||
private static final double DEFAULT_LOBE_STRENGTH = 0.85D;
|
||||
private static final double MIN_EROSION_FREQUENCY = 0.001D;
|
||||
private static final double MAX_EROSION_FREQUENCY = 1D;
|
||||
private static final double MAX_LOBE_FREQUENCY = 1D;
|
||||
|
||||
@Desc("Terrain operation. SOURCE applies the registered native structure's authored terrain adaptation and is a no-op for editable Iris structures. PRESERVE disables terrain integration. VACUUM raises terrain from processed rigid-template foundations at or below each authored ground plane with a 12-block falloff without lowering existing ground. BORE and FORCE_CARVE clear the requested envelope, while ENCASE fills it before placement so native shells are not lost to pre-carved air.")
|
||||
private StructureTerrainMode mode = StructureTerrainMode.SOURCE;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@Desc("Horizontal clearance around the assembled pieces for BORE, FORCE_CARVE, and ENCASE. VACUUM uses its fixed 12-block terrain falloff.")
|
||||
private int horizontalPadding = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@Desc("Air clearance above the assembled pieces.")
|
||||
private int ceilingPadding = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@Desc("Terrain cleared below the assembled pieces. Zero preserves their supporting floor.")
|
||||
private int floorPadding = 0;
|
||||
|
||||
@Desc("Shape used by FORCE_CARVE.")
|
||||
private StructureCarveShape shape = StructureCarveShape.BOX;
|
||||
|
||||
@Desc("Block palette used by ENCASE. When unset, the Overworld uses stone or deepslate, the Nether uses netherrack, and the End uses end stone.")
|
||||
private PaletteSpec encasePalette = null;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Boundary erosion strength for ERODED force carving.")
|
||||
private double erosionStrength = DEFAULT_EROSION_STRENGTH;
|
||||
|
||||
@MinNumber(MIN_EROSION_FREQUENCY)
|
||||
@MaxNumber(MAX_EROSION_FREQUENCY)
|
||||
@Desc("Boundary noise frequency for ERODED force carving.")
|
||||
private double erosionFrequency = DEFAULT_EROSION_FREQUENCY;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Low frequency lobe wavelength for ERODED force carving. Zero derives it from the erosion frequency.")
|
||||
private double lobeFrequency = 0D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("Fraction of the horizontal padding the lobes may remove for ERODED force carving. Zero keeps a uniform boundary.")
|
||||
private double lobeStrength = DEFAULT_LOBE_STRENGTH;
|
||||
|
||||
public StructureTerrain() {
|
||||
}
|
||||
|
||||
/** The terrain operation; SOURCE where the pack wrote none or one Iris does not know. */
|
||||
public StructureTerrainMode resolvedMode() {
|
||||
return mode == null ? StructureTerrainMode.SOURCE : mode;
|
||||
}
|
||||
|
||||
public int horizontalPadding() {
|
||||
return horizontalPadding;
|
||||
}
|
||||
|
||||
public int ceilingPadding() {
|
||||
return ceilingPadding;
|
||||
}
|
||||
|
||||
public int floorPadding() {
|
||||
return floorPadding;
|
||||
}
|
||||
|
||||
/** The carve shape; BOX where the pack wrote none or one Iris does not know. */
|
||||
public StructureCarveShape resolvedShape() {
|
||||
return shape == null ? StructureCarveShape.BOX : shape;
|
||||
}
|
||||
|
||||
/** The blocks ENCASE fills with; empty for the dimension's own stone. */
|
||||
public Optional<PaletteSpec> encasePalette() {
|
||||
return Optional.ofNullable(encasePalette);
|
||||
}
|
||||
|
||||
public double resolvedErosionStrength() {
|
||||
if (!Double.isFinite(erosionStrength)) {
|
||||
return DEFAULT_EROSION_STRENGTH;
|
||||
}
|
||||
return Math.max(0D, Math.min(1D, erosionStrength));
|
||||
}
|
||||
|
||||
public double resolvedErosionFrequency() {
|
||||
if (!Double.isFinite(erosionFrequency)) {
|
||||
return DEFAULT_EROSION_FREQUENCY;
|
||||
}
|
||||
return Math.max(MIN_EROSION_FREQUENCY, Math.min(MAX_EROSION_FREQUENCY, erosionFrequency));
|
||||
}
|
||||
|
||||
public double resolvedLobeFrequency() {
|
||||
if (!Double.isFinite(lobeFrequency) || lobeFrequency <= 0D) {
|
||||
return resolvedErosionFrequency() * AUTO_LOBE_FREQUENCY_RATIO;
|
||||
}
|
||||
return Math.min(MAX_LOBE_FREQUENCY, lobeFrequency);
|
||||
}
|
||||
|
||||
public double resolvedLobeStrength() {
|
||||
if (!Double.isFinite(lobeStrength)) {
|
||||
return DEFAULT_LOBE_STRENGTH;
|
||||
}
|
||||
return Math.max(0D, Math.min(1D, lobeStrength));
|
||||
}
|
||||
}
|
||||
@@ -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.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
|
||||
@Desc("Controls how terrain is integrated with a structure.")
|
||||
public enum StructureTerrainMode {
|
||||
@Desc("Replays the registered native structure's own authored terrain adaptation (beard surface fitting, BURY/ENCAPSULATE fill, legacy template-air clearing). Does nothing for editable Iris structures, which have no source adaptation to replay.")
|
||||
SOURCE,
|
||||
|
||||
@Desc("Disables all terrain integration. Pieces are placed into completely unmodified terrain and may end up embedded in solid rock or floating over dips.")
|
||||
PRESERVE,
|
||||
|
||||
@Desc("Clears one straight axis-aligned box around the assembled pieces, expanded by horizontalPadding, ceilingPadding, and floorPadding. Ignores the carve shape and erosion settings.")
|
||||
BORE,
|
||||
|
||||
@Desc("Clears the padded envelope using the configured carve shape (BOX, ROUNDED, or noise-eroded ERODED) so the cavity hugs the assembled pieces instead of a straight box.")
|
||||
FORCE_CARVE,
|
||||
|
||||
@Desc("Raises surface terrain from processed solid rigid-template foundations at or below each authored ground plane with a 12-block falloff, even when the registered structure has no terrain adaptation. Existing higher terrain and authored air remain untouched.")
|
||||
VACUUM,
|
||||
|
||||
@Desc("Fills the padded piece volume with solid blocks before any piece is placed so shells, walls, and floors land in solid ground instead of pre-carved air. Only air and liquid cells are filled; existing terrain and structures are never overwritten. Native pieces then carve their own interiors.")
|
||||
ENCASE
|
||||
}
|
||||
@@ -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.structure;
|
||||
|
||||
import com.volmit.config.Desc;
|
||||
import com.volmit.config.MaxNumber;
|
||||
import com.volmit.config.MinNumber;
|
||||
|
||||
/**
|
||||
* A band of absolute world heights a platform structure is moved into, as packs write it: {"min": -120, "max": -20}.
|
||||
* Unlike the API's heights these are world Y, as the platform's own structure definitions use them. Reversed bounds
|
||||
* mean the same band.
|
||||
*/
|
||||
@Desc("An absolute world Y band a native structure is relocated into. Reversed bounds are normalized.")
|
||||
public final class StructureYBand {
|
||||
@MinNumber(-4064)
|
||||
@MaxNumber(4064)
|
||||
@Desc("Lowest absolute world Y of the band.")
|
||||
private int min = 0;
|
||||
|
||||
@MinNumber(-4064)
|
||||
@MaxNumber(4064)
|
||||
@Desc("Highest absolute world Y of the band.")
|
||||
private int max = 0;
|
||||
|
||||
public StructureYBand() {
|
||||
}
|
||||
|
||||
public int resolvedMin() {
|
||||
return Math.min(min, max);
|
||||
}
|
||||
|
||||
public int resolvedMax() {
|
||||
return Math.max(min, max);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user