ObjectPlaceMode, AnchorSampling and StiltShape move to art.arcane.iris.builtin.anchor with IrisApi annotations

This commit is contained in:
piexel committed 2026-10-09 22:04:03 +02:00
1 parent 9401e8aa78
commit c4c8fa69d3
27 files changed
+35 -29

No files matched your search

@@ -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.anchor;
/** How a placement mode finds the height of an object placed without a requested height. */
public enum AnchorSampling {
/** The surface at the object's center, or the floor of the cave it is placed in. */
CENTER,
/** The highest surface under any column of the object. */
HIGHEST,
/** The highest surface under the object's four corners. */
HIGHEST_CORNER,
/** The lowest surface under any column of the object. */
LOWEST,
/** The lowest surface under the object's four corners. */
LOWEST_CORNER,
/** The surface at the object's center, ignoring caves; each block then follows its own column. */
SURFACE,
/** The translation alone, in open air. */
TRANSLATION,
/** The requested height, even when negative. */
REQUESTED
}
@@ -0,0 +1,130 @@
/*
* 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.builtin.anchor;
import com.volmit.config.Desc;
@Desc("Object Place modes are useful for positioning objects just right. The default value is CENTER_HEIGHT.")
public enum ObjectPlaceMode {
@Desc("The default place mode. This mode picks a center point (where the center of the object will be) and takes the height. That height is used for the whole object.")
CENTER_HEIGHT(AnchorSampling.CENTER, StiltShape.NONE),
@Desc("Samples a lot of points where the object will cover (horizontally) and picks the highest height, that height is then used to place the object. This mode is useful for preventing any part of your object from being buried though it will float off of cliffs.")
MAX_HEIGHT(AnchorSampling.HIGHEST, StiltShape.NONE),
@Desc("Samples only 4 points where the object will cover (horizontally) and picks the highest height, that height is then used to place the object. This mode is useful for preventing any part of your object from being buried though it will float off of cliffs.\"")
FAST_MAX_HEIGHT(AnchorSampling.HIGHEST_CORNER, StiltShape.NONE),
@Desc("Samples a lot of points where the object will cover (horizontally) and picks the lowest height, that height is then used to place the object. This mode is useful for preventing any part of your object from overhanging a cliff though it gets buried a lot")
MIN_HEIGHT(AnchorSampling.LOWEST, StiltShape.NONE),
@Desc("Samples only 4 points where the object will cover (horizontally) and picks the lowest height, that height is then used to place the object. This mode is useful for preventing any part of your object from overhanging a cliff though it gets buried a lot")
FAST_MIN_HEIGHT(AnchorSampling.LOWEST_CORNER, StiltShape.NONE),
@Desc("Stilting is MAX_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
STILT(AnchorSampling.HIGHEST, StiltShape.STRAIGHT),
@Desc("Just like stilting but very inaccurate. Useful for stilting a lot of objects without too much care on accuracy (you can use the over-stilt value to force stilts under ground further)")
FAST_STILT(AnchorSampling.HIGHEST_CORNER, StiltShape.STRAIGHT),
@Desc("Stilting is MIN_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
MIN_STILT(AnchorSampling.LOWEST, StiltShape.STRAIGHT),
@Desc("Just like MIN_STILT but very inaccurate. Useful for stilting a lot of objects without too much care on accuracy (you can use the over-stilt value to force stilts under ground further)")
FAST_MIN_STILT(AnchorSampling.LOWEST_CORNER, StiltShape.STRAIGHT),
@Desc("Stilting is CENTER_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
CENTER_STILT(AnchorSampling.CENTER, StiltShape.STRAIGHT),
@Desc("Erode stilting tapers columns downward like an ice cream cone. Blocks near the center extend deepest while edge blocks drop off first. Blocks are randomly skipped in the lower portion for a rough organic eroded texture.")
ERODE_STILT(AnchorSampling.HIGHEST, StiltShape.ERODE),
@Desc("Organic stilting scans straight down from the bottom of the object to the first solid block (the cave floor, or terrain) and fills the gap with the object's own bottom block. Each column stops at a slightly different, noise-varied depth and the lower portion is randomly broken up, so the underside reads as rough organic roots rather than a flat disc. Designed for objects placed inside caves so they connect to the floor instead of floating. Tune with stilt-settings (organicMaxScan, organicJitter, organicScratch).")
ORGANIC_STILT(AnchorSampling.CENTER, StiltShape.ORGANIC),
@Desc("Hangs the object upside-down from a cave ceiling. The object is flipped vertically (its tip points down like a stalactite) and its top is anchored to the ceiling, while an organic, noise-varied stilt grows up into the ceiling so it never floats below the roof. Use inside caves; tune with stilt-settings (organicMaxScan, organicJitter, organicScratch).")
CEILING_HANG(AnchorSampling.CENTER, StiltShape.CEILING),
@Desc("Anchors the object at the terrain surface (plus translate.y) like CENTER_HEIGHT, then bends the surrounding terrain to be flush with the object's base. Columns inside the object footprint are raised (or lowered) to meet the base, and the deformation falls off parabolically out to a radius so the terrain smoothly blends back to its natural height. Use this to seat a floating/translated object on the ground without a flat stilt disc, e.g. a cube translated up 10 on a mountain pulls the terrain up to meet it. Tune with vacuum-settings (radius, falloff).")
VACUUM(AnchorSampling.CENTER, StiltShape.NONE),
@Desc("VACUUM with a larger radius and finer per-column sampling for the smoothest terrain blend. More expensive.")
VACUUM_HIGH(AnchorSampling.CENTER, StiltShape.NONE),
@Desc("VACUUM with a smaller radius and coarser sampling for performance. Use when seating many objects.")
VACUUM_FAST(AnchorSampling.CENTER, StiltShape.NONE),
@Desc("VACUUM whose falloff radius is perturbed by noise per column, so the terrain meets the object with an irregular organic edge rather than a clean parabolic bowl.")
VACUUM_ORGANIC(AnchorSampling.CENTER, StiltShape.NONE),
@Desc("VACUUM whose terrain bend is bent by smooth coherent simplex noise so the surface meets the object with a gently rolling, wavy slope instead of the ragged white-noise edge of VACUUM_ORGANIC or a clean parabolic bowl. The object itself still seats flush; the waves fade to zero under the object and at the outer rim, peaking across the mid-slope. Tune with vacuum-settings (waveAmplitude, waveScale).")
VACUUM_WAVY(AnchorSampling.CENTER, StiltShape.NONE),
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
PAINT(AnchorSampling.SURFACE, StiltShape.NONE),
@Desc("Places the object in pure air at an absolute Y driven entirely by translate.y (plus optional translate.yRandom). Terrain height, underwater, and carving anchor checks are skipped. Use this for floating islands, sky structures, clouds, or blimps where the object must not be translated to the ground.")
FLOATING(AnchorSampling.TRANSLATION, StiltShape.NONE),
@Desc("Raw stamp at the caller-supplied (x, y, z). No terrain sampling, no stilting, no Y recomputation, no underwater or carving anchor guards. Used internally to route native Minecraft structure pieces (villages etc.) through the Iris object placer.")
STRUCTURE_PIECE(AnchorSampling.REQUESTED, StiltShape.NONE);
private final AnchorSampling anchor;
private final StiltShape stilt;
ObjectPlaceMode(AnchorSampling anchor, StiltShape stilt) {
this.anchor = anchor;
this.stilt = stilt;
}
/** How a placement without a requested height finds one. */
public AnchorSampling anchor() {
return anchor;
}
/** The stilt this mode grows under or above the object. */
public StiltShape stilt() {
return stilt;
}
public boolean isVacuum() {
return this == VACUUM || this == VACUUM_HIGH || this == VACUUM_FAST || this == VACUUM_ORGANIC || this == VACUUM_WAVY;
}
}
@@ -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.builtin.anchor;
/** What a placement mode grows between the object and the ground or ceiling. */
public enum StiltShape {
NONE,
/** Repeats the bottom layer straight down to the surface. */
STRAIGHT,
/** Like {@link #STRAIGHT}, tapering toward the edges and broken up at depth. */
ERODE,
/** Repeats the bottom layer down to the first solid block, each column a little different. */
ORGANIC,
/** Hangs the flipped object from a ceiling and grows its top layer up into it. */
CEILING
}