Narrow force place scope

- Stop treating underground ORGANIC_STILT and CEILING_HANG pieces as forced, so they keep the veto and submerged check
- Return null for broken references on a submerged start, as before force place
- State force placement in the placeMode, underwater and allowWater descriptions and recapture the schema digest
- Pin static objects writing every block over planned river and pond water
- Add tests for forced pieces on open sea, unforced multi-piece starts on sea columns and underground pieces in water
This commit is contained in:
Brian Fopiano committed 2026-11-02 19:51:52 -05:00
1 parent b2255d6bf9
commit bad795f9a7
8 files changed
+239 -39

No files matched your search

@@ -166,14 +166,13 @@ public class IrisStructureComponent extends IrisMantleComponent {
stilt != null && stilt.isSupportNonOccluding());
ObjectPlaceMode mode = placement.pieceMode(structure, pieces.size());
boolean forced = placement.forcesPieces(structure, pieces.size());
boolean sampledHeight = forced && !placement.isAnchoredUnderground();
ObjectWaterRule rule = forced ? ObjectWaterRule.FORCED
: placement.isAllowWater() ? ObjectWaterRule.ENTERS_WATER : ObjectWaterRule.KEEP_OUT;
int failedPieces = 0;
writer.beginObjectPlacement(rule);
try {
for (PlacedStructurePiece p : pieces) {
if (placeObject(writer, run, p, mode, sampledHeight) == -1) {
if (placeObject(writer, run, p, mode, forced) == -1) {
failedPieces++;
}
}
@@ -100,7 +100,7 @@ public class IrisStructure extends IrisRegistrant {
@Description("Whether every open connector must close with a real terminal piece through a mandatory direct fallback.")
private boolean requireCaps = false;
@Description("The place mode used when stamping each piece object into the world.")
@Description("The place mode used when stamping each piece object into the world. A surface structure with a mode other than STRUCTURE_PIECE or FLOATING that assembles to one piece is force placed: it ignores the river limit and the submerged start check and writes through river, pond and sea water.")
private ObjectPlaceMode placeMode = ObjectPlaceMode.STRUCTURE_PIECE;
@ArrayType(min = 1, type = IrisObjectReplace.class)
@@ -41,6 +41,8 @@ import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.structure.nativegen.IrisNativeStructure;
import art.arcane.iris.pack.value.IrisPosition;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.generation.runtime.GenerationFailures;
import art.arcane.iris.generation.stream.ProvisionalAnswerException;
import art.arcane.iris.structure.nativegen.NativeStructureSuppression;
import art.arcane.iris.structure.object.ObjectPlaceMode;
import art.arcane.iris.structure.object.IrisObjectVacuum;
@@ -523,12 +525,20 @@ public final class IrisStructureLocator {
originZ = anchor.z();
int baseY = anchor.y();
boolean submerged = !placement.resolvedAnchor().isCave() && !placement.isUnderwater()
&& NativeStructurePlacementPlanner.isSubmerged(engine, originX, originZ);
String selectedKey = selectStructureKey(placement, rng);
if (selectedKey == null || selectedKey.isBlank()) {
if (submerged) {
return null;
}
throw new IllegalStateException("Iris structure placement selected a blank structure key");
}
IrisStructure structure = engine.getData().load(IrisStructure.class, selectedKey, false);
if (structure == null) {
if (submerged) {
return null;
}
throw new IllegalStateException("Iris structure placement references missing structure '"
+ selectedKey + "'");
}
@@ -536,20 +546,19 @@ public final class IrisStructureLocator {
// Gated out on this Minecraft version; the pack report already says why.
return null;
}
boolean submerged = !placement.resolvedAnchor().isCave() && !placement.isUnderwater()
&& NativeStructurePlacementPlanner.isSubmerged(engine, originX, originZ);
if (submerged && !placement.forcesPieces(structure, 1)) {
return null;
}
StructureGraphCompilation compilation = StructureGraphCatalog.compile(engine.getData(), structure);
if (!compilation.isAssemblyViable()) {
throw new IllegalStateException("Iris structure '" + selectedKey
+ "' has no runtime-viable assembly graph");
StructureAssemblyResult assembly;
try {
assembly = assemble(engine, structure, selectedKey, new IrisPosition(originX, baseY, originZ), rng);
} catch (IllegalStateException failure) {
GenerationFailures.rethrowEngineFailure(failure);
if (!submerged || failure instanceof ProvisionalAnswerException) {
throw failure;
}
return null;
}
StructureAssembler assembler = StructureAssembler.forData(
engine.getData(), structure, new IrisPosition(originX, baseY, originZ));
StructureAssemblyResult assembly = assembler.assemble(rng);
if (submerged && !placement.forcesPieces(structure, assembly.pieces().size())) {
return null;
}
@@ -611,6 +620,14 @@ public final class IrisStructureLocator {
return new ResolvedPlacement(placement, selectedKey, structure, pieces, rng, originX, baseY, originZ, exactY);
}
private static StructureAssemblyResult assemble(Engine engine, IrisStructure structure, String key, IrisPosition origin, RNG rng) {
StructureGraphCompilation compilation = StructureGraphCatalog.compile(engine.getData(), structure);
if (!compilation.isAssemblyViable()) {
throw new IllegalStateException("Iris structure '" + key + "' has no runtime-viable assembly graph");
}
return StructureAssembler.forData(engine.getData(), structure, origin).assemble(rng);
}
public static boolean allowsResolvedFootprint(Engine engine, ResolvedPlacement resolved) {
Objects.requireNonNull(resolved, "resolved placement");
return allowsResolvedFootprint(engine, resolved.placement(), resolved.structure(), resolved.pieces());
@@ -128,10 +128,10 @@ public class IrisStructurePlacement {
@Description("Optional foundation columns placed beneath the assembled structure's occupied bottom cells. Columns pass through air and fluids until they reach solid ground, up to maxDepth.")
private IrisStructureStiltSettings stilt = null;
@Description("If false, the placement is skipped when its selected surface or cave column is submerged.")
@Description("If false, the placement is skipped when its selected surface or cave column is submerged. A force placed surface structure, as described on the structure's placeMode, ignores this.")
private boolean underwater = false;
@Description("If true, a surface structure may cover river, stream, pond and lake water, and its pieces and stilts may fill it. If false, a surface placement is skipped when more than 10% of its footprint columns are channel, pond, cascade or waterfall water, and its pieces keep their solid blocks out of the water they touch.")
@Description("If true, a surface structure may cover river, stream, pond and lake water, and its pieces and stilts may fill it. If false, a surface placement is skipped when more than 10% of its footprint columns are channel, pond, cascade or waterfall water, and its pieces keep their solid blocks out of the water they touch. A force placed surface structure, as described on the structure's placeMode, ignores the limit and writes through the water whatever this is set to.")
private boolean allowWater = false;
public IrisStructureTerrain resolvedTerrain() {
@@ -163,7 +163,7 @@ public class IrisStructurePlacement {
}
public boolean forcesPieces(IrisStructure structure, int pieces) {
return pieceMode(structure, pieces) != ObjectPlaceMode.STRUCTURE_PIECE;
return !isAnchoredUnderground() && pieceMode(structure, pieces) != ObjectPlaceMode.STRUCTURE_PIECE;
}
public boolean isAnchoredUnderground() {