[VERY VERY VERY BAD IDEA]

This commit is contained in:
Brian Neumann-Fopiano committed 2026-09-20 04:24:42 -04:00
1 parent f0e7fea13b
commit 2fa0853e42
892 files changed
+13482 -53554

No files matched your search

@@ -1,6 +1,6 @@
package art.arcane.iris.command.handlers;
import art.arcane.iris.platform.bukkit.nms.datapack.DataVersion;
import art.arcane.iris.pack.datapack.DataVersion;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.director.exceptions.DirectorParsingException;
import org.junit.Test;
@@ -16,7 +16,7 @@ import art.arcane.iris.structure.placement.StructureDistribution;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformStructureHooks;
import art.arcane.iris.spi.PlatformWorld;
import art.arcane.volmlib.nativelib.terrain.NativeWorld;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.director.exceptions.DirectorParsingException;
@@ -82,7 +82,7 @@ public class StructureHandlerTest {
Engine engine = mock(Engine.class);
IrisDimension dimension = mock(IrisDimension.class);
IrisWorld world = mock(IrisWorld.class);
PlatformWorld platformWorld = mock(PlatformWorld.class);
NativeWorld platformWorld = mock(NativeWorld.class);
IrisPlatform platform = mock(IrisPlatform.class);
PlatformStructureHooks hooks = mock(PlatformStructureHooks.class);
IrisImportedStructureControl control = new IrisImportedStructureControl();
@@ -159,7 +159,7 @@ public class StructureHandlerTest {
Engine engine = mock(Engine.class);
IrisDimension dimension = mock(IrisDimension.class);
IrisWorld world = mock(IrisWorld.class);
PlatformWorld platformWorld = mock(PlatformWorld.class);
NativeWorld platformWorld = mock(NativeWorld.class);
IrisPlatform platform = mock(IrisPlatform.class);
PlatformStructureHooks hooks = mock(PlatformStructureHooks.class);
IrisImportedStructureControl control = new IrisImportedStructureControl();
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.biome;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import org.junit.Test;
@@ -18,13 +18,13 @@ import static org.mockito.Mockito.mock;
public class IrisBiomeCeilingLayerTest {
@Test
public void emitsEveryCeilingLayerWithoutSurfaceLayers() {
PlatformBlockState first = mock(PlatformBlockState.class);
PlatformBlockState second = mock(PlatformBlockState.class);
PlatformBlockState third = mock(PlatformBlockState.class);
NativeBlockState first = mock(NativeBlockState.class);
NativeBlockState second = mock(NativeBlockState.class);
NativeBlockState third = mock(NativeBlockState.class);
IrisBiome biome = new IrisBiome().setLayers(new KList<>()).setCaveCeilingLayers(
new KList<>(layer(first, 2), layer(second, 1), layer(third, 2)));
KList<PlatformBlockState> result = biome.generateCeilingLayers(
KList<NativeBlockState> result = biome.generateCeilingLayers(
new IrisDimension(), 13, -27, new RNG(1), 8, 64, null, null);
assertEquals(List.of(first, first, second, third, third), result);
@@ -38,9 +38,9 @@ public class IrisBiomeCeilingLayerTest {
RNG rng = new RNG(37);
second.getLayerHeightGenerators(rng, null);
for (int x = -200; x <= 200; x += 7) {
KList<PlatformBlockState> firstCeiling = first.generateCeilingLayers(
KList<NativeBlockState> firstCeiling = first.generateCeilingLayers(
new IrisDimension(), x, -x, rng, 100, 120, null, null);
KList<PlatformBlockState> secondCeiling = second.generateCeilingLayers(
KList<NativeBlockState> secondCeiling = second.generateCeilingLayers(
new IrisDimension(), x, -x, rng, 100, 120, null, null);
assertEquals(firstCeiling.size(), secondCeiling.size());
}
@@ -51,8 +51,8 @@ public class IrisBiomeCeilingLayerTest {
@Test
public void capsCeilingLayersAtAvailableDepth() {
PlatformBlockState first = mock(PlatformBlockState.class);
PlatformBlockState second = mock(PlatformBlockState.class);
NativeBlockState first = mock(NativeBlockState.class);
NativeBlockState second = mock(NativeBlockState.class);
IrisBiome biome = new IrisBiome().setCaveCeilingLayers(new KList<>(layer(first, 2), layer(second, 3)));
assertEquals(List.of(first, first, second), biome.generateCeilingLayers(
new IrisDimension(), 0, 0, new RNG(1), 3, 64, null, null));
@@ -65,14 +65,14 @@ public class IrisBiomeCeilingLayerTest {
assertTrue(new IrisBiome().getCaveCeilingLayers().isEmpty());
}
static IrisBiomePaletteLayer layer(PlatformBlockState block, int thickness) {
static IrisBiomePaletteLayer layer(NativeBlockState block, int thickness) {
IrisBiomePaletteLayer layer = new IrisBiomePaletteLayer().setMinHeight(thickness).setMaxHeight(thickness);
layer.getBlockData().aquire(() -> new KList<>(block));
return layer;
}
private static IrisBiome variableBiome(int surfaceMinimum, int surfaceMaximum) {
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBlockState block = mock(NativeBlockState.class);
return new IrisBiome()
.setLayers(new KList<>(layer(block, surfaceMinimum).setMaxHeight(surfaceMaximum)))
.setCaveCeilingLayers(new KList<>(layer(block, 1).setMaxHeight(9)));
@@ -4,7 +4,7 @@ import art.arcane.iris.generation.terrain.IrisDimensionTypeOptions;
import art.arcane.iris.pack.validation.ContentGate;
import art.arcane.iris.pack.validation.PackCompatReport;
import art.arcane.iris.platform.bukkit.nms.datapack.IDataFixer;
import art.arcane.iris.pack.datapack.IDataFixer;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.json.JSONArray;
@@ -5,7 +5,7 @@ import art.arcane.iris.generation.terrain.IrisSlopeClip;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.generation.runtime.IrisComplex;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.noise.CNG;
import art.arcane.volmlib.util.stream.ProceduralStream;
import art.arcane.volmlib.util.collection.KList;
@@ -56,7 +56,7 @@ public final class IrisBiomeLayerSlopeSourceTest {
IrisComplex complex = mock(IrisComplex.class);
IrisBiomePaletteLayer grass = mock(IrisBiomePaletteLayer.class);
CNG heightGenerator = mock(CNG.class);
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBlockState block = mock(NativeBlockState.class);
RNG rng = new RNG(19L);
IrisBiome biome = new IrisBiome().setLockLayers(lockLayers).setLayers(new KList<>(grass));
when(complex.hasTerrain3D()).thenReturn(true);
@@ -70,9 +70,9 @@ public final class IrisBiomeLayerSlopeSourceTest {
when(heightGenerator.fit(1, 1, 12D, -8D)).thenReturn(1);
when(grass.get(rng, 0, 12D, 0D, -8D, data)).thenReturn(block);
KList<PlatformBlockState> ledge = biome.generateLayers(
KList<NativeBlockState> ledge = biome.generateLayers(
rockFallbackDimension(), 12D, -8D, rng, 1, 32, data, complex);
KList<PlatformBlockState> cap = biome.generateLayers(
KList<NativeBlockState> cap = biome.generateLayers(
rockFallbackDimension(), 12D, -8D, rng, 1, 96, data, complex);
assertEquals(1, ledge.size());
@@ -90,7 +90,7 @@ public final class IrisBiomeLayerSlopeSourceTest {
ProceduralStream<Double> sourceSlope = mock(ProceduralStream.class);
IrisBiomePaletteLayer paletteLayer = mock(IrisBiomePaletteLayer.class);
CNG heightGenerator = mock(CNG.class);
PlatformBlockState surfaceBlock = mock(PlatformBlockState.class);
NativeBlockState surfaceBlock = mock(NativeBlockState.class);
RNG rng = new RNG(19L);
IrisBiome biome = new IrisBiome();
@@ -110,9 +110,9 @@ public final class IrisBiomeLayerSlopeSourceTest {
when(heightGenerator.fit(1, 1, 12D, -8D)).thenReturn(1);
when(paletteLayer.get(rng, 0, 12D, 0D, -8D, data)).thenReturn(surfaceBlock);
KList<PlatformBlockState> hostLayers = biome.generateLayers(
KList<NativeBlockState> hostLayers = biome.generateLayers(
rockFallbackDimension(), 12D, -8D, rng, 1, 32, data, hostComplex);
KList<PlatformBlockState> sourceLayers = biome.generateLayersWithSlope(
KList<NativeBlockState> sourceLayers = biome.generateLayersWithSlope(
rockFallbackDimension(), 12D, -8D, rng, 1, 32, data, sourceSlope);
assertTrue(hostLayers.isEmpty());
@@ -3,7 +3,7 @@ package art.arcane.iris.generation.biome;
import art.arcane.iris.generation.noise.NoiseStyle;
import art.arcane.iris.generation.terrain.IrisSlopeClip;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import art.arcane.volmlib.util.noise.CNG;
@@ -29,18 +29,18 @@ import static org.mockito.Mockito.verify;
public class IrisBiomeLockedLayerTest {
@Test
public void repeatsLockedLayersAcrossTheReferenceHeight() {
PlatformBlockState first = mock(PlatformBlockState.class);
PlatformBlockState second = mock(PlatformBlockState.class);
PlatformBlockState third = mock(PlatformBlockState.class);
NativeBlockState first = mock(NativeBlockState.class);
NativeBlockState second = mock(NativeBlockState.class);
NativeBlockState third = mock(NativeBlockState.class);
IrisBiome biome = new IrisBiome().setLockLayers(true).setLockLayersMax(8).setLayers(new KList<>(
IrisBiomeCeilingLayerTest.layer(first, 1),
IrisBiomeCeilingLayerTest.layer(second, 1),
IrisBiomeCeilingLayerTest.layer(third, 1)));
List<PlatformBlockState> cycle = List.of(first, second, third);
List<NativeBlockState> cycle = List.of(first, second, third);
int[] heights = {1, 509, 512, 513, 1000, Integer.MAX_VALUE};
int[][] expectedCycles = {{1, 0, 2}, {0, 2, 1}, {0, 2, 1}, {2, 1, 0}, {1, 0, 2}, {1, 0, 2}};
for (int index = 0; index < heights.length; index++) {
KList<PlatformBlockState> blocks = biome.generateLockedLayers(
KList<NativeBlockState> blocks = biome.generateLockedLayers(
13, -27, new RNG(37), 8, heights[index], null, null);
assertEquals(8, blocks.size());
for (int depth = 0; depth < blocks.size(); depth++) {
@@ -51,9 +51,9 @@ public class IrisBiomeLockedLayerTest {
@Test
public void sampledBandsMatchExpandedVariableMixedPalettes() {
PlatformBlockState first = mock(PlatformBlockState.class);
PlatformBlockState second = mock(PlatformBlockState.class);
PlatformBlockState third = mock(PlatformBlockState.class);
NativeBlockState first = mock(NativeBlockState.class);
NativeBlockState second = mock(NativeBlockState.class);
NativeBlockState third = mock(NativeBlockState.class);
long[] seeds = {1L, 37L, -291L, Long.MAX_VALUE};
int[] heights = {Integer.MIN_VALUE, -1000, -1, 0, 509, 512, 513, 1000, Integer.MAX_VALUE};
int[] depths = {0, 1, 7, 39};
@@ -80,9 +80,9 @@ public class IrisBiomeLockedLayerTest {
@Test
public void nullEntriesAndRepeatedCyclesMatchExpandedBands() {
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBlockState block = mock(NativeBlockState.class);
IrisBiome biome = new IrisBiome().setLockLayers(true).setLockLayersMax(30).setLayers(new KList<>(
palette(1, 1, 1D, block), palette(2, 2, 1D, (PlatformBlockState) null)));
palette(1, 1, 1D, block), palette(2, 2, 1D, (NativeBlockState) null)));
RNG rng = new RNG(37L);
assertEquals(expandedBands(biome, 3D, -11D, rng, 30, 1000, 0D),
biome.generateLockedLayers(3D, -11D, rng, 30, 1000, null, null));
@@ -93,7 +93,7 @@ public class IrisBiomeLockedLayerTest {
IrisBiome biome = new IrisBiome().setLockLayers(true).setLayers(new KList<>());
RNG rng = new RNG(37L);
assertTrue(biome.generateLockedLayers(0D, 0D, rng, 7, 64, null, null).isEmpty());
biome.setLayers(new KList<>(palette(0, 0, 1D, mock(PlatformBlockState.class))));
biome.setLayers(new KList<>(palette(0, 0, 1D, mock(NativeBlockState.class))));
assertTrue(biome.generateLockedLayers(0D, 0D, rng, 7, 64, null, null).isEmpty());
assertTrue(biome.generateLockedLayers(0D, 0D, rng, -1, 64, null, null).isEmpty());
}
@@ -101,7 +101,7 @@ public class IrisBiomeLockedLayerTest {
@Test
public void resolvesOnlyRequestedPositionsOfLongBands() {
IrisBiomePaletteLayer layer = spy(palette(1000, 1000, 0.6D,
mock(PlatformBlockState.class), mock(PlatformBlockState.class)));
mock(NativeBlockState.class), mock(NativeBlockState.class)));
IrisBiome biome = new IrisBiome().setLockLayers(true).setLayers(new KList<>(layer));
RNG rng = new RNG(37L);
assertEquals(7, biome.generateLockedLayers(13D, -27D, rng, 7, 64, null, null).size());
@@ -111,7 +111,7 @@ public class IrisBiomeLockedLayerTest {
@Test
public void repeatedCyclesResolveEachPositionOnce() {
IrisBiomePaletteLayer layer = spy(palette(3, 3, 0.6D,
mock(PlatformBlockState.class), mock(PlatformBlockState.class)));
mock(NativeBlockState.class), mock(NativeBlockState.class)));
IrisBiome biome = new IrisBiome().setLockLayers(true).setLockLayersMax(100).setLayers(new KList<>(layer));
RNG rng = new RNG(37L);
assertEquals(100, biome.generateLockedLayers(13D, -27D, rng, 100, 64, null, null).size());
@@ -121,9 +121,9 @@ public class IrisBiomeLockedLayerTest {
@Test
public void slopeFilteredBandsMatchExpandedCycle() {
IrisBiome biome = new IrisBiome().setLockLayers(true).setLockLayersMax(30).setLayers(new KList<>(
palette(2, 4, 0.6D, mock(PlatformBlockState.class)),
palette(3, 8, 1D, mock(PlatformBlockState.class)).setSlopeCondition(new IrisSlopeClip(3D, 255D)),
palette(1, 5, 2D, mock(PlatformBlockState.class)).setSlopeCondition(new IrisSlopeClip(0D, 3D))));
palette(2, 4, 0.6D, mock(NativeBlockState.class)),
palette(3, 8, 1D, mock(NativeBlockState.class)).setSlopeCondition(new IrisSlopeClip(3D, 255D)),
palette(1, 5, 2D, mock(NativeBlockState.class)).setSlopeCondition(new IrisSlopeClip(0D, 3D))));
RNG rng = new RNG(37L);
double[] slopes = {0D, 3D, 8D};
for (double slope : slopes) {
@@ -135,7 +135,7 @@ public class IrisBiomeLockedLayerTest {
@Test
public void sampledPaletteFailuresAreReported() {
IrisBiomePaletteLayer layer = spy(palette(1, 1, 1D, mock(PlatformBlockState.class)));
IrisBiomePaletteLayer layer = spy(palette(1, 1, 1D, mock(NativeBlockState.class)));
IrisBiome biome = new IrisBiome().setLockLayers(true).setLayers(new KList<>(layer));
RNG rng = new RNG(37L);
IllegalStateException failure = new IllegalStateException("Palette unavailable");
@@ -146,17 +146,17 @@ public class IrisBiomeLockedLayerTest {
}
}
private static IrisBiomePaletteLayer palette(int minimum, int maximum, double zoom, PlatformBlockState... blocks) {
private static IrisBiomePaletteLayer palette(int minimum, int maximum, double zoom, NativeBlockState... blocks) {
IrisBiomePaletteLayer layer = new IrisBiomePaletteLayer().setMinHeight(minimum).setMaxHeight(maximum)
.setZoom(zoom).setStyle(NoiseStyle.NOWHERE.style());
layer.getBlockData().aquire(() -> new KList<>(blocks));
return layer;
}
private static KList<PlatformBlockState> expandedBands(IrisBiome biome, double x, double z, RNG rng,
private static KList<NativeBlockState> expandedBands(IrisBiome biome, double x, double z, RNG rng,
int maxDepth, int height, double slope) {
KList<PlatformBlockState> expanded = new KList<>();
KList<PlatformBlockState> result = new KList<>();
KList<NativeBlockState> expanded = new KList<>();
KList<NativeBlockState> result = new KList<>();
KList<CNG> heights = biome.getLayerHeightGenerators(rng, null);
for (int index = 0; index < biome.getLayers().size(); index++) {
IrisBiomePaletteLayer layer = biome.getLayers().get(index);
@@ -4,7 +4,7 @@ import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.generation.terrain.IrisSlopeClip;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.noise.CNG;
import art.arcane.volmlib.util.stream.ProceduralStream;
import art.arcane.volmlib.util.collection.KList;
@@ -23,8 +23,8 @@ public final class IrisSurfaceLayerFallbackTest {
private final IrisData data = mock(IrisData.class);
private final IrisBiomePaletteLayer layer = mock(IrisBiomePaletteLayer.class);
private final CNG heightGenerator = mock(CNG.class);
private final PlatformBlockState surfaceBlock = mock(PlatformBlockState.class);
private final PlatformBlockState secondBlock = mock(PlatformBlockState.class);
private final NativeBlockState surfaceBlock = mock(NativeBlockState.class);
private final NativeBlockState secondBlock = mock(NativeBlockState.class);
private final RNG rng = new RNG(19L);
@SuppressWarnings("unchecked")
@@ -42,7 +42,7 @@ public final class IrisSurfaceLayerFallbackTest {
return new IrisBiome().setLayers(new KList<>(layer));
}
private KList<PlatformBlockState> generate(IrisBiome biome, IrisDimension dim) {
private KList<NativeBlockState> generate(IrisBiome biome, IrisDimension dim) {
return biome.generateLayersWithSlope(dim, 12D, -8D, rng, 4, 32, data, slopeStream);
}
@@ -51,7 +51,7 @@ public final class IrisSurfaceLayerFallbackTest {
IrisBiome biome = biome();
when(layer.getSlopeCondition()).thenReturn(new IrisSlopeClip(0D, 4D));
KList<PlatformBlockState> blocks = generate(biome,
KList<NativeBlockState> blocks = generate(biome,
new IrisDimension().setSurfaceLayerFallback(IrisSurfaceLayerFallback.TOP_LAYER));
assertEquals(1, blocks.size());
@@ -63,7 +63,7 @@ public final class IrisSurfaceLayerFallbackTest {
IrisBiome biome = biome();
when(layer.getSlopeCondition()).thenReturn(new IrisSlopeClip(0D, 4D));
KList<PlatformBlockState> blocks = generate(biome,
KList<NativeBlockState> blocks = generate(biome,
new IrisDimension().setSurfaceLayerFallback(IrisSurfaceLayerFallback.ROCK));
assertTrue(blocks.isEmpty());
@@ -74,9 +74,9 @@ public final class IrisSurfaceLayerFallbackTest {
IrisBiome biome = biome();
when(layer.getSlopeCondition()).thenReturn(new IrisSlopeClip());
KList<PlatformBlockState> topLayer = generate(biome,
KList<NativeBlockState> topLayer = generate(biome,
new IrisDimension().setSurfaceLayerFallback(IrisSurfaceLayerFallback.TOP_LAYER));
KList<PlatformBlockState> rock = generate(biome,
KList<NativeBlockState> rock = generate(biome,
new IrisDimension().setSurfaceLayerFallback(IrisSurfaceLayerFallback.ROCK));
assertEquals(2, topLayer.size());
@@ -90,7 +90,7 @@ public final class IrisSurfaceLayerFallbackTest {
IrisBiome pinnedToTopLayer = biome().setSurfaceLayerFallback(IrisSurfaceLayerFallback.TOP_LAYER);
when(layer.getSlopeCondition()).thenReturn(new IrisSlopeClip(0D, 4D));
KList<PlatformBlockState> overRock = generate(pinnedToTopLayer,
KList<NativeBlockState> overRock = generate(pinnedToTopLayer,
new IrisDimension().setSurfaceLayerFallback(IrisSurfaceLayerFallback.ROCK));
assertEquals(1, overRock.size());
@@ -98,7 +98,7 @@ public final class IrisSurfaceLayerFallbackTest {
IrisBiome pinnedToRock = biome().setSurfaceLayerFallback(IrisSurfaceLayerFallback.ROCK);
KList<PlatformBlockState> overTopLayer = generate(pinnedToRock,
KList<NativeBlockState> overTopLayer = generate(pinnedToRock,
new IrisDimension().setSurfaceLayerFallback(IrisSurfaceLayerFallback.TOP_LAYER));
assertTrue(overTopLayer.isEmpty());
@@ -110,7 +110,7 @@ public final class IrisSurfaceLayerFallbackTest {
when(layer.getSlopeCondition()).thenReturn(new IrisSlopeClip(0D, 4D));
IrisDimension dimension = new IrisDimension().setSurfaceLayerFallback(IrisSurfaceLayerFallback.TOP_LAYER);
KList<PlatformBlockState> blocks = generate(biome, dimension);
KList<NativeBlockState> blocks = generate(biome, dimension);
assertEquals(1, blocks.size());
assertSame(surfaceBlock, blocks.get(0));
@@ -3,7 +3,7 @@ package art.arcane.iris.generation.block;
import art.arcane.iris.generation.mantle.EngineMantle;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.generation.chunk.ChunkDataHunkHolder;
@@ -46,7 +46,7 @@ public class PlatformStateRebindTest {
@Test
public void chunkDataAirIsResolvedAgainstTheCurrentlyBoundPlatform() {
PlatformBlockState first = bindPlatform("first");
NativeBlockState first = bindPlatform("first");
ChunkGenerator.ChunkData chunk = mock(ChunkGenerator.ChunkData.class);
when(chunk.getMinHeight()).thenReturn(-64);
when(chunk.getMaxHeight()).thenReturn(320);
@@ -55,26 +55,26 @@ public class PlatformStateRebindTest {
assertSame(first, holder.getRaw(0, -1, 0));
IrisPlatforms.unbind();
PlatformBlockState second = bindPlatform("second");
NativeBlockState second = bindPlatform("second");
assertSame(second, holder.getRaw(0, -1, 0));
}
@Test
public void mantleAirIsResolvedAgainstTheCurrentlyBoundPlatform() {
PlatformBlockState first = bindPlatform("first");
NativeBlockState first = bindPlatform("first");
assertSame(first, EngineMantle.AIR.get());
IrisPlatforms.unbind();
PlatformBlockState second = bindPlatform("second");
NativeBlockState second = bindPlatform("second");
assertSame(second, EngineMantle.AIR.get());
}
@Test
public void aLatchKeepsServingTheLastResolutionWhileNothingIsBound() {
PlatformBlockState first = bindPlatform("first");
NativeBlockState first = bindPlatform("first");
BoundBlockState state = BoundBlockState.of("AIR");
assertSame(first, state.get());
@@ -105,20 +105,20 @@ public class PlatformStateRebindTest {
continue;
}
Class<?> fieldType = field.getType();
if (PlatformBlockState.class.isAssignableFrom(fieldType)
|| (fieldType.isArray() && PlatformBlockState.class.isAssignableFrom(fieldType.getComponentType()))) {
if (NativeBlockState.class.isAssignableFrom(fieldType)
|| (fieldType.isArray() && NativeBlockState.class.isAssignableFrom(fieldType.getComponentType()))) {
latched.add(type.getName() + "." + field.getName());
}
}
}
private static PlatformBlockState bindPlatform(String label) {
Map<String, PlatformBlockState> states = new HashMap<>();
private static NativeBlockState bindPlatform(String label) {
Map<String, NativeBlockState> states = new HashMap<>();
PlatformRegistries registries = mock(PlatformRegistries.class);
when(registries.block(anyString())).thenAnswer(invocation -> states.computeIfAbsent(
label + ':' + invocation.<String>getArgument(0),
key -> {
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(key);
return state;
}));
@@ -1,5 +1,7 @@
package art.arcane.iris.generation.cache;
import art.arcane.volmlib.util.cache.AtomicCache;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicInteger;
@@ -4,7 +4,7 @@ import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.block.IrisBlockData;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import art.arcane.iris.generation.block.B;
import art.arcane.volmlib.util.math.RNG;
@@ -153,16 +153,16 @@ public class DecoratorCoreTest {
public void singleStackTargetsBlockAboveSupport() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState support = sturdyState();
PlatformBlockState air = mock(PlatformBlockState.class);
PlatformBlockState decorant = mock(PlatformBlockState.class);
NativeBlockState support = sturdyState();
NativeBlockState air = mock(NativeBlockState.class);
NativeBlockState decorant = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
when(decorant.key()).thenReturn("minecraft:stone");
when(decorant.canPlaceOnto(support)).thenReturn(true);
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(1);
when(decorator.pickBlockDataTop(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 4, 1);
output.set(0, 1, 0, support);
output.set(0, 2, 0, air);
DecoratorCore.PlaceOpts opts = new DecoratorCore.PlaceOpts();
@@ -177,15 +177,15 @@ public class DecoratorCoreTest {
public void singleStackDoesNotOverwriteOccupiedTarget() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState support = sturdyState();
PlatformBlockState occupied = mock(PlatformBlockState.class);
PlatformBlockState decorant = mock(PlatformBlockState.class);
NativeBlockState support = sturdyState();
NativeBlockState occupied = mock(NativeBlockState.class);
NativeBlockState decorant = mock(NativeBlockState.class);
when(occupied.isAir()).thenReturn(false);
when(occupied.isFluid()).thenReturn(false);
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(1);
when(decorator.pickBlockDataTop(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 4, 1);
output.set(0, 1, 0, support);
output.set(0, 2, 0, occupied);
DecoratorCore.PlaceOpts opts = new DecoratorCore.PlaceOpts();
@@ -200,10 +200,10 @@ public class DecoratorCoreTest {
public void multiStackStopsBeforeOccupiedTarget() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState support = sturdyState();
PlatformBlockState air = mock(PlatformBlockState.class);
PlatformBlockState occupied = mock(PlatformBlockState.class);
PlatformBlockState decorant = mock(PlatformBlockState.class);
NativeBlockState support = sturdyState();
NativeBlockState air = mock(NativeBlockState.class);
NativeBlockState occupied = mock(NativeBlockState.class);
NativeBlockState decorant = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
when(occupied.isAir()).thenReturn(false);
when(occupied.isFluid()).thenReturn(false);
@@ -214,7 +214,7 @@ public class DecoratorCoreTest {
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
when(decorator.pickBlockDataTop(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 5, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 5, 1);
output.set(0, 1, 0, support);
output.set(0, 2, 0, air);
output.set(0, 3, 0, occupied);
@@ -232,14 +232,14 @@ public class DecoratorCoreTest {
public void descendingStackStopsAtLocalWorldFloor() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState decorant = mock(PlatformBlockState.class);
NativeBlockState decorant = mock(NativeBlockState.class);
when(decorant.key()).thenReturn("minecraft:stone");
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(2);
when(decorator.getTopThreshold()).thenReturn(1.0);
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
when(decorator.pickBlockDataTop(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 2, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 2, 1);
DecoratorCore.PlaceOpts opts = new DecoratorCore.PlaceOpts();
DecoratorCore.placeStackDown(
@@ -252,10 +252,10 @@ public class DecoratorCoreTest {
public void singleDescendingStackPreservesTargetWhenPickIsNull() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState existing = mock(PlatformBlockState.class);
NativeBlockState existing = mock(NativeBlockState.class);
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(1);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 2, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 2, 1);
output.set(0, 0, 0, existing);
DecoratorCore.PlaceOpts opts = new DecoratorCore.PlaceOpts();
@@ -269,12 +269,12 @@ public class DecoratorCoreTest {
public void multiDescendingStackStopsWhenPickIsNull() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState lowerExisting = mock(PlatformBlockState.class);
PlatformBlockState upperExisting = mock(PlatformBlockState.class);
NativeBlockState lowerExisting = mock(NativeBlockState.class);
NativeBlockState upperExisting = mock(NativeBlockState.class);
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(2);
when(decorator.getTopThreshold()).thenReturn(1.0);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 2, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 2, 1);
output.set(0, 0, 0, lowerExisting);
output.set(0, 1, 0, upperExisting);
DecoratorCore.PlaceOpts opts = new DecoratorCore.PlaceOpts();
@@ -290,14 +290,14 @@ public class DecoratorCoreTest {
public void floatingStackStopsAtHunkCeiling() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState decorant = mock(PlatformBlockState.class);
NativeBlockState decorant = mock(NativeBlockState.class);
when(decorant.key()).thenReturn("minecraft:stone");
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(3);
when(decorator.getTopThreshold()).thenReturn(1.0);
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
when(decorator.pickBlockDataTop(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 2, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 2, 1);
int placed = DecoratorCore.placeFloatingStacked(
decorator, 0, 0, 0, 0, 0, 3, output, new RNG(1L), data, null);
@@ -309,13 +309,13 @@ public class DecoratorCoreTest {
public void tallSurfacePlantDoesNotPlaceWhenUpperTargetIsOccupied() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState support = sturdyState();
PlatformBlockState air = airState();
PlatformBlockState occupied = mock(PlatformBlockState.class);
PlatformBlockState plant = tallPlantState();
NativeBlockState support = sturdyState();
NativeBlockState air = airState();
NativeBlockState occupied = mock(NativeBlockState.class);
NativeBlockState plant = tallPlantState();
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(plant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 4, 1);
output.set(0, 0, 0, support);
output.set(0, 1, 0, air);
output.set(0, 2, 0, occupied);
@@ -331,12 +331,12 @@ public class DecoratorCoreTest {
public void tallFloatingPlantDoesNotPlaceWhenUpperTargetIsOccupied() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState air = airState();
PlatformBlockState occupied = mock(PlatformBlockState.class);
PlatformBlockState plant = tallPlantState();
NativeBlockState air = airState();
NativeBlockState occupied = mock(NativeBlockState.class);
NativeBlockState plant = tallPlantState();
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(plant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 4, 1);
output.set(0, 1, 0, air);
output.set(0, 2, 0, occupied);
@@ -351,16 +351,16 @@ public class DecoratorCoreTest {
public void tallSurfacePlantPlacesBothHalvesTogether() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState support = sturdyState();
PlatformBlockState lowerAir = airState();
PlatformBlockState upperAir = airState();
PlatformBlockState lower = mock(PlatformBlockState.class);
PlatformBlockState upper = mock(PlatformBlockState.class);
PlatformBlockState plant = tallPlantState(lower, upper);
NativeBlockState support = sturdyState();
NativeBlockState lowerAir = airState();
NativeBlockState upperAir = airState();
NativeBlockState lower = mock(NativeBlockState.class);
NativeBlockState upper = mock(NativeBlockState.class);
NativeBlockState plant = tallPlantState(lower, upper);
when(plant.canPlaceOnto(support)).thenReturn(true);
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(plant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 4, 1);
output.set(0, 0, 0, support);
output.set(0, 1, 0, lowerAir);
output.set(0, 2, 0, upperAir);
@@ -376,13 +376,13 @@ public class DecoratorCoreTest {
public void surfaceDecorantRejectsInvalidNativeSupport() {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState support = sturdyState();
PlatformBlockState air = airState();
PlatformBlockState decorant = mock(PlatformBlockState.class);
NativeBlockState support = sturdyState();
NativeBlockState air = airState();
NativeBlockState decorant = mock(NativeBlockState.class);
when(decorant.canPlaceOnto(support)).thenReturn(false);
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(decorant);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 3, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 3, 1);
output.set(0, 0, 0, support);
output.set(0, 1, 0, air);
@@ -397,16 +397,16 @@ public class DecoratorCoreTest {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisBlockData forcedBlock = mock(IrisBlockData.class);
IrisData data = mock(IrisData.class);
PlatformBlockState support = sturdyState();
PlatformBlockState farmland = sturdyState();
PlatformBlockState air = airState();
PlatformBlockState wheat = mock(PlatformBlockState.class);
NativeBlockState support = sturdyState();
NativeBlockState farmland = sturdyState();
NativeBlockState air = airState();
NativeBlockState wheat = mock(NativeBlockState.class);
when(wheat.key()).thenReturn("minecraft:wheat[age=7]");
when(decorator.getForceBlock()).thenReturn(forcedBlock);
when(forcedBlock.getBlockData(data)).thenReturn(farmland);
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(wheat);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 3, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 3, 1);
output.set(0, 0, 0, support);
output.set(0, 1, 0, air);
@@ -419,7 +419,7 @@ public class DecoratorCoreTest {
@Test
public void descendingWeepingVinesUsePlantBodiesAndOneFreeEndTip() {
PlatformBlockState vine = mock(PlatformBlockState.class);
NativeBlockState vine = mock(NativeBlockState.class);
when(vine.key()).thenReturn("minecraft:weeping_vines");
assertEquals("minecraft:weeping_vines_plant", DecoratorCore.stackedVineKey(vine, 3, 0));
@@ -429,7 +429,7 @@ public class DecoratorCoreTest {
@Test
public void ascendingTwistingVinesUsePlantBodiesAndOneFreeEndTip() {
PlatformBlockState vine = mock(PlatformBlockState.class);
NativeBlockState vine = mock(NativeBlockState.class);
when(vine.key()).thenReturn("minecraft:twisting_vines_plant");
assertEquals("minecraft:twisting_vines_plant", DecoratorCore.stackedVineKey(vine, 3, 0));
@@ -439,7 +439,7 @@ public class DecoratorCoreTest {
@Test
public void sulfurStalagmiteKeepsSulfurMaterialAndTapersToOneTip() {
Hunk<PlatformBlockState> output = placeSpikeColumn("minecraft:sulfur_spike", 5, true, false);
Hunk<NativeBlockState> output = placeSpikeColumn("minecraft:sulfur_spike", 5, true, false);
assertSpikeColumn(output, "minecraft:sulfur_spike", true, false,
"base", "middle", "middle", "frustum", "tip");
@@ -447,7 +447,7 @@ public class DecoratorCoreTest {
@Test
public void sulfurStalactiteKeepsWaterloggingAndPointsDown() {
Hunk<PlatformBlockState> output = placeSpikeColumn("minecraft:sulfur_spike", 5, false, true);
Hunk<NativeBlockState> output = placeSpikeColumn("minecraft:sulfur_spike", 5, false, true);
assertSpikeColumn(output, "minecraft:sulfur_spike", false, true,
"base", "middle", "middle", "frustum", "tip");
@@ -456,8 +456,8 @@ public class DecoratorCoreTest {
@Test
public void shortSulfurSpikesHaveCorrectTipsInBothDirections() {
for (boolean upward : new boolean[]{true, false}) {
Hunk<PlatformBlockState> single = placeSpikeColumn("minecraft:sulfur_spike", 1, upward, false);
Hunk<PlatformBlockState> pair = placeSpikeColumn("minecraft:sulfur_spike", 2, upward, false);
Hunk<NativeBlockState> single = placeSpikeColumn("minecraft:sulfur_spike", 1, upward, false);
Hunk<NativeBlockState> pair = placeSpikeColumn("minecraft:sulfur_spike", 2, upward, false);
assertSpikeColumn(single, "minecraft:sulfur_spike", upward, false, "tip");
assertSpikeColumn(pair, "minecraft:sulfur_spike", upward, false, "frustum", "tip");
@@ -466,7 +466,7 @@ public class DecoratorCoreTest {
@Test
public void pointedDripstoneRetainsWaterloggingWhenStacked() {
Hunk<PlatformBlockState> output = placeSpikeColumn("minecraft:pointed_dripstone", 4, true, true);
Hunk<NativeBlockState> output = placeSpikeColumn("minecraft:pointed_dripstone", 4, true, true);
assertSpikeColumn(output, "minecraft:pointed_dripstone", true, true,
"base", "middle", "frustum", "tip");
@@ -476,7 +476,7 @@ public class DecoratorCoreTest {
public void clippedSpikesRebuildTheirFreeEndWithoutOverwritingObstructions() {
for (boolean upward : new boolean[]{true, false}) {
SpikeFixture fixture = new SpikeFixture(5, upward);
PlatformBlockState obstruction = sturdyState();
NativeBlockState obstruction = sturdyState();
fixture.output.set(0, upward ? 4 : 2, 0, obstruction);
fixture.place();
@@ -501,19 +501,19 @@ public class DecoratorCoreTest {
public void spikeStacksHonorSurfacePalettesInBothDirections() {
for (boolean upward : new boolean[]{true, false}) {
SpikeFixture fixture = new SpikeFixture(3, upward);
PlatformBlockState allowed = sturdyState();
NativeBlockState allowed = sturdyState();
when(fixture.decorator.getWhitelist()).thenReturn(new KList<>());
when(fixture.decorator.getWhitelistArray(fixture.data)).thenReturn(new PlatformBlockState[]{allowed});
when(fixture.decorator.getWhitelistArray(fixture.data)).thenReturn(new NativeBlockState[]{allowed});
fixture.place();
assertTrue(fixture.output.get(0, upward ? 1 : 3, 0).isAir());
PlatformBlockState support = fixture.output.get(0, upward ? 0 : 4, 0);
NativeBlockState support = fixture.output.get(0, upward ? 0 : 4, 0);
when(support.matches(allowed)).thenReturn(true);
fixture.place();
assertEquals("tip", fixture.property(upward ? 3 : 1, "thickness"));
when(fixture.decorator.getBlacklist()).thenReturn(new KList<>());
when(fixture.decorator.getBlacklistArray(fixture.data)).thenReturn(new PlatformBlockState[]{allowed});
when(fixture.decorator.getBlacklistArray(fixture.data)).thenReturn(new NativeBlockState[]{allowed});
fixture.output.set(0, upward ? 1 : 3, 0, airState());
fixture.place();
assertTrue(fixture.output.get(0, upward ? 1 : 3, 0).isAir());
@@ -524,8 +524,8 @@ public class DecoratorCoreTest {
public void submergedSpikesWaterlogAndStopAtLava() {
for (boolean upward : new boolean[]{true, false}) {
SpikeFixture fixture = new SpikeFixture(4, upward);
PlatformBlockState water = mock(PlatformBlockState.class);
PlatformBlockState lava = mock(PlatformBlockState.class);
NativeBlockState water = mock(NativeBlockState.class);
NativeBlockState lava = mock(NativeBlockState.class);
when(water.isFluid()).thenReturn(true);
when(water.isWater()).thenReturn(true);
when(lava.isFluid()).thenReturn(true);
@@ -548,7 +548,7 @@ public class DecoratorCoreTest {
for (boolean upward : new boolean[]{true, false}) {
SpikeFixture fixture = new SpikeFixture(5, upward);
int oppositeY = 3;
PlatformBlockState opposite = spikeState("minecraft:sulfur_spike", Map.of(
NativeBlockState opposite = spikeState("minecraft:sulfur_spike", Map.of(
"thickness", "tip", "vertical_direction", upward ? "down" : "up", "waterlogged", "false"));
fixture.output.set(0, oppositeY, 0, opposite);
fixture.place();
@@ -563,7 +563,7 @@ public class DecoratorCoreTest {
@Test
public void sulfurTipsDoNotMergeWithPointedDripstone() {
SpikeFixture fixture = new SpikeFixture(4, true);
PlatformBlockState dripstone = spikeState("minecraft:pointed_dripstone", Map.of(
NativeBlockState dripstone = spikeState("minecraft:pointed_dripstone", Map.of(
"thickness", "tip", "vertical_direction", "down", "waterlogged", "false"));
fixture.output.set(0, 3, 0, dripstone);
fixture.place();
@@ -591,7 +591,7 @@ public class DecoratorCoreTest {
@Test
public void extendingSpikeRepairsTheExistingTipBehindIt() {
SpikeFixture fixture = new SpikeFixture(3, true);
PlatformBlockState spike = spikeState("minecraft:sulfur_spike", Map.of(
NativeBlockState spike = spikeState("minecraft:sulfur_spike", Map.of(
"thickness", "tip", "vertical_direction", "up", "waterlogged", "false"));
fixture.output.set(0, 0, 0, spike);
fixture.place();
@@ -605,13 +605,13 @@ public class DecoratorCoreTest {
@Test
public void singleSpikeChecksPaletteBeforeReplacingItsSupport() {
SpikeFixture fixture = new SpikeFixture(1, true);
PlatformBlockState original = fixture.output.get(0, 0, 0);
PlatformBlockState replacement = sturdyState();
NativeBlockState original = fixture.output.get(0, 0, 0);
NativeBlockState replacement = sturdyState();
IrisBlockData forced = mock(IrisBlockData.class);
when(forced.getBlockData(fixture.data)).thenReturn(replacement);
when(fixture.decorator.getForceBlock()).thenReturn(forced);
when(fixture.decorator.getWhitelist()).thenReturn(new KList<>());
when(fixture.decorator.getWhitelistArray(fixture.data)).thenReturn(new PlatformBlockState[]{original});
when(fixture.decorator.getWhitelistArray(fixture.data)).thenReturn(new NativeBlockState[]{original});
DecoratorCore.placeSurfaceSingle(fixture.decorator, 0, 0, 0, 0, 0,
fixture.output, new RNG(1L), fixture.data, false, false, null);
@@ -623,9 +623,9 @@ public class DecoratorCoreTest {
@Test
public void clippedCeilingVinesRetainTheirGrowingTip() {
SpikeFixture fixture = new SpikeFixture(5, false);
PlatformBlockState plant = mock(PlatformBlockState.class);
PlatformBlockState tip = mock(PlatformBlockState.class);
PlatformBlockState obstruction = sturdyState();
NativeBlockState plant = mock(NativeBlockState.class);
NativeBlockState tip = mock(NativeBlockState.class);
NativeBlockState obstruction = sturdyState();
when(plant.key()).thenReturn("minecraft:weeping_vines_plant");
when(tip.key()).thenReturn("minecraft:weeping_vines");
when(fixture.decorator.pickBlockData(any(RNG.class), eq(fixture.data), anyDouble(), anyDouble())).thenReturn(tip);
@@ -644,11 +644,11 @@ public class DecoratorCoreTest {
@Test
public void boundDecoratorHooksWinWhenBukkitClassesArePresent() {
PlatformBlockState vine = mock(PlatformBlockState.class);
PlatformBlockState fixed = mock(PlatformBlockState.class);
PlatformBlockState decorator = mock(PlatformBlockState.class);
PlatformBlockState surface = mock(PlatformBlockState.class);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 1, 1);
NativeBlockState vine = mock(NativeBlockState.class);
NativeBlockState fixed = mock(NativeBlockState.class);
NativeBlockState decorator = mock(NativeBlockState.class);
NativeBlockState surface = mock(NativeBlockState.class);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 1, 1);
DecoratorPlatformHooks.FaceFixer faceFixer = mock(DecoratorPlatformHooks.FaceFixer.class);
DecoratorPlatformHooks.SurfaceSturdiness sturdiness = mock(DecoratorPlatformHooks.SurfaceSturdiness.class);
when(vine.isVineBlock()).thenReturn(true);
@@ -664,16 +664,16 @@ public class DecoratorCoreTest {
}
}
private PlatformBlockState airState() {
PlatformBlockState air = mock(PlatformBlockState.class);
private NativeBlockState airState() {
NativeBlockState air = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
return air;
}
private Hunk<PlatformBlockState> placeSpikeColumn(String material, int height, boolean upward, boolean waterlogged) {
private Hunk<NativeBlockState> placeSpikeColumn(String material, int height, boolean upward, boolean waterlogged) {
IrisDecorator decorator = mock(IrisDecorator.class);
IrisData data = mock(IrisData.class);
PlatformBlockState spike = spikeState(material, Map.of(
NativeBlockState spike = spikeState(material, Map.of(
"thickness", "tip_merge", "vertical_direction", upward ? "down" : "up",
"waterlogged", Boolean.toString(waterlogged)));
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(height);
@@ -681,11 +681,11 @@ public class DecoratorCoreTest {
when(decorator.pickBlockData(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(spike);
when(decorator.pickBlockDataTop(any(RNG.class), eq(data), anyDouble(), anyDouble())).thenReturn(spike);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, height + 2, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, height + 2, 1);
for (int y = 1; y <= height; y++) {
output.set(0, y, 0, airState());
}
PlatformBlockState support = sturdyState();
NativeBlockState support = sturdyState();
output.set(0, upward ? 0 : height + 1, 0, support);
DecoratorCore.PlaceOpts opts = new DecoratorCore.PlaceOpts();
if (upward) {
@@ -697,7 +697,7 @@ public class DecoratorCoreTest {
return output;
}
private void assertSpikeColumn(Hunk<PlatformBlockState> output, String material,
private void assertSpikeColumn(Hunk<NativeBlockState> output, String material,
boolean upward, boolean waterlogged, String... thicknesses) {
for (int index = 0; index < thicknesses.length; index++) {
int y = upward ? index + 1 : thicknesses.length - index;
@@ -708,12 +708,12 @@ public class DecoratorCoreTest {
}
}
private PlatformBlockState spikeState(String material, Map<String, String> properties) {
PlatformBlockState state = mock(PlatformBlockState.class);
private NativeBlockState spikeState(String material, Map<String, String> properties) {
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(material + "[thickness=" + properties.get("thickness")
+ ",vertical_direction=" + properties.get("vertical_direction")
+ ",waterlogged=" + properties.get("waterlogged") + "]");
when(state.canPlaceOnto(any(PlatformBlockState.class))).thenReturn(true);
when(state.canPlaceOnto(any(NativeBlockState.class))).thenReturn(true);
when(state.withProperty(anyString(), anyString())).thenAnswer(invocation -> {
Map<String, String> updated = new LinkedHashMap<>(properties);
updated.put(invocation.getArgument(0), invocation.getArgument(1));
@@ -722,20 +722,20 @@ public class DecoratorCoreTest {
return state;
}
private PlatformBlockState tallPlantState() {
return tallPlantState(mock(PlatformBlockState.class), mock(PlatformBlockState.class));
private NativeBlockState tallPlantState() {
return tallPlantState(mock(NativeBlockState.class), mock(NativeBlockState.class));
}
private PlatformBlockState tallPlantState(PlatformBlockState lower, PlatformBlockState upper) {
PlatformBlockState plant = mock(PlatformBlockState.class);
private NativeBlockState tallPlantState(NativeBlockState lower, NativeBlockState upper) {
NativeBlockState plant = mock(NativeBlockState.class);
when(plant.key()).thenReturn("minecraft:tall_grass[half=lower]");
when(plant.withProperty("half", "lower")).thenReturn(lower);
when(plant.withProperty("half", "upper")).thenReturn(upper);
return plant;
}
private PlatformBlockState sturdyState() {
PlatformBlockState support = mock(PlatformBlockState.class);
private NativeBlockState sturdyState() {
NativeBlockState support = mock(NativeBlockState.class);
BlockData blockData = mock(BlockData.class);
when(support.nativeHandle()).thenReturn(blockData);
when(blockData.isFaceSturdy(any(), eq(BlockSupport.FULL))).thenReturn(true);
@@ -745,7 +745,7 @@ public class DecoratorCoreTest {
private final IrisDecorator decorator = mock(IrisDecorator.class);
private final IrisData data = mock(IrisData.class);
private final DecoratorCore.PlaceOpts opts = new DecoratorCore.PlaceOpts();
private final Hunk<PlatformBlockState> output;
private final Hunk<NativeBlockState> output;
private final int height;
private final boolean upward;
@@ -757,7 +757,7 @@ public class DecoratorCoreTest {
output.set(0, y, 0, airState());
}
output.set(0, upward ? 0 : height + 1, 0, sturdyState());
PlatformBlockState spike = spikeState("minecraft:sulfur_spike", Map.of(
NativeBlockState spike = spikeState("minecraft:sulfur_spike", Map.of(
"thickness", "tip_merge", "vertical_direction", upward ? "down" : "up", "waterlogged", "false"));
when(decorator.getHeight(any(RNG.class), anyDouble(), anyDouble(), eq(data))).thenReturn(height);
when(decorator.getTopThreshold()).thenReturn(0.75);
@@ -8,7 +8,7 @@ import art.arcane.iris.generation.runtime.SeedManager;
import art.arcane.iris.generation.terrain.InferredType;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformRegistries;
@@ -37,7 +37,7 @@ public class IrisDecoratorCaveContextTest {
@BeforeClass
public static void bindPlatform() {
IrisPlatforms.unbind();
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
doReturn(true).when(air).isAir();
doReturn("minecraft:air").when(air).key();
PlatformRegistries registries = mock(PlatformRegistries.class);
@@ -80,9 +80,9 @@ public class IrisDecoratorCaveContextTest {
doReturn(new IrisDecorator[]{decorator}).when(biome).getDecoratorBucket(IrisDecorationPart.NONE);
doReturn(new IrisDecorator[]{decorator}).when(biome).getDecoratorBucket(IrisDecorationPart.CEILING);
PlatformBlockState fluid = mock(PlatformBlockState.class);
NativeBlockState fluid = mock(NativeBlockState.class);
doReturn(true).when(fluid).isFluid();
Hunk<PlatformBlockState> output = mock(Hunk.class);
Hunk<NativeBlockState> output = mock(Hunk.class);
doReturn(128).when(output).getHeight();
doReturn(fluid).when(output).get(0, 10, 0);
@@ -108,9 +108,9 @@ public class IrisDecoratorCaveContextTest {
@Test
@SuppressWarnings("unchecked")
public void underwaterSurfaceDecorationRequiresActualFluidAboveTheTerrain() {
Hunk<PlatformBlockState> output = mock(Hunk.class);
PlatformBlockState dry = mock(PlatformBlockState.class);
PlatformBlockState fluid = mock(PlatformBlockState.class);
Hunk<NativeBlockState> output = mock(Hunk.class);
NativeBlockState dry = mock(NativeBlockState.class);
NativeBlockState fluid = mock(NativeBlockState.class);
doReturn(128).when(output).getHeight();
doReturn(dry).when(output).get(0, 11, 0);
doReturn(false).when(dry).isFluid();
@@ -132,7 +132,7 @@ public class IrisDecoratorCaveContextTest {
assertTrue(IrisSurfaceDecorator.isAquaticPlacement(state("minecraft:sea_pickle[pickles=2]")));
assertTrue(IrisSurfaceDecorator.isAquaticPlacement(state("minecraft:fire_coral_fan")));
PlatformBlockState waterlogged = state("minecraft:oak_fence[waterlogged=true]");
NativeBlockState waterlogged = state("minecraft:oak_fence[waterlogged=true]");
doReturn(true).when(waterlogged).isWaterLogged();
assertTrue(IrisSurfaceDecorator.isAquaticPlacement(waterlogged));
@@ -142,10 +142,10 @@ public class IrisDecoratorCaveContextTest {
@Test
public void compatibleWaterMustBeHorizontallyConnected() {
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, 3, 1);
PlatformBlockState centerWater = waterState();
PlatformBlockState neighborWater = waterState();
PlatformBlockState lava = fluidState();
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, 3, 1);
NativeBlockState centerWater = waterState();
NativeBlockState neighborWater = waterState();
NativeBlockState lava = fluidState();
output.set(1, 1, 0, centerWater);
assertFalse(IrisSurfaceDecorator.hasConnectedWater(output, 1, 1, 0));
@@ -160,10 +160,10 @@ public class IrisDecoratorCaveContextTest {
@Test
public void aquaticPlacementAtFluidHeightBoundaryRestoresDryBank() {
IrisData data = mock(IrisData.class);
PlatformBlockState air = state("minecraft:air");
PlatformBlockState seagrass = state("minecraft:seagrass");
NativeBlockState air = state("minecraft:air");
NativeBlockState seagrass = state("minecraft:seagrass");
IrisDecorator decorator = aquaticDecorator(data, seagrass, false, 1);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, 4, 1);
output.set(1, 1, 0, air);
IrisSurfaceDecorator.AquaticPlacementSnapshot snapshot = IrisSurfaceDecorator.captureAquaticPlacement(
@@ -177,11 +177,11 @@ public class IrisDecoratorCaveContextTest {
@Test
public void legitimateUnderwaterAquaticPlacementIsPreserved() {
IrisData data = mock(IrisData.class);
PlatformBlockState sourceWater = waterState();
PlatformBlockState adjacentWater = waterState();
PlatformBlockState kelp = state("minecraft:kelp_plant");
NativeBlockState sourceWater = waterState();
NativeBlockState adjacentWater = waterState();
NativeBlockState kelp = state("minecraft:kelp_plant");
IrisDecorator decorator = aquaticDecorator(data, kelp, true, 1);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, 4, 1);
output.set(1, 1, 0, sourceWater);
output.set(0, 1, 0, adjacentWater);
@@ -196,12 +196,12 @@ public class IrisDecoratorCaveContextTest {
@Test
public void unsupportedUpperStackRestoresTheWholeAquaticPlacement() {
IrisData data = mock(IrisData.class);
PlatformBlockState lowerWater = waterState();
PlatformBlockState upperWater = waterState();
PlatformBlockState adjacentWater = waterState();
PlatformBlockState kelp = state("minecraft:kelp_plant");
NativeBlockState lowerWater = waterState();
NativeBlockState upperWater = waterState();
NativeBlockState adjacentWater = waterState();
NativeBlockState kelp = state("minecraft:kelp_plant");
IrisDecorator decorator = aquaticDecorator(data, kelp, true, 2);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, 4, 1);
output.set(1, 1, 0, lowerWater);
output.set(1, 2, 0, upperWater);
output.set(0, 1, 0, adjacentWater);
@@ -219,12 +219,12 @@ public class IrisDecoratorCaveContextTest {
@Test
public void dryWaterloggedAndTwoBlockAquaticPlacementsAreRestoredAtomically() {
IrisData data = mock(IrisData.class);
PlatformBlockState lowerAir = state("minecraft:air");
PlatformBlockState upperAir = state("minecraft:air");
PlatformBlockState lower = state("minecraft:tall_seagrass[half=lower]");
PlatformBlockState upper = state("minecraft:tall_seagrass[half=upper]");
NativeBlockState lowerAir = state("minecraft:air");
NativeBlockState upperAir = state("minecraft:air");
NativeBlockState lower = state("minecraft:tall_seagrass[half=lower]");
NativeBlockState upper = state("minecraft:tall_seagrass[half=upper]");
IrisDecorator decorator = aquaticDecorator(data, lower, false, 1);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, 4, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, 4, 1);
output.set(1, 1, 0, lowerAir);
output.set(1, 2, 0, upperAir);
@@ -237,7 +237,7 @@ public class IrisDecoratorCaveContextTest {
assertSame(lowerAir, output.get(1, 1, 0));
assertSame(upperAir, output.get(1, 2, 0));
PlatformBlockState dryWaterlogged = state("minecraft:mangrove_roots[waterlogged=true]");
NativeBlockState dryWaterlogged = state("minecraft:mangrove_roots[waterlogged=true]");
doReturn(true).when(dryWaterlogged).isWaterLogged();
IrisDecorator waterloggedDecorator = aquaticDecorator(data, dryWaterlogged, false, 1);
IrisSurfaceDecorator.AquaticPlacementSnapshot waterloggedSnapshot = IrisSurfaceDecorator.captureAquaticPlacement(
@@ -250,32 +250,32 @@ public class IrisDecoratorCaveContextTest {
private IrisDecorator aquaticDecorator(
IrisData data,
PlatformBlockState aquatic,
NativeBlockState aquatic,
boolean stacking,
int stackMaximum
) {
IrisDecorator decorator = mock(IrisDecorator.class);
doReturn(new PlatformBlockState[]{aquatic}).when(decorator).getBlockDataArray(data);
doReturn(new PlatformBlockState[0]).when(decorator).getBlockDataTopsArray(data);
doReturn(new NativeBlockState[]{aquatic}).when(decorator).getBlockDataArray(data);
doReturn(new NativeBlockState[0]).when(decorator).getBlockDataTopsArray(data);
doReturn(stacking).when(decorator).isStacking();
doReturn(stackMaximum).when(decorator).getStackMax();
return decorator;
}
private PlatformBlockState state(String key) {
PlatformBlockState state = mock(PlatformBlockState.class);
private NativeBlockState state(String key) {
NativeBlockState state = mock(NativeBlockState.class);
doReturn(key).when(state).key();
return state;
}
private PlatformBlockState waterState() {
PlatformBlockState water = fluidState();
private NativeBlockState waterState() {
NativeBlockState water = fluidState();
doReturn(true).when(water).isWater();
return water;
}
private PlatformBlockState fluidState() {
PlatformBlockState fluid = state("minecraft:lava");
private NativeBlockState fluidState() {
NativeBlockState fluid = state("minecraft:lava");
doReturn(true).when(fluid).isFluid();
return fluid;
}
@@ -5,7 +5,7 @@ import art.arcane.iris.generation.block.IrisBlockData;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.volmlib.util.documentation.Description;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.generation.block.B;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
@@ -70,15 +70,15 @@ public class IrisDepositTuningTest {
IrisDepositGenerator generator = new IrisDepositGenerator();
assertTrue(generator.getSurfaceReplaceableBlocks().isEmpty());
assertTrue(generator.canReplaceSurface(mock(PlatformBlockState.class)));
assertTrue(generator.canReplaceSurface(mock(NativeBlockState.class)));
}
@Test
public void surfaceHostFilterAllowsOnlyConfiguredMaterials() {
IrisDepositGenerator generator = new IrisDepositGenerator();
generator.setSurfaceReplaceableBlocks(new KList<String>().qadd("minecraft:stone"));
PlatformBlockState stone = mock(PlatformBlockState.class);
PlatformBlockState dirt = mock(PlatformBlockState.class);
NativeBlockState stone = mock(NativeBlockState.class);
NativeBlockState dirt = mock(NativeBlockState.class);
when(stone.key()).thenReturn("minecraft:stone");
when(dirt.key()).thenReturn("minecraft:dirt");
@@ -105,8 +105,8 @@ public class IrisDepositTuningTest {
new KList<String>().qadd("minecraft:stone").qadd("minecraft:sand"));
IrisBiome disabled = new IrisBiome();
disabled.setSurfaceOreReplaceableBlocks(new KList<>());
PlatformBlockState stone = mock(PlatformBlockState.class);
PlatformBlockState sand = mock(PlatformBlockState.class);
NativeBlockState stone = mock(NativeBlockState.class);
NativeBlockState sand = mock(NativeBlockState.class);
when(stone.key()).thenReturn("minecraft:stone");
when(sand.key()).thenReturn("minecraft:sand");
@@ -139,8 +139,8 @@ public class IrisDepositTuningTest {
@Test
public void biomeSurfaceHostPolicySetterInvalidatesResolvedHosts() {
IrisBiome biome = new IrisBiome();
PlatformBlockState stone = mock(PlatformBlockState.class);
PlatformBlockState sand = mock(PlatformBlockState.class);
NativeBlockState stone = mock(NativeBlockState.class);
NativeBlockState sand = mock(NativeBlockState.class);
when(stone.key()).thenReturn("minecraft:stone");
when(sand.key()).thenReturn("minecraft:sand");
@@ -273,7 +273,7 @@ public class IrisDepositTuningTest {
private IrisDepositGenerator generatorWithState(IrisData data, boolean ore, String key) {
IrisBlockData block = mock(IrisBlockData.class);
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
when(block.getBlockData(data)).thenReturn(state);
when(state.isOre()).thenReturn(ore);
when(state.key()).thenReturn(key);
@@ -4,7 +4,7 @@ import art.arcane.iris.generation.block.IrisBlockData;
import art.arcane.iris.generation.noise.IrisGeneratorStyle;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.noise.CNG;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
@@ -52,7 +52,7 @@ public class IrisOreGeneratorTest {
private static final class Fixture {
private final RNG rng = new RNG(34L);
private final PlatformBlockState ore = mock(PlatformBlockState.class);
private final NativeBlockState ore = mock(NativeBlockState.class);
private final CNG noise = mock(CNG.class);
private final IrisGeneratorStyle style = mock(IrisGeneratorStyle.class);
private final IrisOreGenerator generator = new IrisOreGenerator();
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.decoration;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import org.junit.Test;
@@ -65,7 +65,7 @@ public class IrisSeaDecoratorBoundsTest {
public void unresolvedFloorPalettePreservesExistingWater() {
Fixture fixture = new Fixture(8, false);
fixture.stacking(100, 30);
PlatformBlockState water = mock(PlatformBlockState.class);
NativeBlockState water = mock(NativeBlockState.class);
fixture.output.set(0, 3, 0, water);
when(fixture.decorator.getBlockData100(any(), any(), anyDouble(), anyDouble(), anyDouble(), any())).thenReturn(null);
@@ -113,10 +113,10 @@ public class IrisSeaDecoratorBoundsTest {
private static final class Fixture {
private final IrisDecorator decorator = mock(IrisDecorator.class);
private final IrisBiome biome = mock(IrisBiome.class);
private final PlatformBlockState body = mock(PlatformBlockState.class);
private final PlatformBlockState top = mock(PlatformBlockState.class);
private final NativeBlockState body = mock(NativeBlockState.class);
private final NativeBlockState top = mock(NativeBlockState.class);
private final Engine engine = mock(Engine.class, RETURNS_DEEP_STUBS);
private final Hunk<PlatformBlockState> output;
private final Hunk<NativeBlockState> output;
private final IrisEngineDecorator placement;
private Fixture(int height, boolean surface) {
@@ -8,7 +8,7 @@ import art.arcane.iris.generation.runtime.SeedManager;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.generation.terrain.IrisSlopeClip;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformRegistries;
@@ -43,7 +43,7 @@ public class IrisShoreLineDecoratorTest {
@BeforeClass
public static void bindPlatform() {
IrisPlatforms.unbind();
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
doReturn(true).when(air).isAir();
doReturn("minecraft:air").when(air).key();
PlatformRegistries registries = mock(PlatformRegistries.class);
@@ -62,9 +62,9 @@ public class IrisShoreLineDecoratorTest {
@Test
public void carvedSurfaceRejectsShorelineDecoration() {
Fixture fixture = createFixture(false);
PlatformBlockState carvedAir = airState();
PlatformBlockState targetAir = airState();
Hunk<PlatformBlockState> output = output(carvedAir, targetAir);
NativeBlockState carvedAir = airState();
NativeBlockState targetAir = airState();
Hunk<NativeBlockState> output = output(carvedAir, targetAir);
fixture.shoreline.decorate(0, 0, 0, 1, -1, 0, 1, -1,
output, fixture.biome, FLUID_HEIGHT, output.getHeight());
@@ -78,10 +78,10 @@ public class IrisShoreLineDecoratorTest {
@Test
public void preservedFluidRejectsShorelineDecoration() {
Fixture fixture = createFixture(false);
PlatformBlockState fluid = mock(PlatformBlockState.class);
PlatformBlockState targetAir = airState();
NativeBlockState fluid = mock(NativeBlockState.class);
NativeBlockState targetAir = airState();
when(fluid.isFluid()).thenReturn(true);
Hunk<PlatformBlockState> output = output(fluid, targetAir);
Hunk<NativeBlockState> output = output(fluid, targetAir);
fixture.shoreline.decorate(0, 0, 0, 1, -1, 0, 1, -1,
output, fixture.biome, FLUID_HEIGHT, output.getHeight());
@@ -94,10 +94,10 @@ public class IrisShoreLineDecoratorTest {
@Test
public void sturdySurfacePlacesShorelineDecoration() {
Fixture fixture = createFixture(false);
PlatformBlockState support = sturdyState();
PlatformBlockState targetAir = airState();
NativeBlockState support = sturdyState();
NativeBlockState targetAir = airState();
when(fixture.decorant.canPlaceOnto(support)).thenReturn(true);
Hunk<PlatformBlockState> output = output(support, targetAir);
Hunk<NativeBlockState> output = output(support, targetAir);
fixture.shoreline.decorate(0, 0, 0, 1, -1, 0, 1, -1,
output, fixture.biome, FLUID_HEIGHT, output.getHeight());
@@ -108,10 +108,10 @@ public class IrisShoreLineDecoratorTest {
@Test
public void acceptedShoreUsesPublishedGeometry() {
Fixture fixture = createFixture(false, false);
PlatformBlockState support = sturdyState();
PlatformBlockState targetAir = airState();
NativeBlockState support = sturdyState();
NativeBlockState targetAir = airState();
when(fixture.decorant.canPlaceOnto(support)).thenReturn(true);
Hunk<PlatformBlockState> output = output(support, targetAir);
Hunk<NativeBlockState> output = output(support, targetAir);
fixture.shoreline.decorate(0, 0, 0, 1, -1, 0, 1, -1,
output, fixture.biome, FLUID_HEIGHT, output.getHeight());
@@ -135,8 +135,8 @@ public class IrisShoreLineDecoratorTest {
@Test
public void forcePlaceStillRejectsMissingSurface() {
Fixture fixture = createFixture(true);
PlatformBlockState targetAir = airState();
Hunk<PlatformBlockState> output = output(airState(), targetAir);
NativeBlockState targetAir = airState();
Hunk<NativeBlockState> output = output(airState(), targetAir);
fixture.shoreline.decorateAcceptedShore(
0,
@@ -155,13 +155,13 @@ public class IrisShoreLineDecoratorTest {
@Test
public void acceptedShoreCaneRequiresWaterBesideTheActualSubstrate() {
Fixture fixture = createFixture(false, false);
PlatformBlockState support = sturdyState();
PlatformBlockState air = airState();
PlatformBlockState water = mock(PlatformBlockState.class);
NativeBlockState support = sturdyState();
NativeBlockState air = airState();
NativeBlockState water = mock(NativeBlockState.class);
when(water.isWater()).thenReturn(true);
when(fixture.decorant.key()).thenReturn("minecraft:sugar_cane[age=0]");
when(fixture.decorant.canPlaceOnto(support)).thenReturn(true);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, FLUID_HEIGHT + 3, 3);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, FLUID_HEIGHT + 3, 3);
output.set(1, FLUID_HEIGHT, 1, support);
output.set(1, FLUID_HEIGHT + 1, 1, air);
@@ -175,11 +175,11 @@ public class IrisShoreLineDecoratorTest {
@Test
public void forcedShoreCaneCannotUseStone() {
Fixture fixture = createFixture(true, false);
PlatformBlockState stone = sturdyState();
PlatformBlockState air = airState();
NativeBlockState stone = sturdyState();
NativeBlockState air = airState();
when(fixture.decorant.key()).thenReturn("minecraft:sugar_cane[age=0]");
when(fixture.decorant.canPlaceOnto(stone)).thenReturn(false);
Hunk<PlatformBlockState> output = output(stone, air);
Hunk<NativeBlockState> output = output(stone, air);
fixture.shoreline.decorateAcceptedShore(0, 0, 0, 0, output, fixture.biome, FLUID_HEIGHT, output.getHeight());
@@ -189,10 +189,10 @@ public class IrisShoreLineDecoratorTest {
@Test
public void unsupportedWaterloggedStackRestoresEveryOriginalBlock() {
Fixture fixture = createFixture(false, false);
PlatformBlockState support = sturdyState();
PlatformBlockState lowerOriginal = airState();
PlatformBlockState upperOriginal = airState();
PlatformBlockState waterloggedTop = mock(PlatformBlockState.class);
NativeBlockState support = sturdyState();
NativeBlockState lowerOriginal = airState();
NativeBlockState upperOriginal = airState();
NativeBlockState waterloggedTop = mock(NativeBlockState.class);
when(fixture.decorant.key()).thenReturn("minecraft:grass");
when(fixture.decorant.canPlaceOnto(support)).thenReturn(true);
when(waterloggedTop.isWaterLogged()).thenReturn(true);
@@ -201,14 +201,14 @@ public class IrisShoreLineDecoratorTest {
when(fixture.decorator.getStackMax()).thenReturn(2);
when(fixture.decorator.getHeight(any(), anyDouble(), anyDouble(), eq(fixture.data))).thenReturn(2);
when(fixture.decorator.getTopThreshold()).thenReturn(1D);
when(fixture.decorator.getBlockDataArray(fixture.data)).thenReturn(new PlatformBlockState[0]);
when(fixture.decorator.getBlockDataArray(fixture.data)).thenReturn(new NativeBlockState[0]);
when(fixture.decorator.getBlockDataTopsArray(fixture.data))
.thenReturn(new PlatformBlockState[]{waterloggedTop});
.thenReturn(new NativeBlockState[]{waterloggedTop});
when(fixture.decorator.getBlockDataForTop(
eq(fixture.biome), any(), anyDouble(), anyDouble(), anyDouble(), eq(fixture.data)))
.thenReturn(waterloggedTop);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, FLUID_HEIGHT + 3, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, FLUID_HEIGHT + 3, 1);
output.set(0, FLUID_HEIGHT, 0, support);
output.set(0, FLUID_HEIGHT + 1, 0, lowerOriginal);
output.set(0, FLUID_HEIGHT + 2, 0, upperOriginal);
@@ -243,7 +243,7 @@ public class IrisShoreLineDecoratorTest {
IrisBiome biome = mock(IrisBiome.class);
IrisDecorator decorator = mock(IrisDecorator.class);
IrisSlopeClip slope = mock(IrisSlopeClip.class);
PlatformBlockState decorant = mock(PlatformBlockState.class);
NativeBlockState decorant = mock(NativeBlockState.class);
ProceduralStream<Double> heightStream = mock(ProceduralStream.class);
EngineMantle mantle = mock(EngineMantle.class);
@@ -273,21 +273,21 @@ public class IrisShoreLineDecoratorTest {
return new Fixture(new IrisShoreLineDecorator(engine), data, biome, decorator, decorant);
}
private Hunk<PlatformBlockState> output(PlatformBlockState support, PlatformBlockState target) {
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, FLUID_HEIGHT + 3, 1);
private Hunk<NativeBlockState> output(NativeBlockState support, NativeBlockState target) {
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, FLUID_HEIGHT + 3, 1);
output.set(0, FLUID_HEIGHT, 0, support);
output.set(0, FLUID_HEIGHT + 1, 0, target);
return output;
}
private PlatformBlockState airState() {
PlatformBlockState air = mock(PlatformBlockState.class);
private NativeBlockState airState() {
NativeBlockState air = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
return air;
}
private PlatformBlockState sturdyState() {
PlatformBlockState support = mock(PlatformBlockState.class);
private NativeBlockState sturdyState() {
NativeBlockState support = mock(NativeBlockState.class);
BlockData blockData = mock(BlockData.class);
when(support.isSolid()).thenReturn(true);
when(support.nativeHandle()).thenReturn(blockData);
@@ -300,7 +300,7 @@ public class IrisShoreLineDecoratorTest {
IrisData data,
IrisBiome biome,
IrisDecorator decorator,
PlatformBlockState decorant
NativeBlockState decorant
) {
}
}
@@ -7,7 +7,7 @@ import art.arcane.iris.generation.hydrology.HydrologyColumnSample;
import art.arcane.iris.generation.hydrology.HydrologyFeatureRef;
import art.arcane.iris.generation.hydrology.HydrologyFeatureType;
import art.arcane.iris.generation.mantle.EngineMantle;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import art.arcane.volmlib.util.math.RNG;
import org.junit.Test;
@@ -80,8 +80,8 @@ public class IrisSugarCanePlacementTest {
assertSame(fixture.cane, fixture.output.get(1, 4, 1));
}
private static PlatformBlockState state(String key) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState state(String key) {
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(key);
return state;
}
@@ -94,15 +94,15 @@ public class IrisSugarCanePlacementTest {
}
private static final class Fixture {
private final PlatformBlockState air = state("minecraft:air");
private final PlatformBlockState stone = state("minecraft:stone");
private final PlatformBlockState soil = state("minecraft:dirt");
private final PlatformBlockState water = state("minecraft:water");
private final PlatformBlockState cane = state("minecraft:sugar_cane[age=0]");
private final NativeBlockState air = state("minecraft:air");
private final NativeBlockState stone = state("minecraft:stone");
private final NativeBlockState soil = state("minecraft:dirt");
private final NativeBlockState water = state("minecraft:water");
private final NativeBlockState cane = state("minecraft:sugar_cane[age=0]");
private final IrisDecorator decorator = mock(IrisDecorator.class);
private final Engine engine = mock(Engine.class);
private final EngineMantle mantle = mock(EngineMantle.class);
private final Hunk<PlatformBlockState> output;
private final Hunk<NativeBlockState> output;
private final int local;
private Fixture(int size) {
@@ -8,7 +8,7 @@ import art.arcane.iris.generation.hydrology.HydrologyColumnSample;
import art.arcane.iris.generation.hydrology.HydrologyFeatureRef;
import art.arcane.iris.generation.hydrology.HydrologyFeatureType;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import art.arcane.volmlib.util.stream.ProceduralStream;
import art.arcane.volmlib.util.stream.interpolation.Interpolated;
@@ -53,7 +53,7 @@ public class IrisSugarCaneTest {
}
fixture.output.set(0, 3, 1, state("minecraft:frosted_ice[age=0]"));
assertTrue(fixture.place(1, 1));
PlatformBlockState waterlogged = state("minecraft:oak_stairs[waterlogged=true]");
NativeBlockState waterlogged = state("minecraft:oak_stairs[waterlogged=true]");
when(waterlogged.isWaterLogged()).thenReturn(true);
fixture.output.set(0, 3, 1, waterlogged);
assertTrue(fixture.place(1, 1));
@@ -83,7 +83,7 @@ public class IrisSugarCaneTest {
when(fixture.complex.resolveHydrologyFluid("water", -17, -16)).thenReturn(fixture.water);
assertTrue(fixture.place(0, 0));
PlatformBlockState lava = state("minecraft:lava");
NativeBlockState lava = state("minecraft:lava");
when(fixture.complex.resolveHydrologyFluid("water", -17, -16)).thenReturn(lava);
assertFalse(fixture.place(0, 0));
when(fixture.complex.sampleHydrologyColumn(-17, -16)).thenReturn(new HydrologyColumnSample(
@@ -104,8 +104,8 @@ public class IrisSugarCaneTest {
public void forcedSurfaceDecorationStillRejectsCaneOnStone() {
Fixture fixture = new Fixture(3);
IrisDecorator decorator = mock(IrisDecorator.class);
PlatformBlockState stone = state("minecraft:stone");
PlatformBlockState air = state("minecraft:air");
NativeBlockState stone = state("minecraft:stone");
NativeBlockState air = state("minecraft:air");
when(air.isAir()).thenReturn(true);
when(decorator.isForcePlace()).thenReturn(true);
when(decorator.pickBlockData(any(), any(), anyDouble(), anyDouble())).thenReturn(fixture.cane);
@@ -130,7 +130,7 @@ public class IrisSugarCaneTest {
when(fixture.complex.getTrueBiomeStream()).thenReturn(
ProceduralStream.of((x, z) -> biome, Interpolated.of(value -> 0D, value -> biome)));
when(fixture.engine.getSeedManager()).thenReturn(mock(SeedManager.class));
PlatformBlockState ice = state("minecraft:ice");
NativeBlockState ice = state("minecraft:ice");
when(biome.generateSeaLayers(anyDouble(), anyDouble(), any(), anyInt(), any()))
.thenReturn(new KList<>(List.of(ice)));
assertFalse(fixture.place(0, 0));
@@ -147,8 +147,8 @@ public class IrisSugarCaneTest {
"water", "river", "mouth", "shore", "bank", "cave");
}
private static PlatformBlockState state(String key) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState state(String key) {
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(key);
return state;
}
@@ -156,10 +156,10 @@ public class IrisSugarCaneTest {
private static final class Fixture {
private final Engine engine = mock(Engine.class);
private final IrisComplex complex = mock(IrisComplex.class);
private final PlatformBlockState cane = state("minecraft:sugar_cane[age=0]");
private final PlatformBlockState soil = state("minecraft:dirt");
private final PlatformBlockState water = state("minecraft:water");
private final Hunk<PlatformBlockState> output;
private final NativeBlockState cane = state("minecraft:sugar_cane[age=0]");
private final NativeBlockState soil = state("minecraft:dirt");
private final NativeBlockState water = state("minecraft:water");
private final Hunk<NativeBlockState> output;
private Fixture(int size) {
output = Hunk.newArrayHunk(size, 6, size);
@@ -3,7 +3,7 @@ package art.arcane.iris.generation.decoration.coral;
import art.arcane.iris.generation.block.IrisBlockData;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.structure.object.IrisObject;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.generation.geometry.IrisBlockVector;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
@@ -22,8 +22,8 @@ import static org.mockito.Mockito.when;
public class CoralGeneratorTest {
@Test
public void fanTipsFollowTheTopOfEachOccupiedColumn() {
PlatformBlockState structure = mock(PlatformBlockState.class);
PlatformBlockState tip = mock(PlatformBlockState.class);
NativeBlockState structure = mock(NativeBlockState.class);
NativeBlockState tip = mock(NativeBlockState.class);
for (int height : new int[]{2, 7, 14}) {
for (int width : new int[]{1, 3, 11}) {
IrisCoral coral = new IrisCoral().setForm(IrisCoralForm.FAN)
@@ -61,7 +61,7 @@ public class CoralGeneratorTest {
}
}
private static IrisMaterialPalette palette(PlatformBlockState state) {
private static IrisMaterialPalette palette(NativeBlockState state) {
IrisBlockData block = mock(IrisBlockData.class);
when(block.getWeight()).thenReturn(1);
when(block.getBlockData(null)).thenReturn(state);
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.decoration.formation;
import art.arcane.iris.generation.block.IrisBlockData;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.math.Vector3i;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
@@ -50,7 +50,7 @@ public class FormationBlockResolverTest {
? Math.floorDiv(position.getBlockY(), formation.getStrataThickness()) : position.getBlockY();
long sampleSeed = formation.getSeed() + (expectedPalette == strata ? sampleY * 31L : 0L);
RNG fresh = new RNG(sampleSeed);
PlatformBlockState expected = expectedPalette.get(fresh,
NativeBlockState expected = expectedPalette.get(fresh,
position.getBlockX(), sampleY, position.getBlockZ(), null);
assertSame(expected, resolver.resolve(role, position));
assertEquals(new RNG(sampleSeed).nextLong(), fresh.nextLong());
@@ -68,7 +68,7 @@ public class FormationBlockResolverTest {
}
private static IrisBlockData block(String material) {
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn("minecraft:" + material);
IrisBlockData block = mock(IrisBlockData.class);
when(block.getWeight()).thenReturn(1);
@@ -1,6 +1,6 @@
package art.arcane.iris.generation.decoration.tree;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import org.junit.Test;
import java.util.HashSet;
@@ -273,13 +273,13 @@ public class ProceduralTreeGeneratorTest {
IrisProceduralTree tree = new IrisProceduralTree();
tree.setPlausible(false);
TreeBlockCanvas.Vec position = new TreeBlockCanvas.Vec(40, 20, -10);
PlatformBlockState leaf = mock(PlatformBlockState.class);
PlatformBlockState persistent = mock(PlatformBlockState.class);
PlatformBlockState supported = mock(PlatformBlockState.class);
NativeBlockState leaf = mock(NativeBlockState.class);
NativeBlockState persistent = mock(NativeBlockState.class);
NativeBlockState supported = mock(NativeBlockState.class);
when(leaf.key()).thenReturn("minecraft:oak_leaves[persistent=false,distance=7]");
when(leaf.withProperty("persistent", "true")).thenReturn(persistent);
when(persistent.withProperty("distance", "1")).thenReturn(supported);
Map<TreeBlockCanvas.Vec, PlatformBlockState> resolved = new HashMap<>();
Map<TreeBlockCanvas.Vec, NativeBlockState> resolved = new HashMap<>();
resolved.put(position, leaf);
TreePlausibility.apply(resolved, Set.of(new TreeBlockCanvas.Vec(0, 0, 0)), Set.of(position), tree);
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.decoration.tree;
import art.arcane.iris.generation.block.IrisBlockData;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.generation.block.B;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
@@ -26,10 +26,10 @@ public class TreeBlockResolverTest {
IrisProceduralTree tree = new IrisProceduralTree();
tree.setSeed(91874L);
tree.setLeavesPalette(palette("oak_leaves", "birch_leaves"));
PlatformBlockState blossom = mock(PlatformBlockState.class);
PlatformBlockState light = mock(PlatformBlockState.class);
List<PlatformBlockState> normal = new ArrayList<>();
List<PlatformBlockState> large = new ArrayList<>();
NativeBlockState blossom = mock(NativeBlockState.class);
NativeBlockState light = mock(NativeBlockState.class);
List<NativeBlockState> normal = new ArrayList<>();
List<NativeBlockState> large = new ArrayList<>();
TreeBlockCanvas.Cell cell = new TreeBlockCanvas.Cell(
TreeBlockCanvas.Role.SECONDARY_LEAF, TreeBlockCanvas.Axis.NONE, false, -1, null);
try (MockedStatic<B> blocks = mockStatic(B.class)) {
@@ -39,7 +39,7 @@ public class TreeBlockResolverTest {
tree.setWeightedSecondaryLeaves(new KList<>(
new IrisTreeSecondaryLeaf("minecraft:cherry_leaves", weight),
new IrisTreeSecondaryLeaf("minecraft:shroomlight", weight)));
List<PlatformBlockState> resolved = weight == 1 ? normal : large;
List<NativeBlockState> resolved = weight == 1 ? normal : large;
for (int x = -16; x <= 16; x++) {
for (int y = 0; y < 16; y++) {
resolved.add(TreeBlockResolver.resolve(tree, null, cell,
@@ -74,8 +74,8 @@ public class TreeBlockResolverTest {
TreeBlockCanvas.Vec position = new TreeBlockCanvas.Vec(x, y, x - y);
TreeBlockCanvas.Cell cell = new TreeBlockCanvas.Cell(
roles[Math.floorMod(x + y, roles.length)], TreeBlockCanvas.Axis.NONE, false, -1, null);
PlatformBlockState expected = TreeBlockResolver.resolve(tree, null, cell, position, new RNG(tree.getSeed()));
PlatformBlockState actual = TreeBlockResolver.resolve(tree, null, cell, position, shared);
NativeBlockState expected = TreeBlockResolver.resolve(tree, null, cell, position, new RNG(tree.getSeed()));
NativeBlockState actual = TreeBlockResolver.resolve(tree, null, cell, position, shared);
freshBlocks.add(position + ":" + expected.key());
sharedBlocks.add(position + ":" + actual.key());
materials.add(actual.key());
@@ -94,7 +94,7 @@ public class TreeBlockResolverTest {
}
private static IrisBlockData block(String material) {
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn("minecraft:" + material);
IrisBlockData block = mock(IrisBlockData.class);
when(block.getWeight()).thenReturn(1);
@@ -24,7 +24,7 @@ import art.arcane.iris.structure.object.IObjectPlacer;
import art.arcane.iris.generation.block.TileData;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveAction;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -42,7 +42,7 @@ public class CaveObjectPlacementTransactionTest {
@Test
public void validPlacementCommitsBlocksTilesAndMetadataTogether() {
IObjectPlacer delegate = createPlacer(128, 80, 20, 60);
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
TileData tile = mock(TileData.class);
CaveObjectPlacementTransaction transaction = new CaveObjectPlacementTransaction(delegate, 20, 10);
@@ -74,7 +74,7 @@ public class CaveObjectPlacementTransactionTest {
when(delegate.isCarved(anyInt(), anyInt(), anyInt())).thenReturn(true);
CaveObjectPlacementTransaction transaction = new CaveObjectPlacementTransaction(delegate, 20, 10);
transaction.set(4, 30, 7, mock(PlatformBlockState.class));
transaction.set(4, 30, 7, mock(NativeBlockState.class));
transaction.setData(5, 26, 7, "ghost");
assertEquals(CaveObjectPlacementTransaction.CommitResult.REJECTED_BOUNDS, transaction.commit());
@@ -93,7 +93,7 @@ public class CaveObjectPlacementTransactionTest {
when(delegate.isCarved(eq(5), anyInt(), eq(7))).thenAnswer(invocation -> invocation.<Integer>getArgument(1) <= 24);
CaveObjectPlacementTransaction transaction = new CaveObjectPlacementTransaction(delegate, 20, 10);
transaction.set(4, 30, 7, mock(PlatformBlockState.class));
transaction.set(4, 30, 7, mock(NativeBlockState.class));
transaction.setData(5, 25, 7, "outside-cave");
assertEquals(CaveObjectPlacementTransaction.CommitResult.REJECTED_BOUNDS, transaction.commit());
@@ -105,7 +105,7 @@ public class CaveObjectPlacementTransactionTest {
public void exactBurialBoundaryIsAllowedAndShallowerAnchorsAreExcluded() {
IObjectPlacer delegate = createPlacer(128, 80, 20, 90);
CaveObjectPlacementTransaction transaction = new CaveObjectPlacementTransaction(delegate, 20, 10);
transaction.set(4, 70, 7, mock(PlatformBlockState.class));
transaction.set(4, 70, 7, mock(NativeBlockState.class));
assertEquals(CaveObjectPlacementTransaction.CommitResult.COMMITTED, transaction.commit());
assertEquals(71, MantleObjectComponent.caveAnchorScanUpperBound(128, 80, 10));
@@ -119,7 +119,7 @@ public class CaveObjectPlacementTransactionTest {
.thenReturn(HydrologyCaveCell.of(HydrologyCaveAction.DRY_AIR));
CaveObjectPlacementTransaction transaction = new CaveObjectPlacementTransaction(delegate, 20, 10);
transaction.set(4, 30, 7, mock(PlatformBlockState.class));
transaction.set(4, 30, 7, mock(NativeBlockState.class));
transaction.setData(5, 30, 7, "object@1");
assertEquals(CaveObjectPlacementTransaction.CommitResult.REJECTED_HYDROLOGY, transaction.commit());
@@ -138,7 +138,7 @@ public class CaveObjectPlacementTransactionTest {
when(delegate.getEngine()).thenReturn(engine);
CaveObjectPlacementTransaction transaction = new CaveObjectPlacementTransaction(delegate, 20, 10);
transaction.set(4, 30, 7, mock(PlatformBlockState.class));
transaction.set(4, 30, 7, mock(NativeBlockState.class));
transaction.setData(4, 30, 7, "object@1");
assertEquals(CaveObjectPlacementTransaction.CommitResult.REJECTED_TRANSITION, transaction.commit());
@@ -3,7 +3,7 @@ package art.arcane.iris.generation.mantle;
import art.arcane.iris.integration.Identifier;
import art.arcane.iris.generation.decoration.tree.TreeBlockMaterial;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.testsupport.PlatformBinding;
import art.arcane.iris.world.storage.matter.PreObjectMatterCell;
import art.arcane.iris.world.storage.matter.TileWrapper;
@@ -52,7 +52,7 @@ public class EngineMantleCleanupTest {
fixture.engineMantle().cleanupChunk(7, -4);
verify(fixture.chunk(), never()).deleteSlices(MatterCavern.class);
verify(fixture.chunk()).deleteSlices(PlatformBlockState.class);
verify(fixture.chunk()).deleteSlices(NativeBlockState.class);
}
@Test
@@ -66,7 +66,7 @@ public class EngineMantleCleanupTest {
verify(fixture.chunk(), never()).deleteSlices(TreeBlockMaterial.class);
verify(fixture.chunk(), never()).deleteSlices(String.class);
verify(fixture.chunk()).deleteSlices(MatterCavern.class);
verify(fixture.chunk()).deleteSlices(PlatformBlockState.class);
verify(fixture.chunk()).deleteSlices(NativeBlockState.class);
}
@Test
@@ -85,12 +85,12 @@ public class EngineMantleCleanupTest {
@Test
public void blockStateSliceIsNeverRetainable() {
MantleSliceRetention.retain(PlatformBlockState.class.getCanonicalName());
MantleSliceRetention.retain(NativeBlockState.class.getCanonicalName());
CleanupFixture fixture = cleanupFixture();
fixture.engineMantle().forceCleanupChunk(7, -4);
verify(fixture.chunk()).deleteSlices(PlatformBlockState.class);
verify(fixture.chunk()).deleteSlices(NativeBlockState.class);
}
@Test
@@ -180,7 +180,7 @@ public class EngineMantleCleanupTest {
}
private void verifyCleanup(MantleChunk<Matter> chunk) {
verify(chunk).deleteSlices(PlatformBlockState.class);
verify(chunk).deleteSlices(NativeBlockState.class);
verify(chunk).deleteSlices(MatterCavern.class);
verify(chunk).deleteSlices(PreObjectMatterCell.class);
verify(chunk, never()).deleteSlices(TileWrapper.class);
@@ -3,7 +3,7 @@ package art.arcane.iris.generation.mantle;
import art.arcane.iris.generation.runtime.IrisEngineMantle;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.volmlib.util.mantle.flag.MantleFlag;
@@ -42,12 +42,12 @@ public class EngineMantleCoverageTest {
@Before
public void bindPlatform() {
IrisPlatforms.unbind();
Map<String, PlatformBlockState> states = new HashMap<>();
Map<String, NativeBlockState> states = new HashMap<>();
PlatformRegistries registries = mock(PlatformRegistries.class);
when(registries.block(anyString())).thenAnswer(invocation -> states.computeIfAbsent(
invocation.getArgument(0),
key -> {
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(key);
return state;
}));
@@ -20,7 +20,7 @@ package art.arcane.iris.generation.mantle;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.block.TileData;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -38,8 +38,8 @@ public class FloatingObjectPlacementTransactionTest {
public void unsupportedFinalTerrainRejectsBlocksTilesAndMarkersTogether() {
IslandObjectPlacer delegate = createPlacer(false);
FloatingObjectPlacementTransaction transaction = new FloatingObjectPlacementTransaction(delegate);
PlatformBlockState first = mock(PlatformBlockState.class);
PlatformBlockState second = mock(PlatformBlockState.class);
NativeBlockState first = mock(NativeBlockState.class);
NativeBlockState second = mock(NativeBlockState.class);
TileData tile = mock(TileData.class);
transaction.set(15, 101, 8, first);
@@ -64,8 +64,8 @@ public class FloatingObjectPlacementTransactionTest {
public void supportedNeighborChunkCommitsBlocksTilesAndMarkers() {
IslandObjectPlacer delegate = createPlacer(true);
FloatingObjectPlacementTransaction transaction = new FloatingObjectPlacementTransaction(delegate);
PlatformBlockState first = mock(PlatformBlockState.class);
PlatformBlockState second = mock(PlatformBlockState.class);
NativeBlockState first = mock(NativeBlockState.class);
NativeBlockState second = mock(NativeBlockState.class);
TileData tile = mock(TileData.class);
transaction.set(15, 101, 8, first);
@@ -5,7 +5,7 @@ import art.arcane.iris.structure.placement.PlacedStructurePiece;
import art.arcane.iris.structure.placement.IrisStructure;
import art.arcane.iris.structure.placement.IrisStructurePlacement;
import art.arcane.iris.structure.nativegen.NativeStructureSuppression;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import org.junit.Test;
@@ -21,8 +21,8 @@ import static org.mockito.Mockito.when;
public class IrisStructureComponentMarkerTest {
@Test
public void markerFilterAcceptsOnlyStorageContainers() {
PlatformBlockState storage = mock(PlatformBlockState.class);
PlatformBlockState solid = mock(PlatformBlockState.class);
NativeBlockState storage = mock(NativeBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
when(storage.isStorageChest()).thenReturn(true);
when(solid.isStorageChest()).thenReturn(false);
@@ -43,8 +43,8 @@ public class IrisStructureComponentMarkerTest {
@Test
public void treeCollisionUsesOnlyNonAirStructureBlocks() {
PlatformBlockState solid = mock(PlatformBlockState.class);
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
when(solid.isAir()).thenReturn(false);
when(air.isAir()).thenReturn(true);
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.mantle;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.matter.MatterCavern;
import art.arcane.volmlib.util.math.RNG;
import org.junit.Test;
@@ -21,7 +21,7 @@ public class IrisStructureFoundationWriteTest {
IrisMaterialPalette palette = mock(IrisMaterialPalette.class);
RNG rng = new RNG(1337L);
IrisData data = mock(IrisData.class);
PlatformBlockState deepslateBricks = mock(PlatformBlockState.class);
NativeBlockState deepslateBricks = mock(NativeBlockState.class);
when(palette.get(rng, 12, -247, -18, data)).thenReturn(deepslateBricks);
IrisStructureComponent.writeFoundationSupport(
@@ -8,7 +8,7 @@ import art.arcane.iris.generation.cave.IrisCaveProfile;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.world.IrisWorld;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.generation.context.ChunkContext;
import art.arcane.volmlib.util.stream.ProceduralStream;
import art.arcane.volmlib.util.mantle.runtime.Mantle;
@@ -62,7 +62,7 @@ public class MantleCarvingComponentScratchTest {
when(complex.getNaturalHeightStream()).thenReturn(heights);
ProceduralStream<IrisRegion> regions = mock(ProceduralStream.class);
ProceduralStream<IrisBiome> biomes = mock(ProceduralStream.class);
ProceduralStream<PlatformBlockState> fluids = mock(ProceduralStream.class);
ProceduralStream<NativeBlockState> fluids = mock(ProceduralStream.class);
when(regions.get(anyDouble(), anyDouble())).thenReturn(new IrisRegion());
when(biomes.get(anyDouble(), anyDouble())).thenReturn(new IrisBiome());
when(complex.getRegionStream()).thenReturn(regions);
@@ -8,7 +8,7 @@ import art.arcane.iris.generation.hydrology.HydrologyColumnSample;
import art.arcane.iris.generation.hydrology.RiverFootprint;
import art.arcane.iris.generation.hydrology.cave.CavePosition;
import art.arcane.iris.generation.hydrology.cave.CaveVoxel;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.stream.ProceduralStream;
import art.arcane.volmlib.util.mantle.flag.ReservedFlag;
import art.arcane.volmlib.util.mantle.runtime.Mantle;
@@ -58,15 +58,15 @@ public class MantleHydrologyCaveVoxelViewTest {
MatterCavern air = new MatterCavern(true, "", (byte) 0);
MatterCavern water = new MatterCavern(true, "", (byte) 1);
MatterCavern lava = new MatterCavern(true, "", (byte) 2);
PlatformBlockState incompatibleFluid = mock(PlatformBlockState.class);
PlatformBlockState lavaBlock = mock(PlatformBlockState.class);
PlatformBlockState solid = mock(PlatformBlockState.class);
NativeBlockState incompatibleFluid = mock(NativeBlockState.class);
NativeBlockState lavaBlock = mock(NativeBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
doReturn(air).when(mantle).get(0, 20, 0, MatterCavern.class);
doReturn(water).when(mantle).get(1, 20, 0, MatterCavern.class);
doReturn(lava).when(mantle).get(2, 20, 0, MatterCavern.class);
doReturn(incompatibleFluid).when(mantle).get(3, 20, 0, PlatformBlockState.class);
doReturn(lavaBlock).when(mantle).get(4, 20, 0, PlatformBlockState.class);
doReturn(solid).when(mantle).get(5, 20, 0, PlatformBlockState.class);
doReturn(incompatibleFluid).when(mantle).get(3, 20, 0, NativeBlockState.class);
doReturn(lavaBlock).when(mantle).get(4, 20, 0, NativeBlockState.class);
doReturn(solid).when(mantle).get(5, 20, 0, NativeBlockState.class);
when(incompatibleFluid.isFluid()).thenReturn(true);
when(incompatibleFluid.materialKey()).thenReturn("minecraft:water");
when(lavaBlock.isFluid()).thenReturn(true);
@@ -35,7 +35,7 @@ import art.arcane.iris.generation.hydrology.cave.HydrologyCaveRejection;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveSource;
import art.arcane.iris.generation.hydrology.IrisDeepFluidConfig;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.generation.context.ChunkContext;
import art.arcane.volmlib.util.mantle.flag.ReservedFlag;
import art.arcane.volmlib.util.matter.slices.UpdateMatter;
@@ -71,8 +71,8 @@ public class MantleHydrologyComponentTest {
@Test
public void fallingPublicationWritesLevelEightFluidAndUpdateMarker() {
CavePosition position = new CavePosition(4, 20, 6);
PlatformBlockState source = mock(PlatformBlockState.class);
PlatformBlockState falling = mock(PlatformBlockState.class);
NativeBlockState source = mock(NativeBlockState.class);
NativeBlockState falling = mock(NativeBlockState.class);
when(source.key()).thenReturn("minecraft:water[level=0]");
when(source.withProperty("level", "8")).thenReturn(falling);
IrisComplex complex = mock(IrisComplex.class);
@@ -21,7 +21,7 @@ import art.arcane.iris.generation.noise.NoiseStyle;
import art.arcane.iris.structure.object.ObjectPlaceMode;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.generation.geometry.IrisBlockVector;
@@ -68,7 +68,7 @@ public class MantleObjectComponentBoundaryRadiusTest {
PlatformRegistries registries = mock(PlatformRegistries.class);
when(registries.block(anyString())).thenAnswer(invocation -> {
String key = invocation.getArgument(0);
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBlockState block = mock(NativeBlockState.class);
when(block.key()).thenReturn(key);
when(block.materialKey()).thenReturn(key);
when(block.isSolid()).thenReturn(!key.toLowerCase().contains("air"));
@@ -7,7 +7,7 @@ import art.arcane.iris.world.history.TransitionGenerationPlan;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveAction;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.testsupport.PlatformBinding;
import art.arcane.volmlib.util.mantle.runtime.Mantle;
import art.arcane.volmlib.util.mantle.runtime.MantleChunk;
@@ -40,7 +40,7 @@ public class MantleWriterOverlayTest {
private MantleWriter writer;
private Matter matter;
private MantleChunk<Matter> chunk;
private MatterSlice<PlatformBlockState> blockSlice;
private MatterSlice<NativeBlockState> blockSlice;
private MatterSlice<Identifier> identifierSlice;
private MatterSlice<MatterCavern> cavernSlice;
private MatterSlice<HydrologyCaveCell> hydrologySlice;
@@ -71,13 +71,13 @@ public class MantleWriterOverlayTest {
when(chunk.getOrCreate(0)).thenReturn(matter);
when(chunk.exists(0)).thenReturn(true);
when(chunk.get(0)).thenReturn(matter);
when(matter.hasSlice(PlatformBlockState.class)).thenReturn(true);
when(matter.hasSlice(NativeBlockState.class)).thenReturn(true);
when(matter.hasSlice(Identifier.class)).thenReturn(true);
when(matter.hasSlice(MatterCavern.class)).thenReturn(true);
when(matter.getSlice(PlatformBlockState.class)).thenReturn(blockSlice);
when(matter.getSlice(NativeBlockState.class)).thenReturn(blockSlice);
when(matter.getSlice(Identifier.class)).thenReturn(identifierSlice);
when(matter.getSlice(MatterCavern.class)).thenReturn(cavernSlice);
doReturn(blockSlice).when(matter).slice(PlatformBlockState.class);
doReturn(blockSlice).when(matter).slice(NativeBlockState.class);
doReturn(identifierSlice).when(matter).slice(Identifier.class);
doReturn(cavernSlice).when(matter).slice(MatterCavern.class);
doReturn(hydrologySlice).when(matter).getSlice(HydrologyCaveCell.class);
@@ -111,7 +111,7 @@ public class MantleWriterOverlayTest {
@Test
public void normalBlockReplacementClearsDeferredPlacement() {
PlatformBlockState replacement = mock(PlatformBlockState.class);
NativeBlockState replacement = mock(NativeBlockState.class);
writer.setData(X, Y, Z, replacement);
@@ -121,8 +121,8 @@ public class MantleWriterOverlayTest {
@Test
public void customBlockWritesBaseAndIdentifierTogether() {
PlatformBlockState base = mock(PlatformBlockState.class);
PlatformBlockState custom = customState(base);
NativeBlockState base = mock(NativeBlockState.class);
NativeBlockState custom = customState(base);
Identifier identifier = Identifier.fromString("iris:custom_block");
writer.set(X, Y, Z, custom);
@@ -133,8 +133,8 @@ public class MantleWriterOverlayTest {
@Test
public void protectedHydrologyRejectsBothPartsOfCustomBlock() {
PlatformBlockState base = mock(PlatformBlockState.class);
PlatformBlockState custom = customState(base);
NativeBlockState base = mock(NativeBlockState.class);
NativeBlockState custom = customState(base);
when(matter.hasSlice(HydrologyCaveCell.class)).thenReturn(true);
when(hydrologySlice.get(X, Y, Z))
.thenReturn(HydrologyCaveCell.of(HydrologyCaveAction.SEAL_GUARD));
@@ -147,20 +147,20 @@ public class MantleWriterOverlayTest {
@Test
public void bedrockAndWorldBoundsRejectBothPartsOfCustomBlock() {
PlatformBlockState base = mock(PlatformBlockState.class);
PlatformBlockState custom = customState(base);
NativeBlockState base = mock(NativeBlockState.class);
NativeBlockState custom = customState(base);
when(dimension.isBedrock()).thenReturn(true);
writer.set(X, 0, Z, custom);
writer.set(X, 64, Z, custom);
verify(blockSlice, never()).set(anyInt(), anyInt(), anyInt(), any(PlatformBlockState.class));
verify(blockSlice, never()).set(anyInt(), anyInt(), anyInt(), any(NativeBlockState.class));
verify(identifierSlice, never()).set(anyInt(), anyInt(), anyInt(), any(Identifier.class));
}
@Test
public void protectedHydrologyRejectsLaterBlockAndCavernWrites() {
PlatformBlockState replacement = mock(PlatformBlockState.class);
NativeBlockState replacement = mock(NativeBlockState.class);
MatterCavern cavern = new MatterCavern(true, "", (byte) 3);
when(matter.hasSlice(HydrologyCaveCell.class)).thenReturn(true);
when(hydrologySlice.get(X, Y, Z))
@@ -185,7 +185,7 @@ public class MantleWriterOverlayTest {
when(complex.getTransitionGenerationPlan()).thenReturn(transition);
when(transition.isHistoricalBlock(X, Z)).thenReturn(true);
writer = new MantleWriter(engineMantle, mantle, 0, 0, 0, false);
PlatformBlockState replacement = mock(PlatformBlockState.class);
NativeBlockState replacement = mock(NativeBlockState.class);
MatterCavern cavern = new MatterCavern(true, "", (byte) 3);
writer.setData(X, Y, Z, replacement);
@@ -193,7 +193,7 @@ public class MantleWriterOverlayTest {
assertFalse(writer.carveDataIfAbsent(X, Y, Z, cavern));
writer.setForcedCarve(X, Y, Z, cavern);
writer.clearBlock(X, Y, Z);
writer.clearData(X, Y, Z, PlatformBlockState.class);
writer.clearData(X, Y, Z, NativeBlockState.class);
verify(blockSlice, never()).set(anyInt(), anyInt(), anyInt(), any());
verify(cavernSlice, never()).set(anyInt(), anyInt(), anyInt(), any());
@@ -218,8 +218,8 @@ public class MantleWriterOverlayTest {
assertEquals(0, baseline.getLiquid());
}
private static PlatformBlockState customState(PlatformBlockState base) {
PlatformBlockState custom = mock(PlatformBlockState.class);
private static NativeBlockState customState(NativeBlockState base) {
NativeBlockState custom = mock(NativeBlockState.class);
when(custom.isCustom()).thenReturn(true);
when(custom.deferredPlacementKey()).thenReturn("iris:custom_block");
when(custom.placementBaseState()).thenReturn(base);
@@ -5,7 +5,7 @@ import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.generation.runtime.IrisComplex;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.BukkitTestServer;
import art.arcane.iris.testsupport.PlatformLeakGuard;
@@ -59,7 +59,7 @@ public class MantleWriterPreObjectJournalTest {
@SuppressWarnings("unchecked")
public void setUp() {
IrisPlatforms.unbind();
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
PlatformRegistries registries = mock(PlatformRegistries.class);
IrisPlatform platform = mock(IrisPlatform.class);
when(registries.air()).thenReturn(air);
@@ -92,12 +92,12 @@ public class MantleWriterPreObjectJournalTest {
@Test
public void firstMutationCapturesEachSupportedOriginalIndependently() {
PlatformBlockState originalBlock = mock(PlatformBlockState.class);
PlatformBlockState firstBlock = mock(PlatformBlockState.class);
PlatformBlockState secondBlock = mock(PlatformBlockState.class);
NativeBlockState originalBlock = mock(NativeBlockState.class);
NativeBlockState firstBlock = mock(NativeBlockState.class);
NativeBlockState secondBlock = mock(NativeBlockState.class);
MatterCavern originalCavern = new MatterCavern(true, "old", (byte) 1);
MatterCavern replacementCavern = new MatterCavern(true, "new", (byte) 2);
matter.<PlatformBlockState>slice(PlatformBlockState.class).set(X, Y, Z, originalBlock);
matter.<NativeBlockState>slice(NativeBlockState.class).set(X, Y, Z, originalBlock);
matter.<MatterCavern>slice(MatterCavern.class).set(X, Y, Z, originalCavern);
writer.withComponentPriority(2, () -> {
@@ -108,10 +108,10 @@ public class MantleWriterPreObjectJournalTest {
writer.setData(X, Y, Z, "newer-marker");
});
assertSame(originalBlock, writer.getPrerequisiteDataIfPresent(X, Y, Z, PlatformBlockState.class));
assertSame(originalBlock, writer.getPrerequisiteDataIfPresent(X, Y, Z, NativeBlockState.class));
assertNull(writer.getPrerequisiteDataIfPresent(X, Y, Z, String.class));
assertEquals(originalCavern, writer.getPrerequisiteDataIfPresent(X, Y, Z, MatterCavern.class));
assertSame(secondBlock, writer.getDataIfPresent(X, Y, Z, PlatformBlockState.class));
assertSame(secondBlock, writer.getDataIfPresent(X, Y, Z, NativeBlockState.class));
assertEquals("newer-marker", writer.getDataIfPresent(X, Y, Z, String.class));
assertEquals(replacementCavern, writer.getDataIfPresent(X, Y, Z, MatterCavern.class));
@@ -186,11 +186,11 @@ public class MantleWriterPreObjectJournalTest {
@Test
public void restorationWritesCapturedValuesAndNullsWithoutRecapture() {
PlatformBlockState originalBlock = mock(PlatformBlockState.class);
PlatformBlockState replacementBlock = mock(PlatformBlockState.class);
NativeBlockState originalBlock = mock(NativeBlockState.class);
NativeBlockState replacementBlock = mock(NativeBlockState.class);
MatterCavern originalCavern = new MatterCavern(true, "old", (byte) 1);
MatterCavern replacementCavern = new MatterCavern(true, "new", (byte) 2);
matter.<PlatformBlockState>slice(PlatformBlockState.class).set(X, Y, Z, originalBlock);
matter.<NativeBlockState>slice(NativeBlockState.class).set(X, Y, Z, originalBlock);
matter.<MatterCavern>slice(MatterCavern.class).set(X, Y, Z, originalCavern);
writer.withComponentPriority(2, () -> {
writer.setData(X, Y, Z, replacementBlock);
@@ -201,7 +201,7 @@ public class MantleWriterPreObjectJournalTest {
assertTrue(writer.restorePrerequisiteData(X, Y, Z, String.class));
assertNull(writer.getDataIfPresent(X, Y, Z, String.class));
assertTrue(writer.restorePrerequisiteCell(X, Y, Z));
assertSame(originalBlock, writer.getDataIfPresent(X, Y, Z, PlatformBlockState.class));
assertSame(originalBlock, writer.getDataIfPresent(X, Y, Z, NativeBlockState.class));
assertEquals(originalCavern, writer.getDataIfPresent(X, Y, Z, MatterCavern.class));
assertFalse(writer.restorePrerequisiteData(X, Y, Z, Integer.class));
assertFalse(writer.restorePrerequisiteCell(X + 1, Y, Z));
@@ -11,7 +11,7 @@ import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.generation.terrain.Terrain3DColumnFixtures;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.BukkitTestServer;
import art.arcane.iris.world.storage.matter.IrisMatterSupport;
@@ -160,7 +160,7 @@ public class ObjectDestinationTransactionTest {
assertFalse(transaction.isCarved(0, 6, 0));
assertTrue(transaction.isCarved(0, 12, 0));
transaction.setData(0, 5, 0, mock(PlatformBlockState.class));
transaction.setData(0, 5, 0, mock(NativeBlockState.class));
assertFalse(transaction.isCarved(0, 5, 0));
assertEquals(0, transaction.getCarvedColumn(0, 0, 16)[5]);
@@ -232,8 +232,8 @@ public class ObjectDestinationTransactionTest {
@Test
public void rejectedWriterMutationsNeverEnterTheOverlay() {
MantleWriter writer = writer();
PlatformBlockState prerequisite = mock(PlatformBlockState.class);
PlatformBlockState rejected = mock(PlatformBlockState.class);
NativeBlockState prerequisite = mock(NativeBlockState.class);
NativeBlockState rejected = mock(NativeBlockState.class);
MatterCavern cavern = new MatterCavern(true, "", (byte) 0);
when(writer.getPrerequisiteBlock(0, 0, 0)).thenReturn(prerequisite);
when(writer.getEngine().getDimension().isBedrock()).thenReturn(true);
@@ -254,8 +254,8 @@ public class ObjectDestinationTransactionTest {
@Test
public void acceptedCustomPlacementPublishesBlockAndIdentifierAsOneMutation() {
MantleWriter writer = writer();
PlatformBlockState custom = mock(PlatformBlockState.class);
PlatformBlockState base = mock(PlatformBlockState.class);
NativeBlockState custom = mock(NativeBlockState.class);
NativeBlockState base = mock(NativeBlockState.class);
Identifier identifier = Identifier.fromString("iris:custom_block");
when(custom.isCustom()).thenReturn(true);
when(custom.deferredPlacementKey()).thenReturn(identifier.toString());
@@ -275,8 +275,8 @@ public class ObjectDestinationTransactionTest {
@Test
public void rejectedCustomPlacementStagesNeitherBlockNorIdentifier() {
MantleWriter writer = writer();
PlatformBlockState custom = mock(PlatformBlockState.class);
PlatformBlockState base = mock(PlatformBlockState.class);
NativeBlockState custom = mock(NativeBlockState.class);
NativeBlockState base = mock(NativeBlockState.class);
when(custom.isCustom()).thenReturn(true);
when(custom.deferredPlacementKey()).thenReturn("iris:custom_block");
when(custom.placementBaseState()).thenReturn(base);
@@ -293,14 +293,14 @@ public class ObjectDestinationTransactionTest {
assertNull(transaction.getDataIfPresent(1, 4, 0, Identifier.class));
assertNull(transaction.getDataIfPresent(2, 64, 0, Identifier.class));
transaction.commit();
verify(writer, never()).set(anyInt(), anyInt(), anyInt(), any(PlatformBlockState.class));
verify(writer, never()).set(anyInt(), anyInt(), anyInt(), any(NativeBlockState.class));
verify(writer, never()).setData(anyInt(), anyInt(), anyInt(), any(Identifier.class));
}
@Test
public void blockReplacementClearsOverlayIdentifierAndRestoresItAfterFailure() {
MantleWriter writer = writer();
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBlockState block = mock(NativeBlockState.class);
Marker failure = new Marker("failure");
Identifier originalIdentifier = Identifier.fromString("iris:deferred");
when(writer.getPrerequisiteDataIfPresent(0, 4, 0, Identifier.class)).thenReturn(originalIdentifier);
@@ -351,7 +351,7 @@ public class ObjectDestinationTransactionTest {
BukkitTestServer.install();
previousPlatform = IrisPlatforms.isBound() ? IrisPlatforms.get() : null;
IrisPlatforms.unbind();
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
PlatformRegistries registries = mock(PlatformRegistries.class);
IrisPlatform platform = mock(IrisPlatform.class);
when(air.isAir()).thenReturn(true);
@@ -6,7 +6,7 @@ import art.arcane.iris.world.history.BoundaryColumnGeometry;
import art.arcane.iris.world.history.TerrainBoundarySignature;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.world.storage.matter.IrisMatterSupport;
@@ -46,8 +46,8 @@ public class ResolvedTerrainPlacementTest {
private EngineMantle engineMantle;
private Mantle<Matter> mantle;
private PlatformBlockState stone;
private PlatformBlockState air;
private NativeBlockState stone;
private NativeBlockState air;
private Matter matter;
@Before
@@ -57,8 +57,8 @@ public class ResolvedTerrainPlacementTest {
IrisPlatforms.unbind();
IrisPlatform platform = mock(IrisPlatform.class);
PlatformRegistries registries = mock(PlatformRegistries.class);
stone = mock(PlatformBlockState.class);
air = mock(PlatformBlockState.class);
stone = mock(NativeBlockState.class);
air = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
when(registries.block(anyString())).thenReturn(air);
when(registries.blockOrNull("minecraft:stone")).thenReturn(stone);
@@ -130,7 +130,7 @@ public class ResolvedTerrainPlacementTest {
@Test
public void writerPrerequisitesIgnoreContentWhileLiveOccupancyIncludesBlockOnlyFills() {
matter.<PlatformBlockState>slice(PlatformBlockState.class).set(0, 1, 0, stone);
matter.<NativeBlockState>slice(NativeBlockState.class).set(0, 1, 0, stone);
matter.<PreObjectMatterCell>slice(PreObjectMatterCell.class).set(0, 1, 0, PreObjectMatterCell.block(null));
try (MantleWriter writer = new MantleWriter(engineMantle, mantle, 0, 0, 0, false)) {
assertSame(air, writer.getPrerequisiteBlock(0, 1, 0));
@@ -1,6 +1,8 @@
package art.arcane.iris.generation.mantle;
import art.arcane.iris.structure.placement.IrisStructureCarveShape;
import art.arcane.volmlib.util.structure.StructureCarveEnvelope;
import art.arcane.volmlib.util.structure.StructureCarveShape;
import art.arcane.volmlib.util.noise.CNG;
import art.arcane.volmlib.util.noise.NoiseType;
import art.arcane.volmlib.util.math.RNG;
@@ -14,31 +16,31 @@ public class StructureCarveEnvelopeTest {
@Test
public void exactStructureFootprintAlwaysCarves() {
assertTrue(StructureCarveEnvelope.shouldCarveOverboreCell(
IrisStructureCarveShape.ERODED, 0D, 0D, 1D));
StructureCarveShape.ERODED, 0D, 0D, 1D));
assertTrue(StructureCarveEnvelope.shouldCarveOverboreCell(
IrisStructureCarveShape.ROUNDED, 0D, 0D, 1D));
StructureCarveShape.ROUNDED, 0D, 0D, 1D));
}
@Test
public void boxModeKeepsStraightCandidateVolume() {
assertTrue(StructureCarveEnvelope.shouldCarveOverboreCell(
IrisStructureCarveShape.BOX, 100D, 0D, 1D));
StructureCarveShape.BOX, 100D, 0D, 1D));
}
@Test
public void roundedModeStopsAtConfiguredReach() {
assertTrue(StructureCarveEnvelope.shouldCarveOverboreCell(
IrisStructureCarveShape.ROUNDED, 1D, 0D, 1D));
StructureCarveShape.ROUNDED, 1D, 0D, 1D));
assertFalse(StructureCarveEnvelope.shouldCarveOverboreCell(
IrisStructureCarveShape.ROUNDED, 1.000001D, 1D, 0D));
StructureCarveShape.ROUNDED, 1.000001D, 1D, 0D));
}
@Test
public void zeroErosionStrengthMatchesRoundedMode() {
assertTrue(StructureCarveEnvelope.shouldCarveOverboreCell(
IrisStructureCarveShape.ERODED, 1D, 0D, 0D));
StructureCarveShape.ERODED, 1D, 0D, 0D));
assertFalse(StructureCarveEnvelope.shouldCarveOverboreCell(
IrisStructureCarveShape.ERODED, 1.000001D, 1D, 0D));
StructureCarveShape.ERODED, 1.000001D, 1D, 0D));
}
@Test
@@ -69,7 +71,7 @@ public class StructureCarveEnvelopeTest {
CNG roll = CNG.signature(new RNG(4242L));
for (double strength : new double[]{0.25D, 0.5D, 1D}) {
int limit = IrisStructureCarveShape.ERODED.maximumCeilingExtension(10, strength);
int limit = StructureCarveShape.ERODED.maximumCeilingExtension(10, strength);
for (int x = -32; x <= 32; x++) {
for (int z = -32; z <= 32; z++) {
double reach = StructureCarveEnvelope.erodedUpReach(roll, 0.05D, strength, x, z, 10);
@@ -1,9 +1,11 @@
package art.arcane.iris.generation.mantle;
import art.arcane.volmlib.util.structure.StructureCarvingFootprint;
import art.arcane.iris.structure.placement.PlacedStructurePiece;
import art.arcane.iris.structure.object.IrisObject;
import art.arcane.iris.structure.object.IrisObjectRotation;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.generation.geometry.IrisBlockVector;
import art.arcane.volmlib.util.collection.KList;
import org.junit.Test;
@@ -24,7 +26,7 @@ public class StructureCarvingFootprintTest {
block(0, 0, 0), block(1, 0, 0), block(2, 0, 0),
block(0, 0, 1), block(0, 0, 2));
StructureCarvingFootprint footprint = StructureCarvingFootprint.from(pieces(piece), 0);
StructureCarvingFootprint footprint = StructurePieceColumns.from(pieces(piece), 0);
assertNotNull(footprint);
assertEquals(10, footprint.minX());
@@ -43,7 +45,7 @@ public class StructureCarvingFootprintTest {
block(0, 10, 0), block(0, 12, 0),
block(4, 30, 0), block(4, 35, 0));
StructureCarvingFootprint footprint = StructureCarvingFootprint.from(pieces(piece), 2);
StructureCarvingFootprint footprint = StructurePieceColumns.from(pieces(piece), 2);
StructureCarvingFootprint.Column nearestRight = footprint.sample(3, 2);
StructureCarvingFootprint.Column tied = footprint.sample(2, 0);
@@ -64,7 +66,7 @@ public class StructureCarvingFootprintTest {
PlacedStructurePiece overlapping = piece(10, 5, 28, IrisObjectRotation.of(0, 0, 0),
block(0, 3, 0), block(0, 9, 0));
StructureCarvingFootprint footprint = StructureCarvingFootprint.from(
StructureCarvingFootprint footprint = StructurePieceColumns.from(
pieces(rotated, overlapping), 0);
assertNotNull(footprint);
@@ -85,7 +87,7 @@ public class StructureCarvingFootprintTest {
PlacedStructurePiece piece = piece(
-8, 30, 11, IrisObjectRotation.of(0, 0, 0), sourceBlocks);
StructureCarvingFootprint footprint = StructureCarvingFootprint.from(pieces(piece), 3);
StructureCarvingFootprint footprint = StructurePieceColumns.from(pieces(piece), 3);
assertNotNull(footprint);
for (int z = footprint.minZ(); z <= footprint.maxZ(); z++) {
@@ -103,23 +105,23 @@ public class StructureCarvingFootprintTest {
@Test
public void returnsNullForEmptyInvalidOrOversizedInputs() {
assertNull(StructureCarvingFootprint.from(null, 0));
assertNull(StructureCarvingFootprint.from(new KList<>(), 0));
assertNull(StructurePieceColumns.from(null, 0));
assertNull(StructurePieceColumns.from(new KList<>(), 0));
KList<PlacedStructurePiece> invalidPieces = new KList<>();
invalidPieces.add((PlacedStructurePiece) null);
invalidPieces.add(new PlacedStructurePiece(
null, null, 0, 0, 0, null, 0, 0, 0, 0, 0, 0));
assertNull(StructureCarvingFootprint.from(invalidPieces, 0));
assertNull(StructurePieceColumns.from(invalidPieces, 0));
PlacedStructurePiece piece = piece(0, 0, 0, IrisObjectRotation.of(0, 0, 0), block(0, 0, 0));
assertNull(StructureCarvingFootprint.from(pieces(piece), 2, 24));
assertNull(StructurePieceColumns.from(pieces(piece), 2, 24));
PlacedStructurePiece overflowing = piece(
Integer.MAX_VALUE, 0, 0, IrisObjectRotation.of(0, 0, 0), block(1, 0, 0));
assertNull(StructureCarvingFootprint.from(pieces(overflowing), 0));
assertNull(StructurePieceColumns.from(pieces(overflowing), 0));
try {
StructureCarvingFootprint.from(pieces(piece), -1);
StructurePieceColumns.from(pieces(piece), -1);
fail("Expected negative padding to fail");
} catch (IllegalArgumentException e) {
assertEquals("padding must be non-negative", e.getMessage());
@@ -130,7 +132,7 @@ public class StructureCarvingFootprintTest {
public void includesTheEntirePaddingBoundary() {
PlacedStructurePiece piece = piece(7, 14, -4, IrisObjectRotation.of(0, 0, 0), block(0, 0, 0));
StructureCarvingFootprint footprint = StructureCarvingFootprint.from(pieces(piece), 2, 25);
StructureCarvingFootprint footprint = StructurePieceColumns.from(pieces(piece), 2, 25);
assertNotNull(footprint);
assertEquals(5, footprint.minX());
@@ -149,8 +151,8 @@ public class StructureCarvingFootprintTest {
@Test
public void explicitAirDoesNotExpandTheExteriorFootprint() {
IrisObject object = new IrisObject(1, 1, 1);
PlatformBlockState solid = mock(PlatformBlockState.class);
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
object.getBlocks().put(new IrisBlockVector(0, 0, 0), solid);
object.getBlocks().put(new IrisBlockVector(8, 4, 8), air);
@@ -158,7 +160,7 @@ public class StructureCarvingFootprintTest {
null, object, 10, 20, 30, IrisObjectRotation.of(0, 0, 0),
10, 20, 30, 18, 24, 38);
StructureCarvingFootprint footprint = StructureCarvingFootprint.from(pieces(piece), 0);
StructureCarvingFootprint footprint = StructurePieceColumns.from(pieces(piece), 0);
assertNotNull(footprint);
assertEquals(10, footprint.minX());
@@ -170,7 +172,7 @@ public class StructureCarvingFootprintTest {
private static PlacedStructurePiece piece(int x, int y, int z, IrisObjectRotation rotation,
int[]... blocks) {
IrisObject object = new IrisObject(1, 1, 1);
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
for (int[] block : blocks) {
object.getBlocks().put(new IrisBlockVector(block[0], block[1], block[2]), state);
}
@@ -1,6 +1,6 @@
package art.arcane.iris.generation.mantle;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
import org.junit.Test;
@@ -16,13 +16,13 @@ import static org.mockito.Mockito.when;
public class StructureFoundationPlannerTest {
@Test
public void recordsLowestPlacedOccludingCellByDefault() {
PlatformBlockState solid = mock(PlatformBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
when(solid.isOccluding()).thenReturn(true);
when(solid.isSolid()).thenReturn(true);
PlatformBlockState nonOccludingSolid = mock(PlatformBlockState.class);
NativeBlockState nonOccludingSolid = mock(NativeBlockState.class);
when(nonOccludingSolid.isSolid()).thenReturn(true);
when(nonOccludingSolid.isOccluding()).thenReturn(false);
PlatformBlockState decoration = mock(PlatformBlockState.class);
NativeBlockState decoration = mock(NativeBlockState.class);
when(decoration.isOccluding()).thenReturn(false);
Long2IntOpenHashMap columns = new Long2IntOpenHashMap();
@@ -44,10 +44,10 @@ public class StructureFoundationPlannerTest {
@Test
public void recordsSolidNonOccludingBaseWhenEnabled() {
PlatformBlockState partialStructureBlock = mock(PlatformBlockState.class);
NativeBlockState partialStructureBlock = mock(NativeBlockState.class);
when(partialStructureBlock.isSolid()).thenReturn(true);
when(partialStructureBlock.isOccluding()).thenReturn(false);
PlatformBlockState fullStructureBlock = mock(PlatformBlockState.class);
NativeBlockState fullStructureBlock = mock(NativeBlockState.class);
when(fullStructureBlock.isSolid()).thenReturn(true);
when(fullStructureBlock.isOccluding()).thenReturn(true);
@@ -72,9 +72,9 @@ public class StructureFoundationPlannerTest {
@Test
public void compositeGroundUsesOverlayThenCarvingThenTerrain() {
PlatformBlockState solid = mock(PlatformBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
when(solid.isSolid()).thenReturn(true);
PlatformBlockState fluid = mock(PlatformBlockState.class);
NativeBlockState fluid = mock(NativeBlockState.class);
when(fluid.isSolid()).thenReturn(false);
assertTrue(StructureFoundationPlanner.isGroundSolid(solid, true, 12, 20));
@@ -87,9 +87,9 @@ public class StructureFoundationPlannerTest {
@Test
public void surfaceSupportStopsAtCarvedCaveBoundary() {
PlatformBlockState solid = mock(PlatformBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
when(solid.isSolid()).thenReturn(true);
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
when(air.isSolid()).thenReturn(false);
assertTrue(StructureFoundationPlanner.isSurfaceSupportBoundary(null, true, 18, 24));
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.mantle;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveAction;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.world.storage.matter.IrisMatterSupport;
import art.arcane.iris.world.storage.matter.PreObjectMatterCell;
import art.arcane.iris.world.storage.matter.PreObjectMatterTest;
@@ -81,8 +81,8 @@ public class TerrainMatterViewTest {
assertJournalIteration(HydrologyCaveCell.class,
HydrologyCaveCell.of(HydrologyCaveAction.DRY_AIR),
HydrologyCaveCell.of(HydrologyCaveAction.WET_SOURCE), PreObjectMatterCell::hydrology);
assertJournalIteration(PlatformBlockState.class,
mock(PlatformBlockState.class), mock(PlatformBlockState.class), PreObjectMatterCell::block);
assertJournalIteration(NativeBlockState.class,
mock(NativeBlockState.class), mock(NativeBlockState.class), PreObjectMatterCell::block);
}
@Test
@@ -12,7 +12,7 @@ import art.arcane.iris.generation.terrain.Terrain3DColumn;
import art.arcane.iris.generation.terrain.Terrain3DColumnFixtures;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.generation.context.ChunkContext;
import art.arcane.iris.generation.context.ChunkedDataCache;
@@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class DimensionTerrain3DCompositionTest {
private final Map<String, PlatformBlockState> states = new HashMap<>();
private final Map<String, NativeBlockState> states = new HashMap<>();
private IrisPlatform previousPlatform;
@Before
@@ -70,7 +70,7 @@ public class DimensionTerrain3DCompositionTest {
Terrain3DColumn terrain = Terrain3DColumnFixtures.spans(6, 0, 3, 7, 9);
DimensionStackLayout layout = DimensionStackLayout.create(32, 0,
List.of(input(10, 0, null), input(9, 0, terrain)), new int[]{0});
Hunk<PlatformBlockState> blocks = render(layout, 32);
Hunk<NativeBlockState> blocks = render(layout, 32);
assertSame(state("surface"), blocks.getRaw(0, 14, 0));
assertSame(state("rock"), blocks.getRaw(0, 13, 0));
assertTrue(blocks.getRaw(0, 15, 0).isAir());
@@ -98,7 +98,7 @@ public class DimensionTerrain3DCompositionTest {
Terrain3DColumn terrain = Terrain3DColumnFixtures.spans(6, 0, 2, 8, 10);
DimensionStackLayout layout = DimensionStackLayout.create(32, 0,
List.of(input(20, 0, null), input(10, 0, terrain)), new int[]{-11});
Hunk<PlatformBlockState> blocks = render(layout, 32);
Hunk<NativeBlockState> blocks = render(layout, 32);
assertFalse(layout.isSolid(15));
assertTrue(blocks.getRaw(0, 15, 0).isAir());
assertTrue(layout.isHostFeatureProtectedY(15));
@@ -112,7 +112,7 @@ public class DimensionTerrain3DCompositionTest {
DimensionStackLayout.LayerInput upper = materialInput(terrain, biome, 5D);
DimensionStackLayout layout = DimensionStackLayout.create(64, 0,
List.of(input(10, 0, null), upper), new int[]{0});
Hunk<PlatformBlockState> blocks = render(layout, 64);
Hunk<NativeBlockState> blocks = render(layout, 64);
assertSame(state("grass"), blocks.getRaw(0, 16, 0));
assertSame(state("rock"), blocks.getRaw(0, 32, 0));
}
@@ -123,7 +123,7 @@ public class DimensionTerrain3DCompositionTest {
IrisBiome biome = paletteBiome(true, new IrisSlopeClip(), "a", "b", "c");
DimensionStackLayout layout = DimensionStackLayout.create(64, 0,
List.of(input(10, 0, null), materialInput(terrain, biome, 0D)), new int[]{0});
Hunk<PlatformBlockState> blocks = render(layout, 64);
Hunk<NativeBlockState> blocks = render(layout, 64);
assertSame(state("a"), blocks.getRaw(0, 16, 0));
assertSame(state("c"), blocks.getRaw(0, 15, 0));
assertSame(state("c"), blocks.getRaw(0, 32, 0));
@@ -134,12 +134,12 @@ public class DimensionTerrain3DCompositionTest {
Terrain3DColumn terrain = Terrain3DColumnFixtures.spans(15, 0, 5, 10, 21);
UpperDimensionContext upper = materialUpper(terrain,
paletteBiome(false, new IrisSlopeClip(0D, 1D), "grass"), 5D);
Hunk<PlatformBlockState> slopeBlocks = renderUpper(upper);
Hunk<NativeBlockState> slopeBlocks = renderUpper(upper);
assertSame(state("grass"), slopeBlocks.getRaw(0, 58, 0));
assertSame(state("rock"), slopeBlocks.getRaw(0, 42, 0));
upper = materialUpper(terrain, paletteBiome(true, new IrisSlopeClip(), "a", "b", "c"), 0D);
Hunk<PlatformBlockState> lockedBlocks = renderUpper(upper);
Hunk<NativeBlockState> lockedBlocks = renderUpper(upper);
assertSame(state("a"), lockedBlocks.getRaw(0, 58, 0));
assertSame(state("c"), lockedBlocks.getRaw(0, 59, 0));
assertSame(state("c"), lockedBlocks.getRaw(0, 42, 0));
@@ -148,15 +148,15 @@ public class DimensionTerrain3DCompositionTest {
@Test
@SuppressWarnings("unchecked")
public void actualUpperPassMirrorsGapsAndPaintsEveryInvertedFace() {
PlatformBlockState upperRock = state("upper-rock");
PlatformBlockState upperSurface = state("upper-surface");
NativeBlockState upperRock = state("upper-rock");
NativeBlockState upperSurface = state("upper-surface");
Terrain3DColumn terrain = Terrain3DColumnFixtures.spans(15, 0, 5, 10, 20);
UpperDimensionContext.Column upperColumn = new UpperDimensionContext.Column(64, 43, terrain);
UpperDimensionContext upper = mock(UpperDimensionContext.class);
when(upper.sampleColumn(0, 0)).thenReturn(upperColumn);
when(upper.getRockBlock(0, 0)).thenReturn(upperRock);
when(upper.getSurfaceBlock(0, 0)).thenReturn(upperSurface);
Hunk<PlatformBlockState> blocks = renderUpper(upper);
Hunk<NativeBlockState> blocks = renderUpper(upper);
assertSame(state("upper-surface"), blocks.getRaw(0, 43, 0));
assertSame(state("upper-rock"), blocks.getRaw(0, 44, 0));
@@ -262,8 +262,8 @@ public class DimensionTerrain3DCompositionTest {
}
@SuppressWarnings("unchecked")
private Hunk<PlatformBlockState> renderUpper(UpperDimensionContext upper) {
PlatformBlockState rootRock = state("root");
private Hunk<NativeBlockState> renderUpper(UpperDimensionContext upper) {
NativeBlockState rootRock = state("root");
Engine engine = mock(Engine.class);
IrisDimension dimension = new IrisDimension().setBedrock(false).setHideOresForHiddenOre(true);
when(engine.getDimension()).thenReturn(dimension);
@@ -279,26 +279,26 @@ public class DimensionTerrain3DCompositionTest {
ChunkedDataCache<IrisBiome> biomes = mock(ChunkedDataCache.class);
when(biomes.get(0, 0)).thenReturn(biome);
ChunkedDataCache<IrisRegion> regions = mock(ChunkedDataCache.class);
ChunkedDataCache<PlatformBlockState> rocks = mock(ChunkedDataCache.class);
ChunkedDataCache<NativeBlockState> rocks = mock(ChunkedDataCache.class);
when(rocks.get(0, 0)).thenReturn(rootRock);
ChunkContext context = mock(ChunkContext.class);
when(context.getBiome()).thenReturn(biomes);
when(context.getRegion()).thenReturn(regions);
when(context.getRock()).thenReturn(rocks);
when(context.getRoundedHeight(0, 0)).thenReturn(8);
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(1, 64, 1);
Hunk<NativeBlockState> blocks = Hunk.newArrayHunk(1, 64, 1);
new IrisTerrainNormalActuator(engine).terrainSliver(0, 0, 0, blocks, context);
return blocks;
}
private Hunk<PlatformBlockState> render(DimensionStackLayout layout, int height) {
private Hunk<NativeBlockState> render(DimensionStackLayout layout, int height) {
Engine engine = mock(Engine.class);
when(engine.getSeedManager()).thenReturn(mock(SeedManager.class));
when(engine.getDimensionStackContext()).thenReturn(mock(DimensionStackContext.class));
ChunkContext context = mock(ChunkContext.class);
when(context.isSpeculativeTerrain()).thenReturn(true);
when(context.getDimensionStackLayout(0, 0)).thenReturn(layout);
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, height, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, height, 1);
for (int y = 0; y < height; y++) {
output.setRaw(0, y, 0, state("root"));
}
@@ -323,7 +323,7 @@ public class DimensionTerrain3DCompositionTest {
}
private UpperDimensionContext materialUpper(Terrain3DColumn terrain, IrisBiome biome, double capSlope) {
PlatformBlockState rock = state("rock");
NativeBlockState rock = state("rock");
UpperDimensionContext upper = mock(UpperDimensionContext.class);
when(upper.sampleColumn(0, 0)).thenReturn(new UpperDimensionContext.Column(64, 63 - terrain.topY(), terrain));
when(upper.getRockBlock(0, 0)).thenReturn(rock);
@@ -337,7 +337,7 @@ public class DimensionTerrain3DCompositionTest {
private IrisBiome paletteBiome(boolean locked, IrisSlopeClip slope, String... keys) {
KList<IrisBiomePaletteLayer> layers = new KList<>();
for (String key : keys) {
PlatformBlockState block = state(key);
NativeBlockState block = state(key);
IrisBiomePaletteLayer layer = mock(IrisBiomePaletteLayer.class);
CNG height = mock(CNG.class);
when(layer.getZoom()).thenReturn(1D);
@@ -352,9 +352,9 @@ public class DimensionTerrain3DCompositionTest {
return new IrisBiome().setLockLayers(locked).setLayers(layers);
}
private PlatformBlockState state(String key) {
private NativeBlockState state(String key) {
return states.computeIfAbsent(key, value -> {
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBlockState block = mock(NativeBlockState.class);
when(block.key()).thenReturn(value);
when(block.isAir()).thenReturn(value.equalsIgnoreCase("air") || value.equals("minecraft:air"));
return block;
@@ -4,7 +4,7 @@ import art.arcane.iris.generation.image.IrisImageMapRuntime;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.stream.ProceduralStream;
import art.arcane.iris.generation.terrain.Terrain3DColumn;
import art.arcane.iris.generation.terrain.Terrain3DColumnFixtures;
@@ -76,13 +76,13 @@ public class DimensionTerrainContextFallbackTest {
ProceduralStream<IrisBiome> naturalBiome = mock(ProceduralStream.class);
ProceduralStream<IrisBiome> resolvedBiome = mock(ProceduralStream.class);
ProceduralStream<IrisRegion> region = mock(ProceduralStream.class);
ProceduralStream<PlatformBlockState> rock = mock(ProceduralStream.class);
ProceduralStream<PlatformBlockState> configuredFluid = mock(ProceduralStream.class);
ProceduralStream<NativeBlockState> rock = mock(ProceduralStream.class);
ProceduralStream<NativeBlockState> configuredFluid = mock(ProceduralStream.class);
IrisImageMapRuntime imageMapRuntime = mock(IrisImageMapRuntime.class);
IrisBiome naturalBiomeValue = mock(IrisBiome.class);
IrisBiome resolvedBiomeValue = mock(IrisBiome.class);
PlatformBlockState naturalFluid = mock(PlatformBlockState.class);
PlatformBlockState resolvedFluid = mock(PlatformBlockState.class);
NativeBlockState naturalFluid = mock(NativeBlockState.class);
NativeBlockState resolvedFluid = mock(NativeBlockState.class);
when(engine.getDimension()).thenReturn(dimension);
when(engine.getComplex()).thenReturn(complex);
@@ -5,9 +5,9 @@ import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.iris.spi.PlatformBiomeWriter;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import org.junit.After;
@@ -35,8 +35,8 @@ public class EngineHostHeightTest {
@Before
public void bindPlatform() {
IrisPlatforms.unbind();
PlatformBiome biome = mock(PlatformBiome.class);
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBiome biome = mock(NativeBiome.class);
NativeBlockState block = mock(NativeBlockState.class);
PlatformRegistries registries = mock(PlatformRegistries.class);
when(registries.biome(anyString())).thenReturn(biome);
when(registries.block(anyString())).thenReturn(block);
@@ -15,7 +15,7 @@ import art.arcane.iris.world.IrisWorld;
import art.arcane.iris.generation.mantle.EngineMantle;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.DurabilityMode;
import art.arcane.iris.testsupport.PlatformLeakGuard;
@@ -85,7 +85,7 @@ public class EngineShutdownDrainTest {
when(platform.dataFile("iris.json")).thenReturn(PLATFORM_FILES.getRoot().toPath().resolve("iris.json").toFile());
PlatformRegistries registries = mock(PlatformRegistries.class);
when(platform.registries()).thenReturn(registries);
when(registries.block(anyString())).thenReturn(mock(PlatformBlockState.class));
when(registries.block(anyString())).thenReturn(mock(NativeBlockState.class));
IrisPlatforms.bind(platform);
}
@@ -9,7 +9,7 @@ import art.arcane.iris.generation.biome.IrisBiomePaletteLayer;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.generation.terrain.IrisDimensionCarvingResolver;
import art.arcane.iris.world.IrisWorld;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.generation.block.B;
import art.arcane.iris.generation.context.ChunkContext;
import art.arcane.iris.generation.context.IrisContext;
@@ -74,13 +74,13 @@ public class IrisCarveWallPaletteScopeTest {
}
private static void verifyWalls(Mode mode) throws Exception {
PlatformBlockState air = block("minecraft:cave_air", false);
PlatformBlockState stone = block("minecraft:stone", true);
PlatformBlockState wall = block("minecraft:calcite", true);
NativeBlockState air = block("minecraft:cave_air", false);
NativeBlockState stone = block("minecraft:stone", true);
NativeBlockState wall = block("minecraft:calcite", true);
try (MockedStatic<B> blocks = mockStatic(B.class)) {
blocks.when(() -> B.getState(anyString())).thenReturn(air);
blocks.when(() -> B.isSolid(any())).thenAnswer(call ->
call.<PlatformBlockState>getArgument(0).isSolid());
call.<NativeBlockState>getArgument(0).isSolid());
Fixture fixture = new Fixture(air, wall);
GenerationRuntime selected = mode == Mode.DETACHED ? fixture.detached : fixture.active;
IrisData expectedData = mode == Mode.ASSEMBLY ? fixture.assemblyData : selected.data();
@@ -88,7 +88,7 @@ public class IrisCarveWallPaletteScopeTest {
fixture.expectedData = expectedData;
doReturn(expectedComplex).when(fixture.context).getComplex();
doReturn(mode == Mode.NATURAL).when(fixture.context).isNaturalTerrain();
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(16, 64, 16);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(16, 64, 16);
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 64; y++) {
for (int z = 0; z < 16; z++) {
@@ -120,7 +120,7 @@ public class IrisCarveWallPaletteScopeTest {
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 64; y++) {
for (int z = 0; z < 16; z++) {
PlatformBlockState expected = stone;
NativeBlockState expected = stone;
for (int coordinate : new int[]{4, 8, 12}) {
if (y == 10 && x == coordinate && z == coordinate) {
expected = air;
@@ -142,8 +142,8 @@ public class IrisCarveWallPaletteScopeTest {
}
}
private static PlatformBlockState block(String key, boolean solid) {
PlatformBlockState block = mock(PlatformBlockState.class);
private static NativeBlockState block(String key, boolean solid) {
NativeBlockState block = mock(NativeBlockState.class);
doReturn(key).when(block).key();
doReturn(solid).when(block).isSolid();
return block;
@@ -186,7 +186,7 @@ public class IrisCarveWallPaletteScopeTest {
private IrisData expectedData;
@SuppressWarnings("unchecked")
private Fixture(PlatformBlockState air, PlatformBlockState wall) throws Exception {
private Fixture(NativeBlockState air, NativeBlockState wall) throws Exception {
Mantle<Matter> mantle = mock(Mantle.class);
doReturn(new KMap<>()).when(mantle).getLoadedRegions();
chunk = mock(MantleChunk.class);
@@ -8,7 +8,7 @@ import art.arcane.iris.studio.generation.BiomeBuffetLayout;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.generation.block.B;
import org.junit.ClassRule;
@@ -66,7 +66,7 @@ public class IrisComplexBiomeBuffetTest {
Path pack = fixture();
IrisData data = IrisData.openRuntime(pack.toFile());
try (MockedStatic<B> blocks = mockStatic(B.class)) {
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBlockState block = mock(NativeBlockState.class);
when(block.isFluid()).thenReturn(true);
blocks.when(() -> B.getState(anyString())).thenReturn(block);
blocks.when(() -> B.getStateOrNull(anyString(), eq(false))).thenReturn(block);
@@ -157,7 +157,7 @@ public class IrisComplexBiomeBuffetTest {
"{\"composite\":[{\"enabled\":false,\"offsetY\":1}]}");
IrisData data = IrisData.openRuntime(pack.toFile());
try (MockedStatic<B> blocks = mockStatic(B.class)) {
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBlockState block = mock(NativeBlockState.class);
when(block.isFluid()).thenReturn(true);
blocks.when(() -> B.getStateOrNull(anyString(), eq(false))).thenReturn(block);
IrisDimension dimension = data.getDimensionLoader().load("main");
@@ -9,11 +9,11 @@ import art.arcane.iris.world.history.SavedTerrainChunk;
import art.arcane.iris.world.history.TerrainBoundarySignature;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.generation.context.ChunkContext;
import art.arcane.iris.generation.context.IrisContext;
@@ -65,7 +65,7 @@ public final class ResolvedTerrainProviderTest {
public void cachedTransitionTerrainRetainsDeferredBlocksWhenCopied() {
Fixture fixture = new Fixture();
String key = "itemsadder:rocks/ruby_ore";
PlatformBlockState custom = Fixture.block(key, false);
NativeBlockState custom = Fixture.block(key, false);
when(custom.isCustom()).thenReturn(true);
when(custom.placementBaseState()).thenReturn(fixture.stone);
when(custom.deferredPlacementKey()).thenReturn(key);
@@ -95,7 +95,7 @@ public final class ResolvedTerrainProviderTest {
when(registries.biome("minecraft:plains")).thenReturn(fixture.biome);
ChunkContext context = new ChunkContext(0, 0, fixture.complex, false, ChunkContext.PrefillPlan.NONE, null);
AtomicInteger customWrites = new AtomicInteger();
Hunk<PlatformBlockState> blocks = Hunk.<PlatformBlockState>newArrayHunk(16, 16, 16).listen((x, y, z, state) -> {
Hunk<NativeBlockState> blocks = Hunk.<NativeBlockState>newArrayHunk(16, 16, 16).listen((x, y, z, state) -> {
if (state.isCustom()) {
customWrites.incrementAndGet();
}
@@ -325,8 +325,8 @@ public final class ResolvedTerrainProviderTest {
};
when(fixture.mode.getStages()).thenReturn(new KList<>(content));
doCallRealMethod().when(fixture.mode).generate(anyInt(), anyInt(), any(), any(), anyBoolean(), anyLong());
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(16, 16, 16);
Hunk<PlatformBiome> biomes = Hunk.newArrayHunk(16, 16, 16);
Hunk<NativeBlockState> blocks = Hunk.newArrayHunk(16, 16, 16);
Hunk<NativeBiome> biomes = Hunk.newArrayHunk(16, 16, 16);
fixture.mode.generate(0, 0, blocks, biomes, false, 41L);
@@ -406,7 +406,7 @@ public final class ResolvedTerrainProviderTest {
when(plan.isHistoricalBlock(anyInt(), anyInt())).thenAnswer(invocation -> (int) invocation.getArgument(0) < 16);
when(plan.newEpochWeightAt(anyInt(), anyInt())).thenReturn(0.5D);
when(fixture.complex.getTransitionGenerationPlan()).thenReturn(plan);
PlatformBlockState water = Fixture.block("minecraft:water[level=0]", false);
NativeBlockState water = Fixture.block("minecraft:water[level=0]", false);
when(water.isFluid()).thenReturn(true);
fixture.terrainOverride = (x, z, blocks, biomes, multicore, context) -> {
for (int localX = 0; localX < 16; localX++) {
@@ -433,9 +433,9 @@ public final class ResolvedTerrainProviderTest {
private final IrisComplex complex = mock(IrisComplex.class);
private final EngineMode mode = mock(EngineMode.class);
private final GenerationHistoryRuntimeRouter router = mock(GenerationHistoryRuntimeRouter.class);
private final PlatformBlockState air = block("minecraft:air", true);
private final PlatformBlockState stone = block("minecraft:stone", false);
private final PlatformBiome biome = mock(PlatformBiome.class);
private final NativeBlockState air = block("minecraft:air", true);
private final NativeBlockState stone = block("minecraft:stone", false);
private final NativeBiome biome = mock(NativeBiome.class);
private final Map<String, Integer> computations = new HashMap<>();
private final List<String> events = new ArrayList<>();
private final ResolvedTerrainProvider provider;
@@ -459,7 +459,7 @@ public final class ResolvedTerrainProviderTest {
when(height.getDouble(anyDouble(), anyDouble())).thenReturn(3D);
ProceduralStream<IrisBiome> biomes = mock(ProceduralStream.class);
ProceduralStream<IrisRegion> regions = mock(ProceduralStream.class);
ProceduralStream<PlatformBlockState> materials = mock(ProceduralStream.class);
ProceduralStream<NativeBlockState> materials = mock(ProceduralStream.class);
when(materials.get(anyDouble(), anyDouble())).thenReturn(stone);
when(complex.getRawHeightStream()).thenReturn(height);
when(complex.getTrueBiomeStream()).thenReturn(biomes);
@@ -472,16 +472,16 @@ public final class ResolvedTerrainProviderTest {
doAnswer(invocation -> {
int x = invocation.getArgument(0);
int z = invocation.getArgument(1);
Hunk<PlatformBlockState> blocks = invocation.getArgument(2);
Hunk<PlatformBiome> physicalBiomes = invocation.getArgument(3);
Hunk<NativeBlockState> blocks = invocation.getArgument(2);
Hunk<NativeBiome> physicalBiomes = invocation.getArgument(3);
ChunkContext context = invocation.getArgument(5);
fill(x, z, blocks, physicalBiomes, context);
return null;
}).when(mode).generateTerrain(anyInt(), anyInt(), any(), any(), anyBoolean(), any());
}
private void fill(int x, int z, Hunk<PlatformBlockState> blocks,
Hunk<PlatformBiome> biomes, ChunkContext context) {
private void fill(int x, int z, Hunk<NativeBlockState> blocks,
Hunk<NativeBiome> biomes, ChunkContext context) {
assertTrue(context.isNaturalTerrain());
assertSame(context, IrisContext.require().getChunkContext());
lastSessionId = IrisContext.require().getGenerationSessionId();
@@ -507,8 +507,8 @@ public final class ResolvedTerrainProviderTest {
}
}
private static PlatformBlockState block(String key, boolean air) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState block(String key, boolean air) {
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(key);
when(state.isAir()).thenReturn(air);
return state;
@@ -3,7 +3,7 @@ package art.arcane.iris.generation.runtime;
import art.arcane.iris.generation.image.IrisImageMapRuntime;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -33,7 +33,7 @@ public class UpperDimensionImageMapRuntimeTest {
IrisImageMapRuntime runtime = mock(IrisImageMapRuntime.class);
IrisRegion proceduralRegion = new IrisRegion();
IrisBiome proceduralBiome = new IrisBiome();
PlatformBlockState proceduralBlock = mock(PlatformBlockState.class);
NativeBlockState proceduralBlock = mock(NativeBlockState.class);
assertSame(proceduralRegion, UpperDimensionContext.mappedRegion(
runtime, proceduralRegion, -2D, 4D));
@@ -46,8 +46,8 @@ public class UpperDimensionImageMapRuntimeTest {
@Test
public void mappedHeightAndSurfaceBlockAreAuthoritative() {
IrisImageMapRuntime runtime = mock(IrisImageMapRuntime.class);
PlatformBlockState proceduralBlock = mock(PlatformBlockState.class);
PlatformBlockState mappedBlock = mock(PlatformBlockState.class);
NativeBlockState proceduralBlock = mock(NativeBlockState.class);
NativeBlockState mappedBlock = mock(NativeBlockState.class);
when(runtime.sampleTerrainHeight(3D, 9D, 80D)).thenReturn(144D);
when(runtime.sampleSurfaceBlock(3D, 9D)).thenReturn(mappedBlock);
@@ -9,8 +9,8 @@ import art.arcane.iris.generation.mantle.EngineMantle;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.iris.spi.PlatformBiomeWriter;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
@@ -73,7 +73,7 @@ public class IrisBiomeActuatorCoordinateTest {
when(complex.allowsNewDiscreteContentAt(anyInt(), anyInt())).thenReturn(true);
Engine engine = engine(complex);
IrisBiomeActuator actuator = new IrisBiomeActuator(engine);
Hunk<PlatformBiome> output = mock(Hunk.class);
Hunk<NativeBiome> output = mock(Hunk.class);
when(output.getWidth()).thenReturn(2);
when(output.getDepth()).thenReturn(2);
when(output.getHeight()).thenReturn(1);
@@ -126,7 +126,7 @@ public class IrisBiomeActuatorCoordinateTest {
.thenReturn(Optional.of("iris:old-physical"));
Engine engine = engine(complex);
IrisBiomeActuator actuator = new IrisBiomeActuator(engine);
Hunk<PlatformBiome> output = mock(Hunk.class);
Hunk<NativeBiome> output = mock(Hunk.class);
when(output.getWidth()).thenReturn(1);
when(output.getDepth()).thenReturn(1);
when(output.getHeight()).thenReturn(1);
@@ -164,7 +164,7 @@ public class IrisBiomeActuatorCoordinateTest {
Engine engine = engine(complex);
when(engine.getMinHeight()).thenReturn(-64);
IrisBiomeActuator actuator = new IrisBiomeActuator(engine);
Hunk<PlatformBiome> output = mock(Hunk.class);
Hunk<NativeBiome> output = mock(Hunk.class);
when(output.getWidth()).thenReturn(1);
when(output.getDepth()).thenReturn(1);
when(output.getHeight()).thenReturn(8);
@@ -178,8 +178,8 @@ public class IrisBiomeActuatorCoordinateTest {
verify(transitionPlan, times(1)).terrainSampleAt(100, -200);
verify(transitionPlan, never()).newEpochWeightAt(anyInt(), anyInt());
verify(transitionPlan, never()).historicalPhysicalBiomeKeyAt(anyInt(), anyInt(), anyInt());
verify(output).set(eq(0), eq(0), eq(0), eq(0), eq(3), eq(0), any(PlatformBiome.class));
verify(output).set(eq(0), eq(4), eq(0), eq(0), eq(7), eq(0), any(PlatformBiome.class));
verify(output).set(eq(0), eq(0), eq(0), eq(0), eq(3), eq(0), any(NativeBiome.class));
verify(output).set(eq(0), eq(4), eq(0), eq(0), eq(7), eq(0), any(NativeBiome.class));
Mantle<Matter> mantle = engine.getMantle().getMantle();
verify(mantle).set(eq(100), eq(0), eq(-200), argThat(value -> {
MatterBiomeInject injection = (MatterBiomeInject) value;
@@ -219,8 +219,8 @@ public class IrisBiomeActuatorCoordinateTest {
private void bindPlatform() {
IrisPlatforms.unbind();
PlatformBiome biome = mock(PlatformBiome.class);
PlatformBlockState block = mock(PlatformBlockState.class);
NativeBiome biome = mock(NativeBiome.class);
NativeBlockState block = mock(NativeBlockState.class);
PlatformRegistries registries = mock(PlatformRegistries.class);
when(registries.biome(anyString())).thenReturn(biome);
when(registries.block(anyString())).thenReturn(block);
@@ -8,7 +8,7 @@ import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.terrain.IrisDimensionCarvingResolver;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveAction;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import art.arcane.volmlib.util.stream.ProceduralStream;
import art.arcane.volmlib.util.mantle.runtime.MantleChunk;
@@ -106,11 +106,11 @@ public class IrisCarveModifierBoundarySupportTest {
@Test
@SuppressWarnings("unchecked")
public void gravityFloorLayerRequiresSolidSupportBelowItsTarget() {
Hunk<PlatformBlockState> output = mock(Hunk.class);
PlatformBlockState air = state("minecraft:cave_air", false);
PlatformBlockState solid = state("minecraft:stone", true);
PlatformBlockState sand = state("minecraft:sand", true);
PlatformBlockState stone = state("minecraft:stone", true);
Hunk<NativeBlockState> output = mock(Hunk.class);
NativeBlockState air = state("minecraft:cave_air", false);
NativeBlockState solid = state("minecraft:stone", true);
NativeBlockState sand = state("minecraft:sand", true);
NativeBlockState stone = state("minecraft:stone", true);
doReturn(air).when(output).getRaw(0, 4, 0);
assertFalse(IrisCarveModifier.canReplaceCaveFloorLayer(output, 0, 5, 0, sand));
@@ -123,10 +123,10 @@ public class IrisCarveModifierBoundarySupportTest {
@Test
@SuppressWarnings("unchecked")
public void gravityFloorDoesNotReceiveDecoratorsOverLowerCaveAir() {
Hunk<PlatformBlockState> output = mock(Hunk.class);
PlatformBlockState air = state("minecraft:cave_air", false);
PlatformBlockState sand = state("minecraft:sand", true);
PlatformBlockState stone = state("minecraft:stone", true);
Hunk<NativeBlockState> output = mock(Hunk.class);
NativeBlockState air = state("minecraft:cave_air", false);
NativeBlockState sand = state("minecraft:sand", true);
NativeBlockState stone = state("minecraft:stone", true);
doReturn(sand).when(output).getRaw(0, 5, 0);
doReturn(air).when(output).getRaw(0, 4, 0);
@@ -139,9 +139,9 @@ public class IrisCarveModifierBoundarySupportTest {
@Test
public void hydrologyGuardOnlyAcceptsStableSolidBoundaryLayers() {
HydrologyCaveCell guard = HydrologyCaveCell.of(HydrologyCaveAction.SEAL_GUARD);
PlatformBlockState stone = state("minecraft:stone", true);
PlatformBlockState sand = state("minecraft:sand", true);
PlatformBlockState water = state("minecraft:water", false, true);
NativeBlockState stone = state("minecraft:stone", true);
NativeBlockState sand = state("minecraft:sand", true);
NativeBlockState water = state("minecraft:water", false, true);
assertTrue(IrisCarveModifier.canReplaceHydrologyGuard(guard, stone, false));
assertTrue(IrisCarveModifier.canReplaceHydrologyGuard(guard, stone, true));
@@ -153,10 +153,10 @@ public class IrisCarveModifierBoundarySupportTest {
@Test
@SuppressWarnings("unchecked")
public void submergedCaveFloorUsesBuriedSubstrateInsteadOfVegetatedSurface() {
Hunk<PlatformBlockState> output = mock(Hunk.class);
PlatformBlockState grass = state("minecraft:grass_block", true);
PlatformBlockState dirt = state("minecraft:dirt", true);
PlatformBlockState moss = state("minecraft:moss_block", true);
Hunk<NativeBlockState> output = mock(Hunk.class);
NativeBlockState grass = state("minecraft:grass_block", true);
NativeBlockState dirt = state("minecraft:dirt", true);
NativeBlockState moss = state("minecraft:moss_block", true);
HydrologyCaveCell wet = HydrologyCaveCell.of(HydrologyCaveAction.WET_SOURCE);
doReturn(dirt).when(output).getRaw(0, 4, 0);
@@ -169,12 +169,12 @@ public class IrisCarveModifierBoundarySupportTest {
output, 0, 5, 0, grass, HydrologyCaveCell.of(HydrologyCaveAction.DRY_AIR)));
}
private PlatformBlockState state(String key, boolean solid) {
private NativeBlockState state(String key, boolean solid) {
return state(key, solid, false);
}
private PlatformBlockState state(String key, boolean solid, boolean fluid) {
PlatformBlockState state = mock(PlatformBlockState.class);
private NativeBlockState state(String key, boolean solid, boolean fluid) {
NativeBlockState state = mock(NativeBlockState.class);
doReturn(key).when(state).key();
doReturn(solid).when(state).isSolid();
doReturn(fluid).when(state).isFluid();
@@ -1,6 +1,6 @@
package art.arcane.iris.generation.stage;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.matter.MatterCavern;
import org.junit.Test;
@@ -18,10 +18,10 @@ public class IrisCarveModifierFluidIntentTest {
MatterCavern fluidIntent = new MatterCavern(true, "", (byte) 1);
MatterCavern lavaIntent = new MatterCavern(true, "", (byte) 2);
MatterCavern forcedAirIntent = new MatterCavern(true, "", (byte) 3);
PlatformBlockState existingFluid = mock(PlatformBlockState.class);
PlatformBlockState fluid = mock(PlatformBlockState.class);
PlatformBlockState lava = mock(PlatformBlockState.class);
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState existingFluid = mock(NativeBlockState.class);
NativeBlockState fluid = mock(NativeBlockState.class);
NativeBlockState lava = mock(NativeBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
when(existingFluid.isFluid()).thenReturn(true);
assertFalse(IrisCarveModifier.hasExplicitCarveIntent(null));
@@ -46,10 +46,10 @@ public class IrisCarveModifierFluidIntentTest {
@Test
public void unsupportedSurfaceOreIsRemovedOnlyOverCarvedAir() {
PlatformBlockState ore = mock(PlatformBlockState.class);
PlatformBlockState ordinarySurface = mock(PlatformBlockState.class);
PlatformBlockState air = mock(PlatformBlockState.class);
PlatformBlockState solid = mock(PlatformBlockState.class);
NativeBlockState ore = mock(NativeBlockState.class);
NativeBlockState ordinarySurface = mock(NativeBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
when(ore.isOre()).thenReturn(true);
when(ordinarySurface.isOre()).thenReturn(false);
when(air.isSolid()).thenReturn(false);
@@ -5,7 +5,7 @@ import art.arcane.iris.generation.hydrology.cave.HydrologyCaveAction;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.generation.hydrology.IrisRiverMaterialConfig;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.math.RNG;
import org.junit.Test;
@@ -20,8 +20,8 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class IrisCarveModifierHydrologyMaterialTest {
private final PlatformBlockState biomeLayer = mock(PlatformBlockState.class);
private final PlatformBlockState painted = mock(PlatformBlockState.class);
private final NativeBlockState biomeLayer = mock(NativeBlockState.class);
private final NativeBlockState painted = mock(NativeBlockState.class);
private final IrisMaterialPalette palette = mock(IrisMaterialPalette.class);
private final IrisData data = mock(IrisData.class);
private final RNG rng = new RNG(13L);
@@ -67,7 +67,7 @@ public class IrisCarveModifierHydrologyMaterialTest {
return new IrisRiverMaterialConfig().setEnabled(true).setPalette(palette).setDepth(depth);
}
private PlatformBlockState paint(IrisRiverMaterialConfig material, HydrologyCaveCell floorHydrology, int index) {
private NativeBlockState paint(IrisRiverMaterialConfig material, HydrologyCaveCell floorHydrology, int index) {
return IrisCarveModifier.paintUndergroundBedMaterial(
biomeLayer, material, floorHydrology, index, rng, 48, 31, -9, data);
}
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.stage;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveAction;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.matter.MatterCavern;
import org.junit.Test;
@@ -19,7 +19,7 @@ import static org.mockito.Mockito.when;
public class IrisCarveModifierHydrologyTest {
@Test
public void explicitHydrologyCanMaterializeIntoAnUninitializedCell() {
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
assertFalse(IrisCarveModifier.shouldSkipEmptyCarve(null, true));
@@ -54,10 +54,10 @@ public class IrisCarveModifierHydrologyTest {
@Test
public void hydrologyActionsResolveDistinctFluidStates() {
PlatformBlockState current = mock(PlatformBlockState.class);
PlatformBlockState source = mock(PlatformBlockState.class);
PlatformBlockState falling = mock(PlatformBlockState.class);
PlatformBlockState air = mock(PlatformBlockState.class);
NativeBlockState current = mock(NativeBlockState.class);
NativeBlockState source = mock(NativeBlockState.class);
NativeBlockState falling = mock(NativeBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
when(source.key()).thenReturn("minecraft:water[level=0]");
when(source.withProperty("level", "8")).thenReturn(falling);
@@ -71,10 +71,10 @@ public class IrisCarveModifierHydrologyTest {
@Test
public void waterloggingFollowsOnlyExplicitResultingWater() {
PlatformBlockState waterlogged = mock(PlatformBlockState.class);
PlatformBlockState dry = mock(PlatformBlockState.class);
PlatformBlockState water = mock(PlatformBlockState.class);
PlatformBlockState lava = mock(PlatformBlockState.class);
NativeBlockState waterlogged = mock(NativeBlockState.class);
NativeBlockState dry = mock(NativeBlockState.class);
NativeBlockState water = mock(NativeBlockState.class);
NativeBlockState lava = mock(NativeBlockState.class);
when(waterlogged.key()).thenReturn("minecraft:seagrass[waterlogged=true]");
when(waterlogged.withProperty("waterlogged", "false")).thenReturn(dry);
when(water.isWater()).thenReturn(true);
@@ -88,8 +88,8 @@ public class IrisCarveModifierHydrologyTest {
@Test
public void noOverlayLeavesBaselineWaterloggingUntouched() {
PlatformBlockState waterlogged = mock(PlatformBlockState.class);
PlatformBlockState water = mock(PlatformBlockState.class);
NativeBlockState waterlogged = mock(NativeBlockState.class);
NativeBlockState water = mock(NativeBlockState.class);
MatterCavern flooded = new MatterCavern(true, "", (byte) 1);
assertSame(waterlogged, IrisCarveModifier.normalizeHydrologyWaterlogging(
@@ -103,9 +103,9 @@ public class IrisCarveModifierHydrologyTest {
@Test
public void explicitOverlayUsesComposedFluidIntentForWaterlogging() {
PlatformBlockState waterlogged = mock(PlatformBlockState.class);
PlatformBlockState dry = mock(PlatformBlockState.class);
PlatformBlockState water = mock(PlatformBlockState.class);
NativeBlockState waterlogged = mock(NativeBlockState.class);
NativeBlockState dry = mock(NativeBlockState.class);
NativeBlockState water = mock(NativeBlockState.class);
MatterCavern flooded = new MatterCavern(true, "", (byte) 1);
when(waterlogged.key()).thenReturn("minecraft:seagrass[waterlogged=true]");
when(waterlogged.withProperty("waterlogged", "false")).thenReturn(dry);
@@ -4,7 +4,7 @@ import art.arcane.iris.generation.hydrology.HydrologyColumnLayer;
import art.arcane.iris.generation.hydrology.HydrologyColumnSample;
import art.arcane.iris.generation.hydrology.HydrologyFeatureRef;
import art.arcane.iris.generation.hydrology.HydrologyFeatureType;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import org.junit.Test;
@@ -86,9 +86,9 @@ public class IrisDecorantActuatorRiverTest {
@Test
public void seaDecoratorsRequireConnectedWaterBelowTheConfiguredSurface() {
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, 4, 1);
PlatformBlockState water = mock(PlatformBlockState.class);
PlatformBlockState adjacentWater = mock(PlatformBlockState.class);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, 4, 1);
NativeBlockState water = mock(NativeBlockState.class);
NativeBlockState adjacentWater = mock(NativeBlockState.class);
doReturn(true).when(water).isWater();
doReturn(true).when(adjacentWater).isWater();
output.set(1, 1, 0, water);
@@ -102,10 +102,10 @@ public class IrisDecorantActuatorRiverTest {
@Test
public void seaDecoratorStacksRequireConnectedWaterAtEveryPlacedLevel() {
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, 4, 1);
PlatformBlockState lowerWater = waterState();
PlatformBlockState upperWater = waterState();
PlatformBlockState adjacentWater = waterState();
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, 4, 1);
NativeBlockState lowerWater = waterState();
NativeBlockState upperWater = waterState();
NativeBlockState adjacentWater = waterState();
output.set(1, 1, 0, lowerWater);
output.set(1, 2, 0, upperWater);
output.set(0, 1, 0, adjacentWater);
@@ -118,9 +118,9 @@ public class IrisDecorantActuatorRiverTest {
@Test
public void dryAquaticSeaSurfacePlacementRestoresTheOriginalBlock() {
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(3, 3, 1);
PlatformBlockState air = state("minecraft:air");
PlatformBlockState seagrass = state("minecraft:seagrass");
Hunk<NativeBlockState> output = Hunk.newArrayHunk(3, 3, 1);
NativeBlockState air = state("minecraft:air");
NativeBlockState seagrass = state("minecraft:seagrass");
output.set(1, 1, 0, air);
output.set(1, 1, 0, seagrass);
@@ -237,14 +237,14 @@ public class IrisDecorantActuatorRiverTest {
);
}
private static PlatformBlockState waterState() {
PlatformBlockState water = state("minecraft:water");
private static NativeBlockState waterState() {
NativeBlockState water = state("minecraft:water");
doReturn(true).when(water).isWater();
return water;
}
private static PlatformBlockState state(String key) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState state(String key) {
NativeBlockState state = mock(NativeBlockState.class);
doReturn(key).when(state).key();
return state;
}
@@ -22,7 +22,7 @@ import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.decoration.IrisDepositGenerator;
import art.arcane.iris.generation.decoration.IrisDepositHeightDistribution;
import art.arcane.iris.generation.decoration.IrisDepositPlacementScope;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import art.arcane.volmlib.util.math.RNG;
import org.junit.Test;
@@ -65,9 +65,9 @@ public class IrisDepositModifierContainmentTest {
@Test
public void airAndFluidTargetsAreRejected() {
PlatformBlockState solid = mock(PlatformBlockState.class);
PlatformBlockState air = mock(PlatformBlockState.class);
PlatformBlockState fluid = mock(PlatformBlockState.class);
NativeBlockState solid = mock(NativeBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
NativeBlockState fluid = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
when(fluid.isFluid()).thenReturn(true);
@@ -81,8 +81,8 @@ public class IrisDepositModifierContainmentTest {
public void surfacePolicyReplacesBuriedHostPolicyWithoutAffectingCaves() {
IrisDepositGenerator generator = mock(IrisDepositGenerator.class);
IrisBiome biome = mock(IrisBiome.class);
PlatformBlockState sand = mock(PlatformBlockState.class);
PlatformBlockState basalt = mock(PlatformBlockState.class);
NativeBlockState sand = mock(NativeBlockState.class);
NativeBlockState basalt = mock(NativeBlockState.class);
when(generator.hasSurfaceReplaceableBlocks(biome)).thenReturn(true);
when(generator.canReplaceSurface(sand, biome)).thenReturn(true);
when(generator.canReplace(sand)).thenReturn(false);
@@ -175,10 +175,10 @@ public class IrisDepositModifierContainmentTest {
@Test
public void terrainSurfaceIncludesExteriorAirButExcludesCaveAir() {
Hunk<PlatformBlockState> data = Hunk.newHunk(3, 3, 3);
PlatformBlockState solid = mock(PlatformBlockState.class);
PlatformBlockState exteriorAir = mock(PlatformBlockState.class);
PlatformBlockState caveAir = mock(PlatformBlockState.class);
Hunk<NativeBlockState> data = Hunk.newHunk(3, 3, 3);
NativeBlockState solid = mock(NativeBlockState.class);
NativeBlockState exteriorAir = mock(NativeBlockState.class);
NativeBlockState caveAir = mock(NativeBlockState.class);
when(exteriorAir.isAir()).thenReturn(true);
when(exteriorAir.key()).thenReturn("minecraft:air");
when(caveAir.isAir()).thenReturn(true);
@@ -202,9 +202,9 @@ public class IrisDepositModifierContainmentTest {
@Test
public void exposureProbeChecksOnlyInBoundsOrthogonalNeighbors() {
Hunk<PlatformBlockState> data = Hunk.newHunk(3, 3, 3);
PlatformBlockState solid = mock(PlatformBlockState.class);
PlatformBlockState air = mock(PlatformBlockState.class);
Hunk<NativeBlockState> data = Hunk.newHunk(3, 3, 3);
NativeBlockState solid = mock(NativeBlockState.class);
NativeBlockState air = mock(NativeBlockState.class);
when(air.isAir()).thenReturn(true);
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
@@ -6,7 +6,7 @@ import art.arcane.iris.generation.decoration.IrisDepositGenerator;
import art.arcane.iris.generation.decoration.IrisDepositHeightDistribution;
import art.arcane.iris.generation.decoration.IrisDepositPlacementScope;
import art.arcane.iris.structure.object.IrisObject;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.testsupport.PlatformBinding;
import art.arcane.iris.generation.concurrent.BurstExecutor;
import art.arcane.iris.generation.concurrent.MultiBurst;
@@ -222,7 +222,7 @@ public class IrisDepositModifierContextTest {
private void generateAndCheckCleanup() throws Exception {
ChunkContext callerContext = mock(ChunkContext.class);
try (IrisContext.Scope ignored = IrisContext.open(engine, 19L, callerContext)) {
modifier.generateDeposits(Hunk.<PlatformBlockState>newArrayHunk(16, 16, 16),
modifier.generateDeposits(Hunk.<NativeBlockState>newArrayHunk(16, 16, 16),
2, -3, true, context);
assertSame(callerContext, IrisContext.require().getChunkContext());
assertEquals(19L, IrisContext.require().getGenerationSessionId());
@@ -9,7 +9,7 @@ import art.arcane.iris.generation.decoration.IrisDepositPlacementScope;
import art.arcane.iris.structure.object.IrisObject;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.generation.block.B;
@@ -59,7 +59,7 @@ public class IrisDepositModifierOrderingTest {
public void bindPlatform() {
IrisPlatforms.unbind();
PlatformRegistries registries = mock(PlatformRegistries.class);
PlatformBlockState stone = state("stone");
NativeBlockState stone = state("stone");
when(registries.block(anyString())).thenReturn(stone);
IrisPlatform platform = mock(IrisPlatform.class);
when(platform.registries()).thenReturn(registries);
@@ -111,11 +111,11 @@ public class IrisDepositModifierOrderingTest {
}
}
private static PlatformBlockState state(String material) {
private static NativeBlockState state(String material) {
return new KeyedBlockState("minecraft:" + material);
}
private static final class KeyedBlockState implements PlatformBlockState {
private static final class KeyedBlockState implements NativeBlockState {
private final String key;
private KeyedBlockState(String key) {
@@ -163,7 +163,7 @@ public class IrisDepositModifierOrderingTest {
}
@Override
public PlatformBlockState placementBaseState() {
public NativeBlockState placementBaseState() {
return null;
}
@@ -238,12 +238,12 @@ public class IrisDepositModifierOrderingTest {
}
@Override
public boolean canPlaceOnto(PlatformBlockState onto) {
public boolean canPlaceOnto(NativeBlockState onto) {
return false;
}
@Override
public boolean matches(PlatformBlockState state) {
public boolean matches(NativeBlockState state) {
return false;
}
@@ -258,7 +258,7 @@ public class IrisDepositModifierOrderingTest {
}
@Override
public PlatformBlockState withProperty(String name, String value) {
public NativeBlockState withProperty(String name, String value) {
return null;
}
@@ -276,11 +276,11 @@ public class IrisDepositModifierOrderingTest {
private final CountDownLatch regionReady = new CountDownLatch(1);
private final Engine engine = mock(Engine.class, RETURNS_DEEP_STUBS);
private final ChunkContext context = mock(ChunkContext.class, RETURNS_DEEP_STUBS);
private final PlatformBlockState stone = state("stone");
private final PlatformBlockState granite = state("granite");
private final PlatformBlockState diorite = state("diorite");
private final PlatformBlockState diamond = state("diamond_ore");
private final Hunk<PlatformBlockState> output = Hunk.newArrayHunk(16, 16, 16);
private final NativeBlockState stone = state("stone");
private final NativeBlockState granite = state("granite");
private final NativeBlockState diorite = state("diorite");
private final NativeBlockState diamond = state("diamond_ore");
private final Hunk<NativeBlockState> output = Hunk.newArrayHunk(16, 16, 16);
private final MantleChunk<Matter> chunk;
private final boolean parallel;
private final int attempts;
@@ -316,7 +316,7 @@ public class IrisDepositModifierOrderingTest {
}
}
private IrisDepositGenerator generator(String name, PlatformBlockState requiredHost, PlatformBlockState replacement) {
private IrisDepositGenerator generator(String name, NativeBlockState requiredHost, NativeBlockState replacement) {
IrisDepositGenerator generator = mock(IrisDepositGenerator.class);
when(generator.getSpawnChance()).thenReturn(1D);
when(generator.getPerClumpSpawnChance()).thenReturn(1D);
@@ -13,7 +13,7 @@ import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.generation.block.B;
@@ -51,7 +51,7 @@ public class IrisDepositModifierParityTest {
@ClassRule
public static final PlatformLeakGuard PLATFORM_GUARD = PlatformLeakGuard.clean();
private final Map<String, PlatformBlockState> states = new HashMap<>();
private final Map<String, NativeBlockState> states = new HashMap<>();
@Before
public void bindPlatform() {
@@ -137,7 +137,7 @@ public class IrisDepositModifierParityTest {
int y = invocation.getArgument(1);
return x == 4 && y % 7 == 0 ? cavern : null;
});
Hunk<PlatformBlockState> terrain = Hunk.newArrayHunk(16, 48, 16);
Hunk<NativeBlockState> terrain = Hunk.newArrayHunk(16, 48, 16);
for (int y = 0; y < 48; y++) {
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
@@ -153,8 +153,8 @@ public class IrisDepositModifierParityTest {
blocks.when(() -> B.getStateOrNull(anyString(), anyBoolean()))
.thenAnswer(invocation -> state(invocation.getArgument(0)));
blocks.when(() -> B.toDeepSlateOre(any(), any())).thenAnswer(invocation -> {
PlatformBlockState host = invocation.getArgument(0);
PlatformBlockState ore = invocation.getArgument(1);
NativeBlockState host = invocation.getArgument(0);
NativeBlockState ore = invocation.getArgument(1);
return host.isDeepSlate() && ore.isOre()
? state("deepslate_" + ore.key().substring(10)) : ore;
});
@@ -166,7 +166,7 @@ public class IrisDepositModifierParityTest {
for (int y = 0; y < 48; y++) {
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
PlatformBlockState block = terrain.get(x, y, z);
NativeBlockState block = terrain.get(x, y, z);
result[0] = (result[0] ^ block.key().hashCode()) * 0x100000001b3L;
if (block.key().endsWith("granite")) {
result[1]++;
@@ -202,12 +202,12 @@ public class IrisDepositModifierParityTest {
.setReplaceableBlocks(new KList<>(hosts));
}
private PlatformBlockState state(String block) {
private NativeBlockState state(String block) {
String key = block.contains(":") ? block : "minecraft:" + block;
return states.computeIfAbsent(key, KeyedBlockState::new);
}
private static final class KeyedBlockState implements PlatformBlockState {
private static final class KeyedBlockState implements NativeBlockState {
private final String key;
private final boolean ore;
private final boolean deepSlate;
@@ -261,7 +261,7 @@ public class IrisDepositModifierParityTest {
}
@Override
public PlatformBlockState placementBaseState() {
public NativeBlockState placementBaseState() {
return null;
}
@@ -336,12 +336,12 @@ public class IrisDepositModifierParityTest {
}
@Override
public boolean canPlaceOnto(PlatformBlockState onto) {
public boolean canPlaceOnto(NativeBlockState onto) {
return false;
}
@Override
public boolean matches(PlatformBlockState state) {
public boolean matches(NativeBlockState state) {
return false;
}
@@ -356,7 +356,7 @@ public class IrisDepositModifierParityTest {
}
@Override
public PlatformBlockState withProperty(String name, String value) {
public NativeBlockState withProperty(String name, String value) {
return null;
}
@@ -367,14 +367,14 @@ public class IrisDepositModifierParityTest {
}
private static final class PaletteGenerator extends IrisDepositGenerator {
private final KList<PlatformBlockState> blocks;
private final KList<NativeBlockState> blocks;
private PaletteGenerator(PlatformBlockState block) {
private PaletteGenerator(NativeBlockState block) {
blocks = new KList<>(block);
}
@Override
public KList<PlatformBlockState> getBlockData(IrisData data) {
public KList<NativeBlockState> getBlockData(IrisData data) {
return blocks;
}
}
@@ -3,7 +3,7 @@ package art.arcane.iris.generation.stage;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveAction;
import art.arcane.iris.generation.mantle.TerrainMatterView;
@@ -40,12 +40,12 @@ public class IrisDimensionStackActuatorMetadataTest {
@Before
public void bindPlatform() {
IrisPlatforms.unbind();
Map<String, PlatformBlockState> states = new HashMap<>();
Map<String, NativeBlockState> states = new HashMap<>();
PlatformRegistries registries = mock(PlatformRegistries.class);
when(registries.block(anyString())).thenAnswer(invocation -> states.computeIfAbsent(
invocation.getArgument(0),
key -> {
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(key);
return state;
}));
@@ -9,7 +9,7 @@ import art.arcane.iris.generation.mantle.EngineMantle;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.iris.generation.decoration.IrisDecorationPart;
import art.arcane.iris.generation.decoration.IrisDecorator;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import art.arcane.iris.generation.block.B;
import art.arcane.volmlib.util.mantle.runtime.Mantle;
@@ -69,7 +69,7 @@ public class IrisNaturalCaveScanTest {
public void listenerFailureReleasesMantleChunk() throws Exception {
Fixture fixture = new Fixture();
IllegalStateException failure = new IllegalStateException("listener rejected decoration");
Hunk<PlatformBlockState> output = fixture.output(3, 2).listen((x, y, z, state) -> {
Hunk<NativeBlockState> output = fixture.output(3, 2).listen((x, y, z, state) -> {
throw failure;
});
assertSame(failure, assertThrows(IllegalStateException.class,
@@ -81,7 +81,7 @@ public class IrisNaturalCaveScanTest {
@SuppressWarnings("unchecked")
public void dimensionFailureReleasesMantleChunk() throws Exception {
Fixture fixture = new Fixture();
Hunk<PlatformBlockState> output = mock(Hunk.class);
Hunk<NativeBlockState> output = mock(Hunk.class);
doReturn(3).when(output).getWidth();
doReturn(2).when(output).getDepth();
IllegalStateException failure = new IllegalStateException("height unavailable");
@@ -93,7 +93,7 @@ public class IrisNaturalCaveScanTest {
private static void verifyScan(int width, int depth) throws Exception {
Fixture fixture = new Fixture();
Hunk<PlatformBlockState> output = fixture.output(width, depth);
Hunk<NativeBlockState> output = fixture.output(width, depth);
List<String> writes = new ArrayList<>();
fixture.modifier.decorateNaturalCaves(-32, 48,
output.listen((x, y, z, state) -> writes.add(x + ":" + y + ":" + z + ":" + state.key())));
@@ -124,7 +124,7 @@ public class IrisNaturalCaveScanTest {
}
}
for (int y = 0; y < 32; y++) {
PlatformBlockState expected = initialState(fixture, y);
NativeBlockState expected = initialState(fixture, y);
if (y == 2 || y == 20) {
expected = fixture.floor;
} else if (y == 5 || y == 22) {
@@ -146,13 +146,13 @@ public class IrisNaturalCaveScanTest {
verify(fixture.chunk).release();
}
private static PlatformBlockState initialState(Fixture fixture, int y) {
private static NativeBlockState initialState(Fixture fixture, int y) {
return y >= 2 && y <= 5 || y == 10 || y >= 14 && y <= 17 || y >= 28
? fixture.air : fixture.stone;
}
private static PlatformBlockState block(String key, boolean solid) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState block(String key, boolean solid) {
NativeBlockState state = mock(NativeBlockState.class);
doReturn(key).when(state).key();
doReturn(key).when(state).materialKey();
doReturn(solid).when(state).isSolid();
@@ -160,10 +160,10 @@ public class IrisNaturalCaveScanTest {
}
private static final class Fixture {
private final PlatformBlockState air = block("minecraft:cave_air", false);
private final PlatformBlockState stone = block("minecraft:stone", true);
private final PlatformBlockState floor = block("minecraft:moss_block", true);
private final PlatformBlockState ceiling = block("minecraft:calcite", true);
private final NativeBlockState air = block("minecraft:cave_air", false);
private final NativeBlockState stone = block("minecraft:stone", true);
private final NativeBlockState floor = block("minecraft:moss_block", true);
private final NativeBlockState ceiling = block("minecraft:calcite", true);
private final IrisCarveModifier modifier = mock(IrisCarveModifier.class, CALLS_REAL_METHODS);
private final MantleChunk<Matter> chunk;
private final List<String> calls = new ArrayList<>();
@@ -203,7 +203,7 @@ public class IrisNaturalCaveScanTest {
int x = call.getArgument(0);
int z = call.getArgument(1);
int y = call.getArgument(11);
Hunk<PlatformBlockState> output = call.getArgument(8);
Hunk<NativeBlockState> output = call.getArgument(8);
calls.add("floor:" + x + ":" + z + ":" + y + ":" + call.getArgument(12));
output.setRaw(x, y + 1, z, floor);
if (y == 1) {
@@ -218,15 +218,15 @@ public class IrisNaturalCaveScanTest {
int x = call.getArgument(0);
int z = call.getArgument(1);
int y = call.getArgument(11);
Hunk<PlatformBlockState> output = call.getArgument(8);
Hunk<NativeBlockState> output = call.getArgument(8);
calls.add("ceiling:" + x + ":" + z + ":" + y + ":" + call.getArgument(12));
output.setRaw(x, y, z, ceiling);
return null;
}).when(roof).decorate(anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), any(), eq(biome), any(), anyInt(), anyInt());
}
private Hunk<PlatformBlockState> output(int width, int depth) {
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(width, 32, depth);
private Hunk<NativeBlockState> output(int width, int depth) {
Hunk<NativeBlockState> output = Hunk.newArrayHunk(width, 32, depth);
for (int x = 0; x < width; x++) {
for (int z = 0; z < depth; z++) {
for (int y = 0; y < 32; y++) {
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.stage;
import art.arcane.iris.generation.decoration.IrisSpeleothems;
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.hunk.Hunk;
import org.bukkit.block.BlockSupport;
import org.bukkit.block.data.BlockData;
@@ -34,7 +34,7 @@ public class IrisPerfectionModifierSpeleothemTest {
}
int supportY = upward ? 1 : 5;
PlatformBlockState pool = fluid.equals("minecraft:water") ? fixture.water : fluid(fluid);
NativeBlockState pool = fluid.equals("minecraft:water") ? fixture.water : fluid(fluid);
fixture.output.set(0, supportY, 0, pool);
fixture.normalize();
@@ -101,15 +101,15 @@ public class IrisPerfectionModifierSpeleothemTest {
}
}
private static PlatformBlockState spike(String material, boolean upward, String thickness, boolean waterlogged) {
private static NativeBlockState spike(String material, boolean upward, String thickness, boolean waterlogged) {
return spike(material, Map.of(
"vertical_direction", upward ? "up" : "down",
"thickness", thickness,
"waterlogged", Boolean.toString(waterlogged)));
}
private static PlatformBlockState spike(String material, Map<String, String> properties) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState spike(String material, Map<String, String> properties) {
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(material + "[thickness=" + properties.get("thickness")
+ ",vertical_direction=" + properties.get("vertical_direction")
+ ",waterlogged=" + properties.get("waterlogged") + "]");
@@ -122,8 +122,8 @@ public class IrisPerfectionModifierSpeleothemTest {
return state;
}
private static PlatformBlockState sturdyState() {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState sturdyState() {
NativeBlockState state = mock(NativeBlockState.class);
BlockData nativeState = mock(BlockData.class);
when(state.key()).thenReturn("minecraft:sulfur");
when(state.nativeHandle()).thenReturn(nativeState);
@@ -131,8 +131,8 @@ public class IrisPerfectionModifierSpeleothemTest {
return state;
}
private static PlatformBlockState fluid(String material) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState fluid(String material) {
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(material);
when(state.isFluid()).thenReturn(true);
when(state.isWater()).thenReturn(material.equals("minecraft:water"));
@@ -140,9 +140,9 @@ public class IrisPerfectionModifierSpeleothemTest {
}
private static class Fixture {
private final PlatformBlockState air = mock(PlatformBlockState.class);
private final PlatformBlockState water = fluid("minecraft:water");
private final Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 9, 1);
private final NativeBlockState air = mock(NativeBlockState.class);
private final NativeBlockState water = fluid("minecraft:water");
private final Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 9, 1);
private Fixture() {
when(air.key()).thenReturn("minecraft:air");
@@ -161,7 +161,7 @@ public class IrisPerfectionModifierSpeleothemTest {
private void normalize() {
for (int y = output.getHeight() - 1; y >= 0; y--) {
PlatformBlockState state = output.get(0, y, 0);
NativeBlockState state = output.get(0, y, 0);
if (IrisSpeleothems.isSpike(state)) {
IrisPerfectionModifier.normalizeSpike(state, output, 0, 0, y, air, water);
}
@@ -26,7 +26,7 @@ import art.arcane.iris.generation.context.ChunkedDataCache;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.runtime.IrisComplex;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.hunk.Hunk;
import art.arcane.volmlib.util.math.RNG;
@@ -53,9 +53,9 @@ public class IrisPostModifierWallShoreTest {
private static final int PLANE_WIDTH = 3;
private static final int SURFACE = 64;
private static final int HUNK_HEIGHT = 80;
private static final PlatformBlockState GROUND = state("minecraft:sand");
private static final PlatformBlockState WALL = state("minecraft:stone");
private static final PlatformBlockState AIR = state("minecraft:air");
private static final NativeBlockState GROUND = state("minecraft:sand");
private static final NativeBlockState WALL = state("minecraft:stone");
private static final NativeBlockState AIR = state("minecraft:air");
@Test
public void shoreColumnsKeepTheirSurfaceBlockBesideASeawardDrop() throws ReflectiveOperationException {
@@ -78,8 +78,8 @@ public class IrisPostModifierWallShoreTest {
* whether the wall patcher fires, and building it through onModify would need a live mantle.
*/
@SuppressWarnings("unchecked")
private PlatformBlockState surfaceAfterPost(boolean shore, boolean walls, boolean river) throws ReflectiveOperationException {
Hunk<PlatformBlockState> data = Hunk.newHunk(1, HUNK_HEIGHT, 1);
private NativeBlockState surfaceAfterPost(boolean shore, boolean walls, boolean river) throws ReflectiveOperationException {
Hunk<NativeBlockState> data = Hunk.newHunk(1, HUNK_HEIGHT, 1);
for (int y = 0; y < HUNK_HEIGHT; y++) {
data.set(0, y, 0, y <= SURFACE ? GROUND : AIR);
@@ -129,8 +129,8 @@ public class IrisPostModifierWallShoreTest {
return data.get(0, SURFACE, 0);
}
private static PlatformBlockState state(String key) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState state(String key) {
NativeBlockState state = mock(NativeBlockState.class);
doReturn(key).when(state).key();
doReturn(key).when(state).materialKey();
return state;
@@ -17,7 +17,7 @@ import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
import art.arcane.iris.generation.hydrology.IrisRiverMaterialConfig;
import art.arcane.iris.generation.terrain.Terrain3DColumn;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.testsupport.PlatformBinding;
import art.arcane.iris.generation.context.ChunkContext;
import art.arcane.iris.generation.context.ChunkedDataCache;
@@ -54,9 +54,9 @@ public class IrisTerrainNormalActuatorHydrologyTest {
@Test
public void hydrologyOwnedFluidBypassesBiomeSeaLayers() {
PlatformBlockState water = mock(PlatformBlockState.class);
PlatformBlockState ice = mock(PlatformBlockState.class);
KList<PlatformBlockState> seaLayers = new KList<>();
NativeBlockState water = mock(NativeBlockState.class);
NativeBlockState ice = mock(NativeBlockState.class);
KList<NativeBlockState> seaLayers = new KList<>();
seaLayers.add(ice);
assertSame(water, HydrologyFluidLayerSelector.select(seaLayers, 0, water, true));
@@ -66,12 +66,12 @@ public class IrisTerrainNormalActuatorHydrologyTest {
@Test
public void frozenTerrainPublishesSourceWaterBeforeStandardTopLayerFreezing() {
PlatformBlockState water = mock(PlatformBlockState.class);
PlatformBlockState ice = mock(PlatformBlockState.class);
NativeBlockState water = mock(NativeBlockState.class);
NativeBlockState ice = mock(NativeBlockState.class);
when(water.key()).thenReturn("minecraft:water");
when(water.isWater()).thenReturn(true);
when(ice.key()).thenReturn("minecraft:ice");
KList<PlatformBlockState> frozenSeaLayers = new KList<>();
KList<NativeBlockState> frozenSeaLayers = new KList<>();
frozenSeaLayers.add(ice);
HydrologyFeatureRef feature = new HydrologyFeatureRef(
11L,
@@ -118,7 +118,7 @@ public class IrisTerrainNormalActuatorHydrologyTest {
boolean hydrologyOwned = acceptedColumn.primarySurfaceFluidLayer().isPresent();
ArrayList<String> stages = new ArrayList<>();
PlatformBlockState state = HydrologyFluidLayerSelector.select(
NativeBlockState state = HydrologyFluidLayerSelector.select(
frozenSeaLayers,
0,
water,
@@ -232,9 +232,9 @@ public class IrisTerrainNormalActuatorHydrologyTest {
IrisBiome biome = mock(IrisBiome.class);
IrisRegion region = new IrisRegion();
ChunkContext context = mock(ChunkContext.class);
PlatformBlockState rock = mock(PlatformBlockState.class);
PlatformBlockState grass = mock(PlatformBlockState.class);
PlatformBlockState painted = mock(PlatformBlockState.class);
NativeBlockState rock = mock(NativeBlockState.class);
NativeBlockState grass = mock(NativeBlockState.class);
NativeBlockState painted = mock(NativeBlockState.class);
when(rock.key()).thenReturn("minecraft:stone");
when(grass.key()).thenReturn("minecraft:grass_block");
when(painted.key()).thenReturn("minecraft:dirt");
@@ -261,7 +261,7 @@ public class IrisTerrainNormalActuatorHydrologyTest {
ProceduralStream.of((x, z) -> rock, Interpolated.of(value -> 0D, value -> rock)), 11, -4, false));
when(biome.generateLayers(eq(dimension), anyDouble(), anyDouble(), any(RNG.class),
anyInt(), anyInt(), eq(data), eq(complex))).thenReturn(new KList<>(List.of(grass)));
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 64, 1);
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 64, 1);
new IrisTerrainNormalActuator(engine).terrainSliver(11, -4, 0, output, context);
@@ -361,8 +361,8 @@ public class IrisTerrainNormalActuatorHydrologyTest {
}
private static final class Fixture {
private final PlatformBlockState biomeLayer = mock(PlatformBlockState.class);
private final PlatformBlockState painted = mock(PlatformBlockState.class);
private final NativeBlockState biomeLayer = mock(NativeBlockState.class);
private final NativeBlockState painted = mock(NativeBlockState.class);
private final IrisMaterialPalette palette = mock(IrisMaterialPalette.class);
private final IrisData data = mock(IrisData.class);
private final RNG rng = new RNG(7L);
@@ -379,7 +379,7 @@ public class IrisTerrainNormalActuatorHydrologyTest {
return new IrisRiverMaterialConfig().setPalette(palette).setDepth(4);
}
private PlatformBlockState paint(IrisRiverMaterialConfig material, int depth) {
private NativeBlockState paint(IrisRiverMaterialConfig material, int depth) {
return IrisTerrainNormalActuator.paintHydrologyMaterial(
biomeLayer, material, depth, rng, 11, 63, -4, data);
}
@@ -16,7 +16,7 @@ import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.generation.terrain.IrisRegion;
import art.arcane.iris.generation.terrain.Terrain3DColumn;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.testsupport.PlatformBinding;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.hunk.Hunk;
@@ -45,7 +45,7 @@ public class IrisTerrainNormalActuatorStrataCutTest {
public void exposedBankCutDeeperThanThePaletteShowsTheDeepestAuthoredLayer() {
Fixture fixture = new Fixture();
Hunk<PlatformBlockState> output = fixture.actuate();
Hunk<NativeBlockState> output = fixture.actuate();
assertBlock(fixture.dirt, output.get(0, 40, 0));
assertBlock(fixture.dirt, output.get(0, 39, 0));
@@ -55,7 +55,7 @@ public class IrisTerrainNormalActuatorStrataCutTest {
public void exposedBankBelowTheAuthoredSoilStillFallsThroughToRock() {
Fixture fixture = new Fixture();
Hunk<PlatformBlockState> output = fixture.actuate();
Hunk<NativeBlockState> output = fixture.actuate();
assertBlock(fixture.rock, output.get(0, 38, 0));
}
@@ -64,7 +64,7 @@ public class IrisTerrainNormalActuatorStrataCutTest {
public void uncutColumnsKeepTheirExactPaletteDepths() {
Fixture fixture = new Fixture();
Hunk<PlatformBlockState> output = fixture.actuate();
Hunk<NativeBlockState> output = fixture.actuate();
assertBlock(fixture.grass, output.get(0, 60, 0));
assertBlock(fixture.dirt, output.get(0, 59, 0));
@@ -98,7 +98,7 @@ public class IrisTerrainNormalActuatorStrataCutTest {
}
}
private static void assertBlock(PlatformBlockState expected, PlatformBlockState actual) {
private static void assertBlock(NativeBlockState expected, NativeBlockState actual) {
assertEquals(expected.key(), actual == null ? null : actual.key());
assertSame(expected, actual);
}
@@ -108,9 +108,9 @@ public class IrisTerrainNormalActuatorStrataCutTest {
* erosion, over a two block soil palette.
*/
private static final class Fixture {
private final PlatformBlockState rock = mock(PlatformBlockState.class);
private final PlatformBlockState grass = mock(PlatformBlockState.class);
private final PlatformBlockState dirt = mock(PlatformBlockState.class);
private final NativeBlockState rock = mock(NativeBlockState.class);
private final NativeBlockState grass = mock(NativeBlockState.class);
private final NativeBlockState dirt = mock(NativeBlockState.class);
private final Engine engine = mock(Engine.class);
private final ChunkContext context = mock(ChunkContext.class);
@@ -161,8 +161,8 @@ public class IrisTerrainNormalActuatorStrataCutTest {
anyInt(), anyInt(), eq(data), eq(complex))).thenReturn(new KList<>());
}
private Hunk<PlatformBlockState> actuate() {
Hunk<PlatformBlockState> output = Hunk.newArrayHunk(1, 64, 1);
private Hunk<NativeBlockState> actuate() {
Hunk<NativeBlockState> output = Hunk.newArrayHunk(1, 64, 1);
new IrisTerrainNormalActuator(engine).terrainSliver(11, -4, 0, output, context);
return output;
}
@@ -9,8 +9,8 @@ import art.arcane.iris.world.history.SavedTerrainChunk;
import art.arcane.iris.world.history.TransitionGenerationPlan;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.generation.context.ChunkContext;
@@ -38,8 +38,8 @@ public class IrisTransitionGeometryActuatorTest {
private IrisPlatform previous;
private PlatformRegistries registries;
private PlatformBlockState stone;
private PlatformBlockState air;
private NativeBlockState stone;
private NativeBlockState air;
@Before
public void bind() {
@@ -67,15 +67,15 @@ public class IrisTransitionGeometryActuatorTest {
@Test
public void boundaryReceiptRetainsCustomKeyAndCarrierPhysics() throws Exception {
String key = "itemsadder:rocks/ruby_ore";
PlatformBlockState carrier = state("minecraft:oak_slab[type=bottom,waterlogged=true]", false);
NativeBlockState carrier = state("minecraft:oak_slab[type=bottom,waterlogged=true]", false);
when(carrier.isWaterLogged()).thenReturn(true);
PlatformBlockState custom = state(key, false);
NativeBlockState custom = state(key, false);
when(custom.isCustom()).thenReturn(true);
when(custom.placementBaseState()).thenReturn(carrier);
Hunk<PlatformBlockState> blocks = filled();
Hunk<NativeBlockState> blocks = filled();
blocks.setRaw(0, 3, 0, custom);
Hunk<PlatformBiome> biomes = Hunk.newArrayHunk(16, 16, 16);
PlatformBiome biome = mock(PlatformBiome.class);
Hunk<NativeBiome> biomes = Hunk.newArrayHunk(16, 16, 16);
NativeBiome biome = mock(NativeBiome.class);
when(biome.key()).thenReturn("minecraft:plains");
biomes.fill(biome);
ChunkContext context = mock(ChunkContext.class);
@@ -94,7 +94,7 @@ public class IrisTransitionGeometryActuatorTest {
@Test
public void appliesCaveAndIslandGeometryThenUpdatesDecorationHeight() {
Hunk<PlatformBlockState> blocks = filled();
Hunk<NativeBlockState> blocks = filled();
ChunkContext context = context("minecraft:stone");
Engine engine = mock(Engine.class);
@@ -113,8 +113,8 @@ public class IrisTransitionGeometryActuatorTest {
public void refusesUnresolvableRetainedMaterialInsteadOfReplacingItWithAir() {
Engine engine = mock(Engine.class);
ChunkContext context = context("removed:stone");
Hunk<PlatformBlockState> blocks = filled();
Hunk<PlatformBiome> biomes = Hunk.newArrayHunk(16, 16, 16);
Hunk<NativeBlockState> blocks = filled();
Hunk<NativeBiome> biomes = Hunk.newArrayHunk(16, 16, 16);
assertThrows(IllegalStateException.class, () -> new IrisTransitionGeometryActuator(engine)
.generate(16, 0, blocks, biomes, false, context));
@@ -142,8 +142,8 @@ public class IrisTransitionGeometryActuatorTest {
return context;
}
private Hunk<PlatformBlockState> filled() {
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(16, 16, 16);
private Hunk<NativeBlockState> filled() {
Hunk<NativeBlockState> blocks = Hunk.newArrayHunk(16, 16, 16);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 0; y < 16; y++) {
@@ -154,8 +154,8 @@ public class IrisTransitionGeometryActuatorTest {
return blocks;
}
private static PlatformBlockState state(String key, boolean isAir) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState state(String key, boolean isAir) {
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(key);
when(state.isAir()).thenReturn(isAir);
when(state.isSolid()).thenReturn(!isAir);
@@ -3,8 +3,8 @@ package art.arcane.iris.generation.validation;
import art.arcane.iris.configuration.IrisSettings;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.terrain.IrisDimension;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -30,10 +30,10 @@ public class GoldenHashEngineTest {
private IrisSettings previousSettings;
private File goldenDir;
private Engine engine;
private PlatformBlockState stone;
private PlatformBlockState dirt;
private PlatformBiome plains;
private PlatformBiome forest;
private NativeBlockState stone;
private NativeBlockState dirt;
private NativeBiome plains;
private NativeBiome forest;
@Before
public void setUp() throws Exception {
@@ -44,13 +44,13 @@ public class GoldenHashEngineTest {
IrisDimension dimension = mock(IrisDimension.class);
when(dimension.getLoadKey()).thenReturn("testdim");
when(engine.getDimension()).thenReturn(dimension);
stone = mock(PlatformBlockState.class);
stone = mock(NativeBlockState.class);
when(stone.key()).thenReturn("minecraft:stone");
dirt = mock(PlatformBlockState.class);
dirt = mock(NativeBlockState.class);
when(dirt.key()).thenReturn("minecraft:dirt");
plains = mock(PlatformBiome.class);
plains = mock(NativeBiome.class);
when(plains.key()).thenReturn("minecraft:plains");
forest = mock(PlatformBiome.class);
forest = mock(NativeBiome.class);
when(forest.key()).thenReturn("minecraft:forest");
}
@@ -161,11 +161,11 @@ public class GoldenHashEngineTest {
};
}
private GoldenHashEngine.ChunkSource source(PlatformBlockState special, int sx, int sy, int sz) {
private GoldenHashEngine.ChunkSource source(NativeBlockState special, int sx, int sy, int sz) {
return source(special, sx, sy, sz, plains);
}
private GoldenHashEngine.ChunkSource source(PlatformBlockState special, int sx, int sy, int sz, PlatformBiome biome) {
private GoldenHashEngine.ChunkSource source(NativeBlockState special, int sx, int sy, int sz, NativeBiome biome) {
return (int chunkX, int chunkZ) -> new GoldenHashEngine.ChunkSnapshot() {
@Override
public int minY() {
@@ -178,12 +178,12 @@ public class GoldenHashEngineTest {
}
@Override
public PlatformBlockState block(int x, int y, int z) {
public NativeBlockState block(int x, int y, int z) {
return x == sx && y == sy && z == sz ? special : stone;
}
@Override
public PlatformBiome biome(int x, int y, int z) {
public NativeBiome biome(int x, int y, int z) {
return biome;
}
};
@@ -1,8 +1,8 @@
package art.arcane.iris.integration;
import art.arcane.iris.integration.data.DataType;
import art.arcane.iris.platform.bukkit.nms.container.BlockProperty;
import art.arcane.iris.platform.bukkit.nms.container.Pair;
import art.arcane.volmlib.nativelib.terrain.BlockProperty;
import art.arcane.volmlib.util.collection.Pair;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.block.IrisCustomData;
import art.arcane.volmlib.util.collection.KMap;
@@ -2,12 +2,12 @@ package art.arcane.iris.pack;
import art.arcane.iris.pack.ContentKeyValidator.ContentKeyError;
import art.arcane.iris.pack.ContentKeyValidator.ContentRegistry;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.iris.spi.PlatformBlockProperty;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.spi.PlatformEntityType;
import art.arcane.iris.spi.PlatformItem;
import art.arcane.iris.spi.PlatformNumericRange;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBlockProperty;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.nativelib.entity.NativeEntityType;
import art.arcane.volmlib.nativelib.item.NativeItem;
import art.arcane.volmlib.nativelib.terrain.NativeNumericRange;
import art.arcane.iris.spi.PlatformRegistries;
import org.junit.Test;
@@ -37,14 +37,14 @@ public class ContentKeyValidatorTest {
List.of(),
Map.of(
"minecraft:oak_log", List.of(
new PlatformBlockProperty("axis", "string", "y", List.of("x", "y", "z"), null),
new PlatformBlockProperty("waterlogged", "boolean", false, List.of(true, false), null)),
new NativeBlockProperty("axis", "string", "y", List.of("x", "y", "z"), null),
new NativeBlockProperty("waterlogged", "boolean", false, List.of(true, false), null)),
// The Bukkit shape for a numeric property: no enumerable values, bounds instead. Modded
// enumerates 0..15 into allowedValues, so both must be validated the same way.
"minecraft:water", List.of(
new PlatformBlockProperty("level", "integer", 0, List.of(),
new PlatformNumericRange(0, 15, false, false)),
new PlatformBlockProperty("custom", "string", "a", List.of(), null)),
new NativeBlockProperty("level", "integer", 0, List.of(),
new NativeNumericRange(0, 15, false, false)),
new NativeBlockProperty("custom", "string", "a", List.of(), null)),
"create:cogwheel", List.of()));
}
@@ -240,44 +240,44 @@ public class ContentKeyValidatorTest {
}
private record FakeRegistries(List<String> blocks, List<String> items, List<String> entities,
Map<String, List<PlatformBlockProperty>> properties) implements PlatformRegistries {
Map<String, List<NativeBlockProperty>> properties) implements PlatformRegistries {
@Override
public PlatformBlockState block(String key) {
public NativeBlockState block(String key) {
return null;
}
@Override
public PlatformBlockState blockOrNull(String key) {
public NativeBlockState blockOrNull(String key) {
return null;
}
@Override
public PlatformBlockState blockOrNull(String key, boolean warn) {
public NativeBlockState blockOrNull(String key, boolean warn) {
return null;
}
@Override
public PlatformBlockState air() {
public NativeBlockState air() {
return null;
}
@Override
public PlatformBlockState deepSlateOre(PlatformBlockState block, PlatformBlockState ore) {
public NativeBlockState deepSlateOre(NativeBlockState block, NativeBlockState ore) {
return null;
}
@Override
public PlatformBiome biome(String key) {
public NativeBiome biome(String key) {
return null;
}
@Override
public PlatformItem item(String key) {
public NativeItem item(String key) {
return null;
}
@Override
public PlatformEntityType entity(String key) {
public NativeEntityType entity(String key) {
return null;
}
@@ -327,7 +327,7 @@ public class ContentKeyValidatorTest {
}
@Override
public Map<String, List<PlatformBlockProperty>> blockStateProperties() {
public Map<String, List<NativeBlockProperty>> blockStateProperties() {
return properties;
}
}
@@ -1,6 +1,6 @@
package art.arcane.iris.pack;
import art.arcane.iris.platform.bukkit.nms.datapack.DataVersion;
import art.arcane.iris.pack.datapack.DataVersion;
import art.arcane.iris.world.lifecycle.BukkitStartupPaths;
import art.arcane.iris.world.history.GenerationRegistryContractFactory;
@@ -2,7 +2,7 @@ package art.arcane.iris.pack;
import art.arcane.iris.generation.terrain.IrisDimensionType;
import art.arcane.iris.generation.terrain.IrisDimensionTypeOptions;
import art.arcane.iris.platform.bukkit.nms.datapack.IDataFixer;
import art.arcane.iris.pack.datapack.IDataFixer;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -3,7 +3,7 @@ package art.arcane.iris.pack;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformStructureHooks;
import art.arcane.iris.spi.PlatformStructureHooks.JigsawSourceMetadata;
import art.arcane.volmlib.nativelib.terrain.JigsawSourceMetadata;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import org.junit.ClassRule;
import org.junit.Rule;
@@ -1,4 +1,4 @@
package art.arcane.iris.platform.bukkit.nms.datapack;
package art.arcane.iris.pack.datapack;
import org.junit.Test;
@@ -5,8 +5,8 @@ import art.arcane.iris.world.WorldSlotKey;
import art.arcane.iris.world.lifecycle.BukkitWorldConfiguration.IrisGeneratorBinding;
import art.arcane.iris.world.lifecycle.BukkitStartupPaths;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.platform.bukkit.nms.datapack.DataVersion;
import art.arcane.iris.platform.bukkit.nms.datapack.v1217.DataFixerV1217;
import art.arcane.iris.pack.datapack.DataVersion;
import art.arcane.iris.pack.datapack.v1217.DataFixerV1217;
import art.arcane.iris.pack.DefaultPackBootstrapProvisioner;
import art.arcane.iris.world.history.GenerationEpochContractFactory;
import art.arcane.iris.world.history.GenerationHistory;
@@ -96,7 +96,7 @@ public class ServerConfiguratorRegistryVerificationTest {
INMSBinding binding = mock(INMSBinding.class);
when(binding.supportsDataPacks()).thenReturn(true);
when(binding.getCustomBiomeBaseFor("overworld:missing")).thenReturn(null);
when(binding.hasBiome("overworld:missing")).thenReturn(false);
when(binding.missingDimensionTypes("iris:overworld")).thenReturn(true);
return new VerificationFixture(data, dimension, binding);
}
@@ -1,6 +1,6 @@
package art.arcane.iris.platform.bukkit.nms.datapack.v1217;
package art.arcane.iris.pack.datapack.v1217;
import art.arcane.iris.platform.bukkit.nms.datapack.IDataFixer.Dimension;
import art.arcane.iris.pack.datapack.IDataFixer.Dimension;
import art.arcane.volmlib.util.json.JSONObject;
import org.junit.Test;
@@ -1,4 +1,4 @@
package art.arcane.iris.platform.bukkit.nms.datapack.v1217;
package art.arcane.iris.pack.datapack.v1217;
import art.arcane.iris.generation.biome.IrisBiomeCustom;
import art.arcane.iris.generation.biome.IrisBiomeCustomParticle;
@@ -1,6 +1,6 @@
package art.arcane.iris.platform.bukkit.nms.datapack.v1217;
package art.arcane.iris.pack.datapack.v1217;
import art.arcane.iris.platform.bukkit.nms.datapack.IDataFixer.Dimension;
import art.arcane.iris.pack.datapack.IDataFixer.Dimension;
import art.arcane.iris.generation.terrain.IrisDimensionTypeOptions;
import art.arcane.volmlib.util.json.JSONObject;
import org.junit.Test;
@@ -4,7 +4,7 @@ import art.arcane.iris.configuration.IrisSettings;
import art.arcane.iris.generation.runtime.PreservationRegistry;
import art.arcane.iris.generation.noise.IrisGenerator;
import art.arcane.iris.generation.block.B;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.pack.validation.ContentGate;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.testsupport.PlatformLeakGuard;
@@ -121,7 +121,7 @@ public class IrisDataAuthoringCacheTest {
Files.writeString(resource, "{}");
source = IrisData.openRuntime(root.toFile());
try (MockedStatic<B> blocks = mockStatic(B.class)) {
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
when(state.placementBaseState()).thenReturn(state);
when(state.materialKey()).thenReturn("minecraft:stone");
blocks.when(() -> B.getStateOrNull("minecraft:stone", false)).thenReturn(state);
@@ -152,8 +152,8 @@ public class IrisDataAuthoringCacheTest {
""");
source = IrisData.openRuntime(root.toFile());
source.setContentGate(mock(ContentGate.class));
PlatformBlockState custom = mock(PlatformBlockState.class);
PlatformBlockState carrier = mock(PlatformBlockState.class);
NativeBlockState custom = mock(NativeBlockState.class);
NativeBlockState carrier = mock(NativeBlockState.class);
when(custom.materialKey()).thenReturn("rocks:ruby_ore");
when(custom.placementBaseState()).thenReturn(carrier);
when(carrier.materialKey()).thenReturn("minecraft:note_block");
@@ -39,17 +39,17 @@ import art.arcane.iris.structure.nativegen.IrisVanillaStructureAdjustment;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.LogLevel;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.iris.spi.PlatformBiomeWriter;
import art.arcane.iris.spi.PlatformBlockProperty;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.spi.PlatformEntityType;
import art.arcane.iris.spi.PlatformItem;
import art.arcane.iris.spi.PlatformNumericRange;
import art.arcane.volmlib.nativelib.terrain.NativeBlockProperty;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.nativelib.entity.NativeEntityType;
import art.arcane.volmlib.nativelib.item.NativeItem;
import art.arcane.volmlib.nativelib.terrain.NativeNumericRange;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.spi.PlatformScheduler;
import art.arcane.iris.spi.PlatformStructureHooks;
import art.arcane.iris.spi.PlatformWorld;
import art.arcane.volmlib.nativelib.terrain.NativeWorld;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.collection.KMap;
@@ -78,7 +78,7 @@ public class SchemaBuilderIdentityTest {
@ClassRule
public static final PlatformLeakGuard PLATFORM_GUARD = PlatformLeakGuard.clean();
private static final String EXPECTED_SCHEMA_DIGEST = "5f041feb24213ee5b7e2e06c84b113ec0242b8f8e04c73dde6ea2356944d93fd";
private static final String EXPECTED_SCHEMA_DIGEST = "91c36f3cdb0a10a0700b62fb6a6d2456576bd50f75a4d588103acdd42a7763c1";
private static final List<Class<?>> SCHEMA_ROOTS = List.of(
IrisDimension.class,
@@ -202,50 +202,50 @@ public class SchemaBuilderIdentityTest {
}
private static final class FakeRegistries implements PlatformRegistries {
private static final List<PlatformBlockProperty> STONE_PROPERTIES = List.of(
new PlatformBlockProperty("waterlogged", "boolean", Boolean.FALSE, List.of(Boolean.TRUE, Boolean.FALSE), null),
new PlatformBlockProperty("level", "integer", 0, List.of(0, 1, 2),
new PlatformNumericRange(0D, 2D, false, false)));
private static final List<PlatformBlockProperty> LOG_PROPERTIES = List.of(
new PlatformBlockProperty("axis", "string", "y", List.of("x", "y", "z"), null));
private static final List<NativeBlockProperty> STONE_PROPERTIES = List.of(
new NativeBlockProperty("waterlogged", "boolean", Boolean.FALSE, List.of(Boolean.TRUE, Boolean.FALSE), null),
new NativeBlockProperty("level", "integer", 0, List.of(0, 1, 2),
new NativeNumericRange(0D, 2D, false, false)));
private static final List<NativeBlockProperty> LOG_PROPERTIES = List.of(
new NativeBlockProperty("axis", "string", "y", List.of("x", "y", "z"), null));
@Override
public PlatformBlockState block(String key) {
public NativeBlockState block(String key) {
return null;
}
@Override
public PlatformBlockState blockOrNull(String key) {
public NativeBlockState blockOrNull(String key) {
return null;
}
@Override
public PlatformBlockState blockOrNull(String key, boolean warn) {
public NativeBlockState blockOrNull(String key, boolean warn) {
return null;
}
@Override
public PlatformBlockState air() {
public NativeBlockState air() {
return null;
}
@Override
public PlatformBlockState deepSlateOre(PlatformBlockState block, PlatformBlockState ore) {
public NativeBlockState deepSlateOre(NativeBlockState block, NativeBlockState ore) {
return null;
}
@Override
public PlatformBiome biome(String key) {
public NativeBiome biome(String key) {
return null;
}
@Override
public PlatformItem item(String key) {
public NativeItem item(String key) {
return null;
}
@Override
public PlatformEntityType entity(String key) {
public NativeEntityType entity(String key) {
return null;
}
@@ -300,8 +300,8 @@ public class SchemaBuilderIdentityTest {
}
@Override
public Map<String, List<PlatformBlockProperty>> blockStateProperties() {
Map<String, List<PlatformBlockProperty>> properties = new LinkedHashMap<>();
public Map<String, List<NativeBlockProperty>> blockStateProperties() {
Map<String, List<NativeBlockProperty>> properties = new LinkedHashMap<>();
properties.put("minecraft:stone", STONE_PROPERTIES);
properties.put("minecraft:andesite", STONE_PROPERTIES);
properties.put("minecraft:oak_log", LOG_PROPERTIES);
@@ -376,7 +376,7 @@ public class SchemaBuilderIdentityTest {
}
@Override
public boolean spawnEntity(PlatformWorld world, String entityKey, double x, double y, double z) {
public boolean spawnEntity(NativeWorld world, String entityKey, double x, double y, double z) {
return false;
}
@@ -30,7 +30,7 @@ import art.arcane.iris.structure.object.IrisObjectPlacement;
import art.arcane.iris.structure.placement.IrisStructure;
import art.arcane.iris.structure.placement.IrisStructurePlacement;
import art.arcane.iris.structure.placement.IrisStructureTerrain;
import art.arcane.iris.structure.placement.IrisStructureTerrainMode;
import art.arcane.volmlib.util.structure.StructureTerrainMode;
import art.arcane.iris.structure.nativegen.IrisVanillaStructureAdjustment;
import art.arcane.iris.pack.schema.annotation.ArrayType;
import art.arcane.volmlib.util.documentation.Description;
@@ -48,16 +48,16 @@ import art.arcane.iris.pack.schema.annotation.functions.LootTableKeyFunction;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.LogLevel;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.iris.spi.PlatformBiomeWriter;
import art.arcane.iris.spi.PlatformBlockProperty;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.spi.PlatformEntityType;
import art.arcane.iris.spi.PlatformItem;
import art.arcane.volmlib.nativelib.terrain.NativeBlockProperty;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.nativelib.entity.NativeEntityType;
import art.arcane.volmlib.nativelib.item.NativeItem;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.spi.PlatformScheduler;
import art.arcane.iris.spi.PlatformStructureHooks;
import art.arcane.iris.spi.PlatformWorld;
import art.arcane.volmlib.nativelib.terrain.NativeWorld;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.collection.KMap;
@@ -203,7 +203,7 @@ public class SchemaBuilderParityTest {
assertEquals(0, horizontalPadding.getInt("minimum"));
assertEquals(128, horizontalPadding.getInt("maximum"));
IrisStructureTerrain terrainDefaults = new IrisStructureTerrain();
assertEquals(IrisStructureTerrainMode.SOURCE, terrainDefaults.resolvedMode());
assertEquals(StructureTerrainMode.SOURCE, terrainDefaults.resolvedMode());
assertEquals(64, terrainDefaults.getFlattenRange());
assertEquals(0, terrainDefaults.getHorizontalPadding());
assertEquals(List.of("BOX", "ROUNDED", "ERODED"), oneOfValues(
@@ -460,42 +460,42 @@ public class SchemaBuilderParityTest {
private static final class FakeRegistries implements PlatformRegistries {
@Override
public PlatformBlockState block(String key) {
public NativeBlockState block(String key) {
return null;
}
@Override
public PlatformBlockState blockOrNull(String key) {
public NativeBlockState blockOrNull(String key) {
return null;
}
@Override
public PlatformBlockState blockOrNull(String key, boolean warn) {
public NativeBlockState blockOrNull(String key, boolean warn) {
return null;
}
@Override
public PlatformBlockState air() {
public NativeBlockState air() {
return null;
}
@Override
public PlatformBlockState deepSlateOre(PlatformBlockState block, PlatformBlockState ore) {
public NativeBlockState deepSlateOre(NativeBlockState block, NativeBlockState ore) {
return null;
}
@Override
public PlatformBiome biome(String key) {
public NativeBiome biome(String key) {
return null;
}
@Override
public PlatformItem item(String key) {
public NativeItem item(String key) {
return null;
}
@Override
public PlatformEntityType entity(String key) {
public NativeEntityType entity(String key) {
return null;
}
@@ -550,7 +550,7 @@ public class SchemaBuilderParityTest {
}
@Override
public Map<String, List<PlatformBlockProperty>> blockStateProperties() {
public Map<String, List<NativeBlockProperty>> blockStateProperties() {
return Map.of();
}
}
@@ -622,7 +622,7 @@ public class SchemaBuilderParityTest {
}
@Override
public boolean spawnEntity(PlatformWorld world, String entityKey, double x, double y, double z) {
public boolean spawnEntity(NativeWorld world, String entityKey, double x, double y, double z) {
return false;
}
@@ -6,16 +6,16 @@ import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.spi.LogLevel;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import art.arcane.iris.spi.PlatformBiomeWriter;
import art.arcane.iris.spi.PlatformBlockProperty;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.iris.spi.PlatformEntityType;
import art.arcane.iris.spi.PlatformItem;
import art.arcane.volmlib.nativelib.terrain.NativeBlockProperty;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.nativelib.entity.NativeEntityType;
import art.arcane.volmlib.nativelib.item.NativeItem;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.spi.PlatformScheduler;
import art.arcane.iris.spi.PlatformStructureHooks;
import art.arcane.iris.spi.PlatformWorld;
import art.arcane.volmlib.nativelib.terrain.NativeWorld;
import java.io.File;
import java.util.ArrayList;
@@ -81,18 +81,18 @@ final class CompatFixtures {
int blockLookups = 0;
@Override
public PlatformBlockState block(String key) {
PlatformBlockState state = blockOrNull(key, false);
public NativeBlockState block(String key) {
NativeBlockState state = blockOrNull(key, false);
return state == null ? air() : state;
}
@Override
public PlatformBlockState blockOrNull(String key) {
public NativeBlockState blockOrNull(String key) {
return blockOrNull(key, false);
}
@Override
public PlatformBlockState blockOrNull(String key, boolean warn) {
public NativeBlockState blockOrNull(String key, boolean warn) {
blockLookups++;
String normalized = key.trim();
int props = normalized.indexOf('[');
@@ -108,27 +108,27 @@ final class CompatFixtures {
}
@Override
public PlatformBlockState air() {
public NativeBlockState air() {
return new FakeBlockState("minecraft:air");
}
@Override
public PlatformBlockState deepSlateOre(PlatformBlockState block, PlatformBlockState ore) {
public NativeBlockState deepSlateOre(NativeBlockState block, NativeBlockState ore) {
return ore;
}
@Override
public PlatformBiome biome(String key) {
public NativeBiome biome(String key) {
return null;
}
@Override
public PlatformItem item(String key) {
public NativeItem item(String key) {
return null;
}
@Override
public PlatformEntityType entity(String key) {
public NativeEntityType entity(String key) {
return null;
}
@@ -178,12 +178,12 @@ final class CompatFixtures {
}
@Override
public Map<String, List<PlatformBlockProperty>> blockStateProperties() {
public Map<String, List<NativeBlockProperty>> blockStateProperties() {
return Map.of();
}
}
record FakeBlockState(String key) implements PlatformBlockState {
record FakeBlockState(String key) implements NativeBlockState {
private static final Map<String, Object> HANDLES = new java.util.concurrent.ConcurrentHashMap<>();
@Override
@@ -282,12 +282,12 @@ final class CompatFixtures {
}
@Override
public boolean canPlaceOnto(PlatformBlockState onto) {
public boolean canPlaceOnto(NativeBlockState onto) {
return true;
}
@Override
public boolean matches(PlatformBlockState state) {
public boolean matches(NativeBlockState state) {
return state != null && key.equals(state.key());
}
@@ -297,7 +297,7 @@ final class CompatFixtures {
}
@Override
public PlatformBlockState withProperty(String name, String value) {
public NativeBlockState withProperty(String name, String value) {
return this;
}
@@ -387,7 +387,7 @@ final class CompatFixtures {
}
@Override
public boolean spawnEntity(PlatformWorld world, String entityKey, double x, double y, double z) {
public boolean spawnEntity(NativeWorld world, String entityKey, double x, double y, double z) {
return false;
}
@@ -9,7 +9,7 @@ import art.arcane.iris.structure.object.IrisObjectPlacement;
import art.arcane.iris.structure.object.IrisObjectReplace;
import art.arcane.iris.structure.object.ObjectPlaceMode;
import art.arcane.iris.generation.block.TileData;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.math.RNG;
import org.junit.AfterClass;
@@ -52,11 +52,11 @@ public class ContentGatePlaceholderTest {
@Test
public void placeholderOnlyForMissingKeysAndOnlyWhenReady() {
ContentGate gate = gate();
PlatformBlockState present = gate.resolveBlockOrPlaceholder("STONE");
NativeBlockState present = gate.resolveBlockOrPlaceholder("STONE");
assertFalse(MissingBlockState.isPlaceholder(present));
assertEquals("minecraft:stone", present.key());
PlatformBlockState missing = gate.resolveBlockOrPlaceholder("minecraft:sulfur[lit=true]");
NativeBlockState missing = gate.resolveBlockOrPlaceholder("minecraft:sulfur[lit=true]");
assertTrue(MissingBlockState.isPlaceholder(missing));
assertEquals("minecraft:sulfur[lit=true]", missing.key());
assertEquals("minecraft:sulfur", missing.materialKey());
@@ -70,7 +70,7 @@ public class ContentGatePlaceholderTest {
@Test
public void placeholderBehavesAsAirButKeepsItsKey() {
PlatformBlockState air = registries.air();
NativeBlockState air = registries.air();
MissingBlockState placeholder = MissingBlockState.of("minecraft:sulfur[lit=true,axis=y]", air);
assertTrue(placeholder.isAir());
assertFalse(placeholder.isSolid());
@@ -94,17 +94,17 @@ public class ContentGatePlaceholderTest {
@Test
public void blockDataPlaceholderFollowsTheChainBeforeGivingUp() throws Exception {
IrisData data = IrisData.get(Files.createTempDirectory("iris-compat-placeholder").toFile());
PlatformBlockState present = new IrisBlockData("minecraft:stone").getBlockDataOrPlaceholder(data);
NativeBlockState present = new IrisBlockData("minecraft:stone").getBlockDataOrPlaceholder(data);
assertFalse(MissingBlockState.isPlaceholder(present));
assertEquals("minecraft:stone", present.key());
PlatformBlockState revived = new IrisBlockData("minecraft:sulfur").setBackup(new IrisBlockData("minecraft:sand")).getBlockDataOrPlaceholder(data);
NativeBlockState revived = new IrisBlockData("minecraft:sulfur").setBackup(new IrisBlockData("minecraft:sand")).getBlockDataOrPlaceholder(data);
assertEquals("minecraft:sand", revived.key());
assertFalse(MissingBlockState.isPlaceholder(revived));
IrisBlockData missing = new IrisBlockData("minecraft:sulfur");
missing.getData().put("lit", true);
PlatformBlockState placeholder = missing.getBlockDataOrPlaceholder(data);
NativeBlockState placeholder = missing.getBlockDataOrPlaceholder(data);
assertTrue(MissingBlockState.isPlaceholder(placeholder));
assertEquals("minecraft:sulfur[lit=true]", placeholder.key());
assertTrue(missing.getBlockData(data).isAir());
@@ -118,7 +118,7 @@ public class ContentGatePlaceholderTest {
IrisData data = IrisData.get(pack);
IrisObject object = data.getObjectLoader().load("rescue");
assertNotNull(object);
PlatformBlockState loaded = object.getBlocks().values().iterator().next();
NativeBlockState loaded = object.getBlocks().values().iterator().next();
assertTrue(loaded.toString(), MissingBlockState.isPlaceholder(loaded));
IrisObjectPlacement placement = placement();
@@ -138,7 +138,7 @@ public class ContentGatePlaceholderTest {
mismatch.getEdit().add(replace(1F, true, "minecraft:sulfur[lit=false]", "minecraft:sand"));
RecordingPlacer mismatchPlacer = new RecordingPlacer();
object.place(0, 64, 0, mismatchPlacer, mismatch, new RNG(7L), data);
PlatformBlockState untouched = mismatchPlacer.writes.getFirst();
NativeBlockState untouched = mismatchPlacer.writes.getFirst();
assertTrue(MissingBlockState.isPlaceholder(untouched));
assertTrue(untouched.isAir());
assertEquals(registries.air().nativeHandle(), untouched.nativeHandle());
@@ -183,7 +183,7 @@ public class ContentGatePlaceholderTest {
}
private static final class RecordingPlacer implements IObjectPlacer {
private final List<PlatformBlockState> writes = new ArrayList<>();
private final List<NativeBlockState> writes = new ArrayList<>();
@Override
public int getHighest(int x, int z, IrisData data) {
@@ -196,12 +196,12 @@ public class ContentGatePlaceholderTest {
}
@Override
public void set(int x, int y, int z, PlatformBlockState d) {
public void set(int x, int y, int z, NativeBlockState d) {
writes.add(d);
}
@Override
public PlatformBlockState get(int x, int y, int z) {
public NativeBlockState get(int x, int y, int z) {
return null;
}
@@ -3,7 +3,7 @@ package art.arcane.iris.pack.validation;
import art.arcane.iris.pack.loading.IrisData;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.block.IrisBlockData;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -108,7 +108,7 @@ public class IrisBlockDataResolutionTest {
IrisBlockData entry = new IrisBlockData("fancy");
entry.getData().put("axis", "x");
PlatformBlockState resolved = entry.getBlockData(data);
NativeBlockState resolved = entry.getBlockData(data);
IrisBlockData parsed = IrisBlockData.from(resolved.key());
assertEquals("craftengine:forest/amber_log", parsed.getBlock());
@@ -124,7 +124,7 @@ public class IrisBlockDataResolutionTest {
entry.getData().put("randomYaw", true);
entry.getData().put("variant", "OakLarge");
PlatformBlockState resolved = entry.getBlockData(data);
NativeBlockState resolved = entry.getBlockData(data);
IrisBlockData parsed = IrisBlockData.from(resolved.key());
assertEquals(true, parsed.getData().get("randomYaw"));
@@ -4,7 +4,7 @@ import art.arcane.iris.generation.block.BlockDataMergeSupport;
import art.arcane.iris.generation.block.TileData;
import art.arcane.iris.structure.object.IrisObjectRotation;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.volmlib.util.collection.KMap;
import org.junit.Test;
@@ -19,8 +19,8 @@ import static org.mockito.Mockito.when;
public class PlatformStateHookContractTest {
@Test
public void boundRotatorWinsWhenBukkitClassesArePresent() {
PlatformBlockState source = mock(PlatformBlockState.class);
PlatformBlockState rotated = mock(PlatformBlockState.class);
NativeBlockState source = mock(NativeBlockState.class);
NativeBlockState rotated = mock(NativeBlockState.class);
IrisObjectRotation.StateRotator hook = mock(IrisObjectRotation.StateRotator.class);
IrisObjectRotation rotation = new IrisObjectRotation();
when(hook.rotate(rotation, source, 1, 2, 3)).thenReturn(rotated);
@@ -34,9 +34,9 @@ public class PlatformStateHookContractTest {
@Test
public void boundMergerWinsWhenBukkitClassesArePresent() {
PlatformBlockState base = mock(PlatformBlockState.class);
PlatformBlockState update = mock(PlatformBlockState.class);
PlatformBlockState merged = mock(PlatformBlockState.class);
NativeBlockState base = mock(NativeBlockState.class);
NativeBlockState update = mock(NativeBlockState.class);
NativeBlockState merged = mock(NativeBlockState.class);
BlockDataMergeSupport.StateMerger hook = mock(BlockDataMergeSupport.StateMerger.class);
when(hook.merge(base, update)).thenReturn(merged);
BlockDataMergeSupport.StateMerger previous = BlockDataMergeSupport.bindPlatformMerger(hook);
@@ -49,7 +49,7 @@ public class PlatformStateHookContractTest {
@Test
public void boundTileFactoryWinsWhenBukkitClassesArePresent() {
PlatformBlockState state = mock(PlatformBlockState.class);
NativeBlockState state = mock(NativeBlockState.class);
KMap<String, Object> properties = new KMap<>();
TileData expected = mock(TileData.class);
TileData.TileFactory hook = mock(TileData.TileFactory.class);
@@ -1,36 +0,0 @@
package art.arcane.iris.platform;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
public class BlockStateKeyTest {
@Test
public void namespaceIgnoresPropertyValues() {
assertEquals("minecraft", BlockStateKey.namespace("stone"));
assertEquals("minecraft", BlockStateKey.namespace("stone[variant=custom:stone]"));
assertEquals("custom", BlockStateKey.namespace("custom:stone[variant=minecraft:stone]"));
assertEquals("", BlockStateKey.namespace(":stone"));
}
@Test
public void addsAndReplacesPropertiesInEncounterOrder() {
assertEquals("minecraft:stairs[facing=east]",
BlockStateKey.withProperty("minecraft:stairs", "facing", "east"));
assertEquals("minecraft:stairs[facing=east,half=top]",
BlockStateKey.withProperty("minecraft:stairs[facing=north,half=top]", "facing", "east"));
assertEquals("minecraft:stairs[facing=north,half=top,waterlogged=true]",
BlockStateKey.withProperty("minecraft:stairs[facing=north,half=top]", "waterlogged", "true"));
}
@Test
public void retainsDuplicateAndMalformedEntryHandling() {
assertEquals("custom:block[a=last,b=left=right,c=value]",
BlockStateKey.withProperty("custom:block[ a = first ,invalid,b=left=right,a=last]", "c", "value"));
assertEquals("stone[x=y]", BlockStateKey.withProperty("stone[]", "x", "y"));
assertThrows(StringIndexOutOfBoundsException.class,
() -> BlockStateKey.withProperty("stone[x=y", "x", "z"));
assertThrows(NullPointerException.class, () -> BlockStateKey.namespace(null));
}
}
@@ -0,0 +1,53 @@
package art.arcane.iris.platform.bootstrap;
import io.github.slimjar.exceptions.DownloaderException;
import io.github.slimjar.resolver.data.Dependency;
import io.github.slimjar.resolver.data.DependencyData;
import org.junit.Test;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Properties;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
public class NativeRuntimeLibrariesTest {
@Test
public void selectsOnlyCommonAndMatchingProvider() throws Exception {
Properties manifest = manifest();
Dependency original = new Dependency("example", "library", "1", null, List.of());
DependencyData data = new DependencyData(List.of(), List.of(), List.of(original), List.of());
List<String> selected = NativeRuntimeLibraries.from(manifest, "26.3.0").merge(data).dependencies()
.stream().map(Dependency::artifactId).sorted().toList();
assertEquals(List.of("library", "native-common", "native-v26_3_R1"), selected);
assertThrows(UnsupportedOperationException.class, () -> NativeRuntimeLibraries.from(manifest, "1.21.11"));
}
@Test
public void rejectsProviderBytesFromDifferentBuild() throws Exception {
Path jar = Files.createTempFile("native-runtime", ".jar");
try {
Files.write(jar, new byte[0]);
NativeRuntimeLibraries.verify(jar.toFile(), "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
Files.writeString(jar, "different build");
assertThrows(DownloaderException.class, () -> NativeRuntimeLibraries.verify(jar.toFile(),
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"));
} finally {
Files.deleteIfExists(jar);
}
}
private static Properties manifest() {
Properties properties = new Properties();
List<String> modules = List.of("native-common", "native-v26_2_R1", "native-v26_3_R1");
properties.setProperty("modules", String.join(",", modules));
properties.setProperty("repository", "https://jitpack.io/");
for (String module : modules) {
properties.setProperty(module + ".coordinate", "com.github.VolmitSoftware.VolmLib:" + module + ":revision");
properties.setProperty(module + ".sha256", "0".repeat(64));
}
return properties;
}
}
@@ -21,7 +21,7 @@ import art.arcane.iris.platform.generation.PlatformChunkGenerator;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.world.task.J;
@@ -80,7 +80,7 @@ public class BoardSVCSavedBiomeTest {
IrisPlatform platform = mock(IrisPlatform.class);
PlatformRegistries registries = mock(PlatformRegistries.class);
when(platform.registries()).thenReturn(registries);
when(registries.block(anyString())).thenReturn(mock(PlatformBlockState.class));
when(registries.block(anyString())).thenReturn(mock(NativeBlockState.class));
IrisPlatforms.bind(platform);
}
@@ -1,6 +1,6 @@
package art.arcane.iris.platform.bukkit;
import art.arcane.iris.spi.PlatformBiome;
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
import com.github.benmanes.caffeine.cache.Cache;
import org.bukkit.NamespacedKey;
import org.junit.Before;
@@ -39,7 +39,7 @@ public class BukkitBiomeTest {
AtomicInteger keyReads = new AtomicInteger();
Object biome = biome("iris", "riverbank", keyReads);
PlatformBiome wrapped = wrap(biome);
NativeBiome wrapped = wrap(biome);
assertEquals("iris:riverbank", wrapped.key());
assertEquals("iris", wrapped.namespace());
assertSame(biome, wrapped.nativeHandle());
@@ -53,8 +53,8 @@ public class BukkitBiomeTest {
Object previous = biome("iris", "registry_replacement", new AtomicInteger());
Object replacement = biome("iris", "registry_replacement", new AtomicInteger());
PlatformBiome oldHandle = wrap(previous);
PlatformBiome newHandle = wrap(replacement);
NativeBiome oldHandle = wrap(previous);
NativeBiome newHandle = wrap(replacement);
assertNotSame(oldHandle, newHandle);
assertEquals(oldHandle.key(), newHandle.key());
@@ -65,8 +65,8 @@ public class BukkitBiomeTest {
@Test
public void customAndVanillaNamespacesRemainDistinct() throws Exception {
PlatformBiome vanilla = wrap(biome("minecraft", "plains", new AtomicInteger()));
PlatformBiome custom = wrap(biome("iris", "plains", new AtomicInteger()));
NativeBiome vanilla = wrap(biome("minecraft", "plains", new AtomicInteger()));
NativeBiome custom = wrap(biome("iris", "plains", new AtomicInteger()));
assertEquals("minecraft:plains", vanilla.key());
assertEquals("minecraft", vanilla.namespace());
@@ -77,7 +77,7 @@ public class BukkitBiomeTest {
@Test
public void cacheEvictionPreservesBiomeKeysAndNativeHandles() throws Exception {
Object retained = biome("iris", "retained", new AtomicInteger());
PlatformBiome original = wrap(retained);
NativeBiome original = wrap(retained);
for (int index = 0; index < 8_192; index++) {
wrap(biome("iris", "eviction_" + index, new AtomicInteger()));
}
@@ -87,14 +87,14 @@ public class BukkitBiomeTest {
cache.cleanUp();
assertTrue(cache.estimatedSize() <= 4_096);
PlatformBiome restored = wrap(retained);
NativeBiome restored = wrap(retained);
assertEquals(original.key(), restored.key());
assertEquals(original.namespace(), restored.namespace());
assertSame(retained, restored.nativeHandle());
}
private PlatformBiome wrap(Object biome) throws Exception {
return (PlatformBiome) wrap.invoke(null, biome);
private NativeBiome wrap(Object biome) throws Exception {
return (NativeBiome) wrap.invoke(null, biome);
}
private Object biome(String namespace, String name, AtomicInteger keyReads) {
@@ -3,10 +3,10 @@ package art.arcane.iris.platform.bukkit;
import art.arcane.iris.integration.Identifier;
import art.arcane.iris.integration.ExternalDataSVC;
import art.arcane.iris.structure.object.IrisObjectRotation;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.testsupport.BukkitTestServer;
import art.arcane.iris.generation.block.IrisCustomData;
import art.arcane.iris.platform.bukkit.registry.RegistryUtil;
import art.arcane.iris.platform.registry.RegistryUtil;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.junit.BeforeClass;
@@ -34,11 +34,11 @@ public class BukkitCustomBlockTransformTest {
public void waterloggingUpdatesSemanticIdentityAndResolvedCarrier() {
IrisCustomData original = custom("craftengine:forest/amber_slab[axis=x,waterlogged=false]", 1);
IrisCustomData expected = custom("craftengine:forest/amber_slab[axis=x,waterlogged=true]", 2);
PlatformBlockState state = BukkitBlockState.of(original);
NativeBlockState state = BukkitBlockState.of(original);
try (MockedStatic<BukkitBlockResolution> resolution = mockStatic(BukkitBlockResolution.class)) {
resolveTo(resolution, expected);
PlatformBlockState result = state.withProperty("waterlogged", "true");
NativeBlockState result = state.withProperty("waterlogged", "true");
assertSame(expected, result.nativeHandle());
assertEquals(expected.getCustom().toString(), result.deferredPlacementKey());
@@ -50,7 +50,7 @@ public class BukkitCustomBlockTransformTest {
@Test
public void customPropertyRejectsAnUnresolvableValue() {
PlatformBlockState state = BukkitBlockState.of(custom("craftengine:forest/amber_log[axis=x]", 1));
NativeBlockState state = BukkitBlockState.of(custom("craftengine:forest/amber_log[axis=x]", 1));
try (MockedStatic<BukkitBlockResolution> resolution = mockStatic(BukkitBlockResolution.class)) {
IllegalArgumentException error = assertThrows(IllegalArgumentException.class,
@@ -66,11 +66,11 @@ public class BukkitCustomBlockTransformTest {
public void semanticFacingRotatesWithoutDirectionalCarrier() {
IrisCustomData original = custom("craftengine:forest/amber_lamp[facing=north,waterlogged=true]", 1);
IrisCustomData expected = custom("craftengine:forest/amber_lamp[facing=west,waterlogged=true]", 2);
PlatformBlockState state = BukkitBlockState.of(original);
NativeBlockState state = BukkitBlockState.of(original);
try (MockedStatic<BukkitBlockResolution> resolution = mockStatic(BukkitBlockResolution.class)) {
resolveTo(resolution, expected);
PlatformBlockState result = IrisObjectRotation.of(0, 90, 0).rotate(state, 0, 0, 0);
NativeBlockState result = IrisObjectRotation.of(0, 90, 0).rotate(state, 0, 0, 0);
assertSame(expected, result.nativeHandle());
assertEquals(expected.getCustom().toString(), result.key());
@@ -96,12 +96,12 @@ public class BukkitCustomBlockTransformTest {
@Test
public void semanticRotationPreservesSixteenWayOrientation() {
PlatformBlockState state = BukkitBlockState.of(custom("craftengine:forest/amber_sign[rotation=0]", 1));
NativeBlockState state = BukkitBlockState.of(custom("craftengine:forest/amber_sign[rotation=0]", 1));
IrisCustomData expected = custom("craftengine:forest/amber_sign[rotation=12]", 2);
try (MockedStatic<BukkitBlockResolution> resolution = mockStatic(BukkitBlockResolution.class)) {
resolveTo(resolution, expected);
PlatformBlockState result = IrisObjectRotation.of(0, 90, 0).rotate(state, 0, 0, 0);
NativeBlockState result = IrisObjectRotation.of(0, 90, 0).rotate(state, 0, 0, 0);
assertSame(expected, result.nativeHandle());
resolution.verify(() -> BukkitBlockResolution.resolveOrNull(anyString()));
@@ -110,14 +110,14 @@ public class BukkitCustomBlockTransformTest {
@Test
public void semanticConnectionsRotateTogether() {
PlatformBlockState state = BukkitBlockState.of(custom(
NativeBlockState state = BukkitBlockState.of(custom(
"craftengine:forest/amber_fence[north=true,east=false,south=false,west=false]", 1));
IrisCustomData expected = custom(
"craftengine:forest/amber_fence[north=false,east=false,south=false,west=true]", 2);
try (MockedStatic<BukkitBlockResolution> resolution = mockStatic(BukkitBlockResolution.class)) {
resolveTo(resolution, expected);
PlatformBlockState result = IrisObjectRotation.of(0, 90, 0).rotate(state, 0, 0, 0);
NativeBlockState result = IrisObjectRotation.of(0, 90, 0).rotate(state, 0, 0, 0);
assertSame(expected, result.nativeHandle());
resolution.verify(() -> BukkitBlockResolution.resolveOrNull(anyString()));
@@ -126,7 +126,7 @@ public class BukkitCustomBlockTransformTest {
@Test
public void unsupportedRotationRetainsTheOriginalCustomBlock() {
PlatformBlockState state = BukkitBlockState.of(custom("craftengine:forest/amber_lamp[facing=north]", 1));
NativeBlockState state = BukkitBlockState.of(custom("craftengine:forest/amber_lamp[facing=north]", 1));
try (MockedStatic<BukkitBlockResolution> resolution = mockStatic(BukkitBlockResolution.class)) {
assertSame(state, IrisObjectRotation.of(90, 0, 0).rotate(state, 0, 0, 0));
@@ -136,7 +136,7 @@ public class BukkitCustomBlockTransformTest {
@Test
public void unchangedSemanticAxisDoesNotResolveOrMutateCarrier() {
PlatformBlockState state = BukkitBlockState.of(custom("craftengine:forest/amber_log[axis=y]", 1));
NativeBlockState state = BukkitBlockState.of(custom("craftengine:forest/amber_log[axis=y]", 1));
try (MockedStatic<BukkitBlockResolution> resolution = mockStatic(BukkitBlockResolution.class)) {
assertSame(state, IrisObjectRotation.of(0, 90, 0).rotate(state, 0, 0, 0));
@@ -21,8 +21,8 @@ package art.arcane.iris.platform.bukkit;
import art.arcane.iris.integration.Identifier;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockProperty;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockProperty;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.BukkitTestServer;
import art.arcane.iris.generation.block.IrisCustomData;
@@ -130,7 +130,7 @@ public class BukkitSpiConformanceTest {
public void customStateKeepsProviderIdentityAndProperties() throws Exception {
BlockData base = blockData("minecraft:note_block[instrument=harp,note=5,powered=false]");
Identifier identifier = Identifier.fromString("craftengine:forest/amber_log[axis=x]");
PlatformBlockState state = BukkitBlockState.of(IrisCustomData.of(base, identifier));
NativeBlockState state = BukkitBlockState.of(IrisCustomData.of(base, identifier));
assertEquals(identifier.toString(), state.key());
assertEquals(identifier.toString(), state.deferredPlacementKey());
@@ -148,9 +148,9 @@ public class BukkitSpiConformanceTest {
public void customCarrierPropertyChangeKeepsProviderPropertiesSeparate() {
BlockData base = blockData("minecraft:oak_slab[type=bottom,waterlogged=false]");
Identifier identifier = Identifier.fromString("itemsadder:forest/amber_slab");
PlatformBlockState state = BukkitBlockState.of(IrisCustomData.of(base, identifier));
NativeBlockState state = BukkitBlockState.of(IrisCustomData.of(base, identifier));
PlatformBlockState merged = state.withProperty("waterlogged", "true");
NativeBlockState merged = state.withProperty("waterlogged", "true");
assertEquals(identifier.toString(), merged.key());
assertEquals(identifier.toString(), merged.deferredPlacementKey());
@@ -170,21 +170,21 @@ public class BukkitSpiConformanceTest {
@Test
public void withPropertyReplacesExistingProperty() {
BlockData data = blockData("iristest:merge_block[axis=y,waterlogged=false]");
PlatformBlockState merged = BukkitBlockState.of(data).withProperty("axis", "x");
NativeBlockState merged = BukkitBlockState.of(data).withProperty("axis", "x");
assertEquals("iristest:merge_block[axis=x,waterlogged=false]", merged.key());
}
@Test
public void withPropertyAppendsToExistingProperties() {
BlockData data = blockData("iristest:append_block[axis=y]");
PlatformBlockState merged = BukkitBlockState.of(data).withProperty("lit", "true");
NativeBlockState merged = BukkitBlockState.of(data).withProperty("lit", "true");
assertEquals("iristest:append_block[axis=y,lit=true]", merged.key());
}
@Test
public void withPropertyAddsBracketSectionWhenAbsent() {
BlockData data = blockData("iristest:bare_block");
PlatformBlockState merged = BukkitBlockState.of(data).withProperty("lit", "true");
NativeBlockState merged = BukkitBlockState.of(data).withProperty("lit", "true");
assertEquals("iristest:bare_block[lit=true]", merged.key());
}
@@ -256,7 +256,7 @@ public class BukkitSpiConformanceTest {
// Pre-flight before touching the registry: org.bukkit.Registry fail-initialises without a live
// RegistryAccess, and that is permanent and JVM-wide, so the catch below is already too late.
Assume.assumeTrue("live Bukkit registry unavailable in this environment", liveRegistriesAvailable());
Map<String, List<PlatformBlockProperty>> states;
Map<String, List<NativeBlockProperty>> states;
try {
states = registries().blockStateProperties();
} catch (Throwable unavailable) {
@@ -264,9 +264,9 @@ public class BukkitSpiConformanceTest {
return;
}
assertFalse(states.isEmpty());
for (Map.Entry<String, List<PlatformBlockProperty>> entry : states.entrySet()) {
for (Map.Entry<String, List<NativeBlockProperty>> entry : states.entrySet()) {
assertTrue("expected namespaced block key but was '" + entry.getKey() + "'", entry.getKey().contains(":"));
for (PlatformBlockProperty property : entry.getValue()) {
for (NativeBlockProperty property : entry.getValue()) {
assertFalse(property.name().isEmpty());
assertFalse(property.jsonType().isEmpty());
}
@@ -0,0 +1,51 @@
package art.arcane.iris.platform.bukkit.nms;
import art.arcane.volmlib.nativelib.terrain.NativeGenerationRegistry;
import art.arcane.volmlib.nativelib.terrain.NativeTerrainAccess;
import art.arcane.volmlib.nativelib.terrain.NativeTerrainSnapshots;
import art.arcane.volmlib.nativelib.terrain.NativeWorldGeneration;
import art.arcane.volmlib.nativelib.terrain.NativeWorldLifecycleFactory;
import org.bukkit.World;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class BukkitBindingTest {
@Test
public void chunkCapabilitiesOverrideLimitedBindingDefaults() {
Fixture fixture = new Fixture();
World world = mock(World.class);
when(fixture.terrain.pollChunkTask(world)).thenReturn(true);
when(fixture.terrain.forceEvictChunk(world, 2, 3)).thenReturn(true);
assertTrue(fixture.binding.pollChunkTask(world));
assertTrue(fixture.binding.forceEvictChunk(world, 2, 3));
fixture.binding.flushChunkIO(world);
verify(fixture.terrain).flushChunkIO(world);
}
@Test
public void lifecycleCapabilitiesOverrideLimitedBindingDefaults() {
Fixture fixture = new Fixture();
when(fixture.lifecycle.isServerStopping()).thenReturn(true);
assertTrue(fixture.binding.isServerStopping());
fixture.binding.deferPluginClassLoaderClose();
fixture.binding.releasePluginClassLoaderClose();
verify(fixture.lifecycle).deferPluginClassLoaderClose();
verify(fixture.lifecycle).releasePluginClassLoaderClose();
}
private static final class Fixture {
private final NativeTerrainAccess terrain = mock(NativeTerrainAccess.class);
private final NativeWorldLifecycleFactory.Controller lifecycle = mock(NativeWorldLifecycleFactory.Controller.class);
private final BukkitBinding binding;
private Fixture() {
NativeWorldGeneration generation = mock(NativeWorldGeneration.class);
when(generation.lifecycle(BukkitWorldLifecyclePolicy.INSTANCE)).thenReturn(lifecycle);
binding = new BukkitBinding(new BukkitBinding.Capabilities(terrain, generation,
mock(NativeTerrainSnapshots.class), mock(NativeGenerationRegistry.class)));
}
}
}
@@ -1,54 +0,0 @@
package art.arcane.iris.platform.bukkit.nms;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public class NmsBindingSelectorTest {
@Test
public void selects263Revision() {
assertEquals("v26_3_R1", NmsBindingSelector.select(MinecraftVersion.fromBukkitVersion("26.3-R0.1-SNAPSHOT")));
assertEquals("v26_3_R1", NmsBindingSelector.select(MinecraftVersion.fromBukkitVersion("26.3.0-R0.1-SNAPSHOT")));
}
@Test
public void selectsOnlyTheExactSupportedRevision() {
MinecraftVersion version = MinecraftVersion.fromBukkitVersion("26.2-R0.1-SNAPSHOT");
assertEquals("v26_2_R1", NmsBindingSelector.select(version));
}
@Test
public void selectsSharedRevisionFor2612() {
MinecraftVersion version = MinecraftVersion.fromBukkitVersion("26.1.2-R0.1-SNAPSHOT");
assertEquals("v26_2_R1", NmsBindingSelector.select(version));
}
@Test
public void rejectsUnsupportedVersionsWithoutProbingAnotherRevision() {
MinecraftVersion version = MinecraftVersion.fromBukkitVersion("26.4-R0.1-SNAPSHOT");
IllegalStateException failure = assertThrows(IllegalStateException.class,
() -> NmsBindingSelector.select(version));
assertTrue(failure.getMessage().contains("26.4"));
}
@Test
public void rejectsBasePatchOfSupportedMinorLine() {
MinecraftVersion version = MinecraftVersion.fromBukkitVersion("26.1-R0.1-SNAPSHOT");
IllegalStateException failure = assertThrows(IllegalStateException.class,
() -> NmsBindingSelector.select(version));
assertTrue(failure.getMessage().contains("26.1"));
}
@Test
public void rejectsMissingVersionDetection() {
assertThrows(IllegalStateException.class, () -> NmsBindingSelector.select(null));
}
}
@@ -1,5 +1,7 @@
package art.arcane.iris.platform.bukkit.nms;
import art.arcane.volmlib.nativelib.terrain.ServerShutdownBoundary;
import org.junit.Test;
import java.net.URL;
@@ -1,6 +1,6 @@
package art.arcane.iris.platform.generation;
import art.arcane.iris.generation.cache.AtomicCache;
import art.arcane.volmlib.util.cache.AtomicCache;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.runtime.EngineTarget;
import art.arcane.iris.pack.loading.IrisData;
@@ -1,7 +1,7 @@
package art.arcane.iris.platform.generation;
import art.arcane.iris.generation.runtime.IrisEngine;
import art.arcane.iris.generation.cache.AtomicCache;
import art.arcane.volmlib.util.cache.AtomicCache;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.runtime.EngineTarget;
import art.arcane.iris.generation.terrain.IrisDimension;
@@ -11,7 +11,7 @@ import art.arcane.iris.world.IrisWorld;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.IrisServices;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.iris.world.task.J;
@@ -356,7 +356,7 @@ public class EngineBukkitOpsDeferredMaterializationTest {
IrisPlatform previous = IrisPlatforms.isBound() ? IrisPlatforms.get() : null;
IrisPlatform platform = mock(IrisPlatform.class);
PlatformRegistries registries = mock(PlatformRegistries.class);
when(registries.block("AIR")).thenReturn(mock(PlatformBlockState.class));
when(registries.block("AIR")).thenReturn(mock(NativeBlockState.class));
when(platform.registries()).thenReturn(registries);
IrisPlatforms.unbind();
IrisPlatforms.bind(platform);
@@ -119,7 +119,7 @@ public class PackTypeBukkitPurityGateTest {
* Bukkit adapter, so they stay out of the gate.)
*/
private static final List<String> BUKKIT_STATIC_HOLDERS = List.of(
"art.arcane.iris.platform.bukkit.registry.Particles");
"art.arcane.iris.platform.registry.Particles");
@Test
public void theGateActuallyHidesBukkit() throws Exception {
@@ -1,6 +1,7 @@
package art.arcane.iris.structure;
import art.arcane.iris.structure.export.VanillaJigsawDatapackExporter;
import art.arcane.volmlib.nativelib.terrain.NativeStructureReader;
import art.arcane.iris.structure.export.VanillaJigsawExportRequest;
import art.arcane.iris.structure.export.VanillaJigsawExportResult;
import art.arcane.iris.structure.export.VanillaJigsawExportSource;
@@ -14,7 +15,7 @@ import art.arcane.iris.structure.jigsaw.IrisJigsawPool;
import art.arcane.iris.structure.object.IrisObject;
import art.arcane.iris.structure.placement.IrisStructure;
import art.arcane.iris.structure.object.ObjectPlaceMode;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import org.junit.Before;
@@ -31,7 +32,6 @@ import java.nio.file.Path;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -60,9 +60,8 @@ public class VillageImporterConnectorRoundTripTest {
@Test
public void vanillaNbtMetadataSurvivesIrisPieceAndVanillaExport() throws Exception {
FakeJigsawBlockInfo jigsaw = new FakeJigsawBlockInfo(-29, -17);
FakeStructureBlockInfo info = new FakeStructureBlockInfo(new FakeCompoundTag(FINAL_STATE));
VillageImporter.ConnectorMetadata metadata = VillageImporter.readConnectorMetadata(jigsaw, info);
VillageImporter.ConnectorMetadata metadata = VillageImporter.readConnectorMetadata(
new NativeStructureReader.ConnectorMetadata(FINAL_STATE, -17, -29));
Map<String, Object> importedConnector = VillageImporter.connectorJson(
1,
1,
@@ -115,7 +114,7 @@ public class VillageImporterConnectorRoundTripTest {
private static TestGraph graph(IrisJigsawPiece piece, IrisJigsawConnector connector) {
TestGraph graph = new TestGraph();
IrisObject object = new IrisObject(3, 3, 3);
PlatformBlockState finalState = mock(PlatformBlockState.class);
NativeBlockState finalState = mock(NativeBlockState.class);
when(finalState.key()).thenReturn(connector.getFinalState());
object.setUnsigned(1, 1, 0, finalState);
graph.objects.put("objects/start", object);
@@ -137,18 +136,6 @@ public class VillageImporterConnectorRoundTripTest {
return graph;
}
private record FakeJigsawBlockInfo(int placementPriority, int selectionPriority) {
}
private record FakeStructureBlockInfo(FakeCompoundTag nbt) {
}
private record FakeCompoundTag(String finalState) {
public Optional<String> getString(String key) {
return "final_state".equals(key) ? Optional.of(finalState) : Optional.empty();
}
}
private static final class TestGraph implements StructureGraphResolver {
private final Map<String, IrisJigsawPool> pools = new LinkedHashMap<>();
private final Map<String, IrisJigsawPiece> pieces = new LinkedHashMap<>();
@@ -19,6 +19,8 @@
package art.arcane.iris.structure;
import art.arcane.iris.structure.authoring.StructureCapability;
import art.arcane.volmlib.nativelib.terrain.NativeStructureReader;
import java.util.function.LongSupplier;
import art.arcane.iris.structure.authoring.StructureLoss;
import art.arcane.iris.structure.object.IrisObject;
import org.junit.Test;
@@ -373,49 +375,33 @@ public class VillageImporterListPoolElementTest {
assertTrue(imported.emittedCapabilities(omitted).isEmpty());
}
private static final class FakeListPoolElement {
private final List<Object> elements;
private abstract static class TestElement implements NativeStructureReader.Element {
@Override
public String typeName() { return getClass().getSimpleName(); }
@Override
public String templateLocation() { return null; }
@Override
public List<NativeStructureReader.Element> children() { return null; }
@Override
public NativeStructureReader.ConnectorSet connectors(LongSupplier seed) { throw new UnsupportedOperationException(); }
}
private FakeListPoolElement(List<?> elements) {
private static final class FakeListPoolElement extends TestElement {
private final List<NativeStructureReader.Element> elements;
private FakeListPoolElement(List<? extends NativeStructureReader.Element> elements) {
this.elements = List.copyOf(elements);
}
public List<Object> getElements() {
return elements;
}
@Override
public List<NativeStructureReader.Element> children() { return elements; }
}
private static final class FakeSinglePoolElement {
private final FakeResourceLocation location;
private FakeSinglePoolElement(String location) {
String[] parts = location.split(":", 2);
this.location = new FakeResourceLocation(parts[0], parts[1]);
}
public FakeResourceLocation getTemplateLocation() {
return location;
}
private static final class FakeSinglePoolElement extends TestElement {
private final String location;
private FakeSinglePoolElement(String location) { this.location = location; }
@Override
public String templateLocation() { return location; }
}
private static final class FakeFeaturePoolElement {
}
private static final class FakeResourceLocation {
private final String namespace;
private final String path;
private FakeResourceLocation(String namespace, String path) {
this.namespace = namespace;
this.path = path;
}
public String getNamespace() {
return namespace;
}
public String getPath() {
return path;
}
private static final class FakeFeaturePoolElement extends TestElement {
}
}
@@ -1,44 +0,0 @@
package art.arcane.iris.structure;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* JigsawStructure.maxDistanceFromCenter is a plain int on some server builds and a
* JigsawStructure$MaxDistance record ({int horizontal, int vertical}) on others (e.g. Leaf
* 26.2-33). The reflective member reader must handle both — the wrapper shape previously threw
* IllegalArgumentException from Field.getInt, failing the jigsaw import of every datapack
* structure ("Failed to read jigsaw structure graph").
*/
public class VillageImporterMaxDistanceReadTest {
private static final class IntShape {
private final int maxDistanceFromCenter = 80;
}
private record MaxDistance(int horizontal, int vertical) {
}
private static final class WrapperShape {
private final MaxDistance maxDistanceFromCenter = new MaxDistance(96, 48);
}
private static final class BoxedShape {
private final Integer maxDistanceFromCenter = 64;
}
@Test
public void readsPlainIntField() throws Exception {
assertEquals(80, VillageImporter.readIntMember(new IntShape(), "maxDistanceFromCenter"));
}
@Test
public void readsLargestIntComponentFromWrapperRecord() throws Exception {
assertEquals(96, VillageImporter.readIntMember(new WrapperShape(), "maxDistanceFromCenter"));
}
@Test
public void readsBoxedNumberField() throws Exception {
assertEquals(64, VillageImporter.readIntMember(new BoxedShape(), "maxDistanceFromCenter"));
}
}
@@ -18,7 +18,7 @@ import art.arcane.iris.structure.object.ObjectPlaceMode;
import art.arcane.iris.generation.block.TileData;
import art.arcane.iris.spi.IrisPlatform;
import art.arcane.iris.spi.IrisPlatforms;
import art.arcane.iris.spi.PlatformBlockState;
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
import art.arcane.iris.spi.PlatformRegistries;
import art.arcane.iris.testsupport.PlatformLeakGuard;
import art.arcane.volmlib.util.collection.KList;
@@ -58,7 +58,7 @@ public class VanillaJigsawDatapackExporterTest {
@ClassRule
public static final PlatformLeakGuard PLATFORM_GUARD = PlatformLeakGuard.clean();
private static PlatformBlockState stone;
private static NativeBlockState stone;
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -196,7 +196,7 @@ public class VanillaJigsawDatapackExporterTest {
@Test
public void preservesExplicitAirAndStructureVoidConnectorFinalStates() throws Exception {
TestGraph graph = terminalGraph();
PlatformBlockState air = blockState("minecraft:air");
NativeBlockState air = blockState("minecraft:air");
IrisObject object = graph.objects.get("objects/start");
object.setUnsigned(0, 1, 1, air);
IrisJigsawPiece piece = graph.pieces.get("pieces/start");
@@ -407,8 +407,8 @@ public class VanillaJigsawDatapackExporterTest {
return new IrisJigsawPieceEntry().setEmpty(true).setWeight(weight);
}
private static PlatformBlockState blockState(String key) {
PlatformBlockState state = mock(PlatformBlockState.class);
private static NativeBlockState blockState(String key) {
NativeBlockState state = mock(NativeBlockState.class);
when(state.key()).thenReturn(key);
when(state.namespace()).thenReturn(key.substring(0, key.indexOf(':')));
return state;
Loaded 100 of 892 files, more files were not shown because too many files have changed in this diff. Show more