From 699ad3f6fe20bad27546056fa414dfdab158c66c Mon Sep 17 00:00:00 2001 From: piexel Date: Fri, 6 Nov 2026 12:56:05 +0100 Subject: [PATCH] Drop Mantle.isCarved and MantleCaverns The module mantles no longer answer isCarved, so MantleCaverns, which only served it, goes. Tests read the carved layer. --- .../iris/core/modules/IrisModuleMantle.java | 11 --- .../iris/core/modules/MantleCaverns.java | 73 ------------------- .../iris/core/modules/PlacementMantle.java | 8 -- .../core/modules/IrisModuleMantleTest.java | 4 +- .../arcane/iris/engine/modifier/ApiChunk.java | 5 -- 5 files changed, 1 insertion(+), 100 deletions(-) delete mode 100644 core/src/main/java/art/arcane/iris/core/modules/MantleCaverns.java diff --git a/core/src/main/java/art/arcane/iris/core/modules/IrisModuleMantle.java b/core/src/main/java/art/arcane/iris/core/modules/IrisModuleMantle.java index 706aba137..44634e8b7 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/IrisModuleMantle.java +++ b/core/src/main/java/art/arcane/iris/core/modules/IrisModuleMantle.java @@ -121,11 +121,6 @@ final class IrisModuleMantle implements Mantle { return carvedReadOnly; } - @Override - public boolean isCarved(int x, int y, int z) { - return new MantleCaverns(bounds, chunks).isCarved(x, y, z); - } - /** Stored as the biome pass reads it: the platform's id for the biome, as a custom biome inject. */ @Override public void setPlatformBiome(int x, int y, int z, ResourceId biome) { @@ -289,12 +284,6 @@ final class IrisModuleMantle implements Mantle { return carvedForEdit(); } - @Override - public boolean isCarved(int x, int y, int z) { - requireOpen(); - return new MantleCaverns(bounds, chunks).isCarved(x, y, z); - } - @Override public MantleEdit edit() { throw new UnsupportedOperationException("Mantle edits cannot be nested; write through this edit"); diff --git a/core/src/main/java/art/arcane/iris/core/modules/MantleCaverns.java b/core/src/main/java/art/arcane/iris/core/modules/MantleCaverns.java deleted file mode 100644 index 33bfc59b2..000000000 --- a/core/src/main/java/art/arcane/iris/core/modules/MantleCaverns.java +++ /dev/null @@ -1,73 +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 . - */ - -package art.arcane.iris.core.modules; - -import art.arcane.volmlib.util.mantle.runtime.MantleChunk; -import art.arcane.volmlib.util.matter.Matter; -import art.arcane.volmlib.util.matter.MatterCavern; -import com.volmit.geometry.BlockBox; - -/** - * The voids Iris's mantle holds for chunks to take over, IrisApi's {@link com.volmit.mantle.Mantle#isCarved}: where the - * cave planner marked a cavern in the mantle's cavern slice, whatever the cavern holds (air, fluid, lava). - */ -final class MantleCaverns { - private static final int CHUNK_SHIFT = 4; - private static final int SECTION_SHIFT = 4; - private static final int LOCAL_MASK = 15; - - private final BlockBox bounds; - private final IrisModuleMantle.Chunks chunks; - - MantleCaverns(BlockBox bounds, IrisModuleMantle.Chunks chunks) { - this.bounds = bounds; - this.chunks = chunks; - } - - boolean isCarved(int x, int y, int z) { - requireInside(x, y, z); - return cavernAt(requireChunk(x >> CHUNK_SHIFT, z >> CHUNK_SHIFT), x, y, z); - } - - private static boolean cavernAt(MantleChunk chunk, int x, int y, int z) { - int section = y >> SECTION_SHIFT; - if (!chunk.exists(section)) { - return false; - } - Matter matter = chunk.get(section); - if (matter == null || !matter.hasSlice(MatterCavern.class)) { - return false; - } - return matter.getSlice(MatterCavern.class).get(x & LOCAL_MASK, y & LOCAL_MASK, z & LOCAL_MASK) != null; - } - - private MantleChunk requireChunk(int chunkX, int chunkZ) { - MantleChunk chunk = chunks.chunk(chunkX, chunkZ); - if (chunk == null) { - throw new IllegalStateException("Mantle chunk " + chunkX + ", " + chunkZ + " is inside " + bounds + " but was not prepared"); - } - return chunk; - } - - private void requireInside(int x, int y, int z) { - if (!bounds.contains(x, y, z)) { - throw new IndexOutOfBoundsException("Block " + x + ", " + y + ", " + z + " is outside the mantle this invocation prepared, " + bounds); - } - } -} diff --git a/core/src/main/java/art/arcane/iris/core/modules/PlacementMantle.java b/core/src/main/java/art/arcane/iris/core/modules/PlacementMantle.java index 72ef33109..aae216c5a 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/PlacementMantle.java +++ b/core/src/main/java/art/arcane/iris/core/modules/PlacementMantle.java @@ -78,14 +78,6 @@ final class PlacementMantle implements Mantle, AutoCloseable { return new StoredRange<>(placement.carved()); } - @Override - public boolean isCarved(int x, int y, int z) { - if (!bounds.contains(x, y, z)) { - throw new IndexOutOfBoundsException("Block " + x + ", " + y + ", " + z + " is outside the placement area " + bounds); - } - return y >= storedBounds.minY() && y < storedBounds.maxY() && placement.isCarved(x, y, z); - } - @Override public MantleEdit edit() { throw new UnsupportedOperationException("The placement owns the mantle edit; write through layer()"); diff --git a/core/src/test/java/art/arcane/iris/core/modules/IrisModuleMantleTest.java b/core/src/test/java/art/arcane/iris/core/modules/IrisModuleMantleTest.java index 212d103ef..fa71721c2 100644 --- a/core/src/test/java/art/arcane/iris/core/modules/IrisModuleMantleTest.java +++ b/core/src/test/java/art/arcane/iris/core/modules/IrisModuleMantleTest.java @@ -169,8 +169,6 @@ public class IrisModuleMantleTest { assertSame(CarvedVoid.LAVA, mantle.carved().get(6, 40, 5)); assertSame(CarvedVoid.AIR, mantle.carved().get(7, 40, 5)); assertNull(mantle.carved().get(8, 40, 5)); - assertTrue(mantle.isCarved(5, 40, 5)); - assertFalse(mantle.isCarved(8, 40, 5)); } @Test @@ -203,7 +201,7 @@ public class IrisModuleMantleTest { assertNull(mantle.carved().get(-2, 9, 3)); assertSame(CarvedVoid.LAVA, mantle.carved().get(17, 5, 3)); mantle.carved().remove(17, 5, 3); - assertFalse(mantle.isCarved(17, 5, 3)); + assertNull(mantle.carved().get(17, 5, 3)); } @Test diff --git a/core/src/test/java/art/arcane/iris/engine/modifier/ApiChunk.java b/core/src/test/java/art/arcane/iris/engine/modifier/ApiChunk.java index f27d034e0..7c172c926 100644 --- a/core/src/test/java/art/arcane/iris/engine/modifier/ApiChunk.java +++ b/core/src/test/java/art/arcane/iris/engine/modifier/ApiChunk.java @@ -537,11 +537,6 @@ public final class ApiChunk implements GenerationContext { return new CarvedLayer(); } - @Override - public boolean isCarved(int x, int y, int z) { - return carved.contains(new BlockPosition(x, y, z)); - } - @Override public MantleEdit edit() { throw new UnsupportedOperationException("Chunk stages do not edit the mantle");