Port object placement onto IrisApi modules and delete the lifecycle

- The built-in placement is now eight IrisApi modules: iris:prepare,
  iris:anchor, iris:validate, iris:bore, iris:blocks, iris:stilt,
  iris:vacuum and iris:snow. Their stage constants and output types live
  in art.arcane.iris.builtin, which packs see, the stage bodies beside
  the placement settings they read.
- The modes stay in ObjectPlaceMode, which now names how each mode
  samples its height and which stilt it grows; one graph serves them all.
- The block stages share one pass: the object's blocks are written and
  the stilt layers found together. Snow and the vacuum bend read the
  written blocks from the write stage's output.
- PlacementLifecycle, its builder, plans, stages and state, the
  PlacementModule classes, ObjectBlockPass, IrisObjectPlacementRunner and
  ObjectMarkerPlacement are deleted.
- IrisObject caches its geometry as IrisApi blocks and forgets it with
  its other derived shapes whenever its blocks change.
- IrisObjectPlacement carries the module settings decoded with it.
- The vacuum radius is capped at the 128 blocks its settings allow, the
  reach the vacuum stage declares.
This commit is contained in:
piexel committed 2026-10-08 08:33:42 +02:00
1 parent 72cc04e20f
commit 522a9c85b6
68 files changed
+2464 -1955

No files matched your search

@@ -0,0 +1,23 @@
/*
* 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;
/** The height an object's anchor is placed at. */
public record AnchorHeight(int y) {
}
@@ -0,0 +1,33 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.anchor;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/** Module {@code iris:anchor}: the height an object is placed at. */
public final class AnchorStages {
/** The requested or sampled height the checks judge. Rejects {@code carving-anchor}. */
public static final PlacementStage<AnchorHeight> HEIGHT = Stage.placement("iris:anchor/height", AnchorHeight.class);
/** The height the object's blocks are written at: the checked height plus the random offset. */
public static final PlacementStage<AnchorHeight> FINAL = Stage.placement("iris:anchor/final", AnchorHeight.class);
private AnchorStages() {
}
}
@@ -0,0 +1,36 @@
/*
* 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.blocks;
import com.volmit.stage.BlockStage;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/** Module {@code iris:blocks}: writing the object's blocks. */
public final class BlocksStages {
/** Writes each object block where the placement puts it. */
public static final BlockStage<WrittenBlocks> WRITE = Stage.placementBlock("iris:blocks/write", WrittenBlocks.class);
/** Marks some written blocks with the placement's markers. */
public static final PlacementStage<Void> MARKERS = Stage.placement("iris:blocks/markers");
/** Milestone: stages requiring it run after the object and its markers are written. */
public static final PlacementStage<Void> COMPLETE = Stage.placement("iris:blocks/complete");
private BlocksStages() {
}
}
@@ -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.blocks;
import com.volmit.placement.PlacedMarker;
import com.volmit.resource.ResourceId;
import com.volmit.world.BlockPosition;
import java.util.Map;
/**
* Iris markers as IrisApi placement markers: type {@code iris:marker}, naming the pack's marker under the
* {@code marker} attribute. Iris stores markers of this type only.
*/
public final class ObjectMarkers {
public static final ResourceId TYPE = ResourceId.parse("iris:marker");
public static final String MARKER_ATTRIBUTE = "marker";
private ObjectMarkers() {
}
/** {@code markerKey} is the pack's marker, such as {@code spawn/zombie}. */
public static PlacedMarker of(BlockPosition position, String markerKey) {
return new PlacedMarker(position, TYPE, Map.of(MARKER_ATTRIBUTE, markerKey));
}
public static String markerKey(PlacedMarker marker) {
requireIrisMarker(marker);
return marker.attributes().get(MARKER_ATTRIBUTE);
}
public static void requireIrisMarker(PlacedMarker marker) {
if (!marker.type().equals(TYPE) || !marker.attributes().containsKey(MARKER_ATTRIBUTE)) {
throw new IllegalArgumentException("Iris stores markers of type " + TYPE + " with a \"" + MARKER_ATTRIBUTE
+ "\" attribute only, not " + marker.type() + " " + marker.attributes());
}
}
}
@@ -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.blocks;
import com.volmit.placement.PlacedBlock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/** The object's own blocks a placement wrote, in world positions, in the order they were written. */
public final class WrittenBlocks {
private final List<PlacedBlock> blocks = new ArrayList<>();
public void add(PlacedBlock block) {
blocks.add(block);
}
public List<PlacedBlock> blocks() {
return Collections.unmodifiableList(blocks);
}
public boolean isEmpty() {
return blocks.isEmpty();
}
}
@@ -0,0 +1,30 @@
/*
* 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.bore;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/** Module {@code iris:bore}: clearing the object's volume before its blocks are written. */
public final class BoreStages {
public static final PlacementStage<Void> CLEAR = Stage.placement("iris:bore/clear");
private BoreStages() {
}
}
@@ -0,0 +1,34 @@
/*
* 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/>.
*/
/**
* The public face of Iris's built-in modules: their stage constants and the settings and output types
* of those stages. {@link art.arcane.iris.core.modules.IrisModuleHost} exposes this package, with its
* subpackages, to pack modules, so a pack jar can {@code requires(...)} a built-in stage and read its
* output. Everything here is part of what packs compile against.
* <p>
* Keep implementation out of it: stage bodies and anything that uses Iris internals live in the
* built-in module classes outside this package, which packs cannot see. One subpackage per built-in
* module, named after the module path, such as {@code art.arcane.iris.builtin.deposit} for
* {@code iris:deposit}.
* <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
* a pack class that uses a type Iris hides.
*/
package art.arcane.iris.builtin;
@@ -0,0 +1,35 @@
/*
* 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.prepare;
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
import art.arcane.iris.engine.object.placement.PreparedPlacement;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/** Module {@code iris:prepare}: what a placement decides before it looks for its height. */
public final class PrepareStages {
/** The settings the placement uses: the requested ones, turned downhill when they ask to face the slope. Rejects {@code slope}. */
public static final PlacementStage<IrisObjectPlacement> SLOPE = Stage.placement("iris:prepare/slope", IrisObjectPlacement.class);
/** The random rotation, translation and height offset, chosen once per placement. */
public static final PlacementStage<PreparedPlacement> TRANSFORMS = Stage.placement("iris:prepare/transforms", PreparedPlacement.class);
private PrepareStages() {
}
}
@@ -0,0 +1,30 @@
/*
* 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.snow;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/** Module {@code iris:snow}: snow on the object, after its stilt or terrain bend. */
public final class SnowStages {
public static final PlacementStage<Void> COVER = Stage.placement("iris:snow/cover");
private SnowStages() {
}
}
@@ -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.stilt;
import com.volmit.object.ObjectBlock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* The bottom and top layers of the blocks a stilt can repeat, with their positions already transformed
* around the anchor. Each layer keeps the blocks at its lowest or highest height seen so far.
*/
public final class StiltLayers {
private final List<ObjectBlock> bottom = new ArrayList<>();
private final List<ObjectBlock> top = new ArrayList<>();
private int bottomY = Integer.MAX_VALUE;
private int topY = Integer.MIN_VALUE;
public void include(ObjectBlock transformed) {
int y = transformed.position().y();
if (y < bottomY) {
bottomY = y;
bottom.clear();
}
if (y == bottomY) {
bottom.add(transformed);
}
if (y > topY) {
topY = y;
top.clear();
}
if (y == topY) {
top.add(transformed);
}
}
public boolean isEmpty() {
return bottom.isEmpty();
}
public List<ObjectBlock> bottom() {
return Collections.unmodifiableList(bottom);
}
public List<ObjectBlock> top() {
return Collections.unmodifiableList(top);
}
public int bottomY() {
return bottomY;
}
public int topY() {
return topY;
}
}
@@ -0,0 +1,34 @@
/*
* 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.stilt;
import com.volmit.stage.BlockStage;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/** Module {@code iris:stilt}: the stilts of the stilt and ceiling placement modes. */
public final class StiltStages {
/** Finds the layers to repeat. */
public static final BlockStage<StiltLayers> LAYERS = Stage.placementBlock("iris:stilt/layers", StiltLayers.class);
/** Grows the stilt once the object is written. */
public static final PlacementStage<Void> FILL = Stage.placement("iris:stilt/fill");
private StiltStages() {
}
}
@@ -0,0 +1,30 @@
/*
* 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.vacuum;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/** Module {@code iris:vacuum}: bending the terrain to meet objects of the vacuum placement modes. */
public final class VacuumStages {
public static final PlacementStage<Void> TERRAIN = Stage.placement("iris:vacuum/terrain");
private VacuumStages() {
}
}
@@ -0,0 +1,37 @@
/*
* 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.validate;
import com.volmit.stage.PlacementStage;
import com.volmit.stage.Stage;
/** Module {@code iris:validate}: the checks that reject a placement before anything is written, in this order. */
public final class ValidateStages {
/** Rejects {@code bedrock-anchor} and {@code surface-support}. */
public static final PlacementStage<Void> SURFACE = Stage.placement("iris:validate/surface");
/** Rejects {@code underwater-anchor}, {@code cave-clearance}, {@code fluid-height} and {@code height-clamp}. */
public static final PlacementStage<Void> LIMITS = Stage.placement("iris:validate/limits");
/** Rejects {@code native-structure}, even for placements that force their way past the other checks. */
public static final PlacementStage<Void> STRUCTURES = Stage.placement("iris:validate/structures");
/** Rejects {@code object-collision}. */
public static final PlacementStage<Void> COLLISIONS = Stage.placement("iris:validate/collisions");
private ValidateStages() {
}
}