mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-11 19:14:11 +00:00
[VERY VERY VERY BAD IDEA]
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package art.arcane.iris.probe;
|
||||
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
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.volmlib.util.hunk.Hunk;
|
||||
|
||||
import java.io.File;
|
||||
@@ -284,8 +284,8 @@ public final class GenerationOrderProbe {
|
||||
|
||||
static ChunkHash hashChunk(
|
||||
ChunkCoordinate coordinate,
|
||||
Hunk<PlatformBlockState> blocks,
|
||||
Hunk<PlatformBiome> biomes,
|
||||
Hunk<NativeBlockState> blocks,
|
||||
Hunk<NativeBiome> biomes,
|
||||
int height
|
||||
) {
|
||||
MessageDigest blockDigest = sha256();
|
||||
@@ -300,8 +300,8 @@ public final class GenerationOrderProbe {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
PlatformBlockState state = blocks.get(x, y, z);
|
||||
PlatformBiome biome = biomes.get(x, y, z);
|
||||
NativeBlockState state = blocks.get(x, y, z);
|
||||
NativeBiome biome = biomes.get(x, y, z);
|
||||
String blockKey = state == null ? "minecraft:air" : state.key();
|
||||
String biomeKey = biome == null ? "<null>" : biome.key();
|
||||
blockCounts.merge(blockKey, 1, Integer::sum);
|
||||
@@ -492,8 +492,8 @@ public final class GenerationOrderProbe {
|
||||
boolean multicore
|
||||
) throws Exception {
|
||||
int height = engine.getTarget().getHeight();
|
||||
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<PlatformBiome> biomes = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<NativeBlockState> blocks = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<NativeBiome> biomes = Hunk.newArrayHunk(16, height, 16);
|
||||
engine.generate(coordinate.x() << 4, coordinate.z() << 4, blocks, biomes, multicore);
|
||||
return new ChunkOutput(coordinate, hashChunk(coordinate, blocks, biomes, height));
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.world.IrisWorld;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.IrisServices;
|
||||
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.volmlib.util.hunk.Hunk;
|
||||
|
||||
import java.io.File;
|
||||
@@ -399,8 +399,8 @@ public final class GenerationProbe {
|
||||
ChunkCoordinate coordinate = coordinates.get(index);
|
||||
drainReported();
|
||||
List<Throwable> failures = new ArrayList<>();
|
||||
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<PlatformBiome> biomes = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<NativeBlockState> blocks = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<NativeBiome> biomes = Hunk.newArrayHunk(16, height, 16);
|
||||
long started = System.nanoTime();
|
||||
try {
|
||||
engine.generate(
|
||||
@@ -481,7 +481,7 @@ public final class GenerationProbe {
|
||||
}
|
||||
|
||||
private static void updateSignature(MessageDigest digest, ChunkCoordinate coordinate,
|
||||
Hunk<PlatformBlockState> blocks, Hunk<PlatformBiome> biomes, int height) {
|
||||
Hunk<NativeBlockState> blocks, Hunk<NativeBiome> biomes, int height) {
|
||||
MessageDigest blockDigest = sha256();
|
||||
MessageDigest biomeDigest = sha256();
|
||||
updateDigest(digest, coordinate.x() + "," + coordinate.z());
|
||||
@@ -490,8 +490,8 @@ public final class GenerationProbe {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
PlatformBlockState state = blocks.get(x, y, z);
|
||||
PlatformBiome biome = biomes.get(x, y, z);
|
||||
NativeBlockState state = blocks.get(x, y, z);
|
||||
NativeBiome biome = biomes.get(x, y, z);
|
||||
String stateKey = state == null ? "minecraft:air" : state.key();
|
||||
String biomeKey = biome == null ? "null" : biome.key();
|
||||
updateDigest(digest, stateKey);
|
||||
|
||||
@@ -7,7 +7,7 @@ import art.arcane.iris.generation.hydrology.HydrologyColumnSample;
|
||||
import art.arcane.iris.generation.hydrology.HydrologyFeatureType;
|
||||
import art.arcane.iris.generation.hydrology.RiverFootprint;
|
||||
import art.arcane.iris.generation.terrain.InferredType;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -73,7 +73,7 @@ public final class HydrologyBlockProbe {
|
||||
}
|
||||
}
|
||||
|
||||
record PlannedColumn(int naturalY, boolean ocean, HydrologyColumnLayer surface, PlatformBlockState fluid) {
|
||||
record PlannedColumn(int naturalY, boolean ocean, HydrologyColumnLayer surface, NativeBlockState fluid) {
|
||||
boolean mouthAt(int seaLevel) {
|
||||
return surface != null && fluid != null && fluid.isWater()
|
||||
&& surface.feature().type() == HydrologyFeatureType.MOUTH
|
||||
@@ -150,7 +150,7 @@ public final class HydrologyBlockProbe {
|
||||
return chunks.containsKey(RiverFootprint.pack(Math.floorDiv(x, 16), Math.floorDiv(z, 16)));
|
||||
}
|
||||
|
||||
PlatformBlockState block(int x, int y, int z) {
|
||||
NativeBlockState block(int x, int y, int z) {
|
||||
RealPackProbeSupport.GeneratedChunk chunk = chunks.get(
|
||||
RiverFootprint.pack(Math.floorDiv(x, 16), Math.floorDiv(z, 16)));
|
||||
return chunk == null || y < 0 || y >= height ? null : chunk.blockAt(x, y, z);
|
||||
@@ -203,7 +203,7 @@ public final class HydrologyBlockProbe {
|
||||
int natural = sample == null ? (int) Math.round(complex.getNaturalHeightStream().getDouble(x, z))
|
||||
: sample.naturalHeight();
|
||||
HydrologyColumnLayer layer = surfaceForInspection(sample);
|
||||
PlatformBlockState fluid = layer == null ? null : complex.resolveHydrologyFluid(
|
||||
NativeBlockState fluid = layer == null ? null : complex.resolveHydrologyFluid(
|
||||
layer.profileKey(), x, z);
|
||||
planned.put(RiverFootprint.pack(x, z), new PlannedColumn(natural, sample == null
|
||||
? complex.getBridgeStream().get(x, z) == InferredType.SEA : sample.ocean(), layer, fluid));
|
||||
@@ -274,7 +274,7 @@ public final class HydrologyBlockProbe {
|
||||
continue;
|
||||
}
|
||||
for (int y = 0; y < volume.height; y++) {
|
||||
PlatformBlockState block = volume.block(x, y, z);
|
||||
NativeBlockState block = volume.block(x, y, z);
|
||||
if (key(block).equals("minecraft:sugar_cane")
|
||||
&& !key(volume.block(x, y - 1, z)).equals("minecraft:sugar_cane")) {
|
||||
inspectCane(volume, block, x, y, z, evidence);
|
||||
@@ -305,7 +305,7 @@ public final class HydrologyBlockProbe {
|
||||
}
|
||||
for (int y = Math.max(0, surface.bedY() + 1); y <= surface.fluidHeadY() && y < volume.height; y++) {
|
||||
evidence.plannedWetVoxels++;
|
||||
PlatformBlockState actual = volume.block(x, y, z);
|
||||
NativeBlockState actual = volume.block(x, y, z);
|
||||
boolean matches = column.fluid().isWater() ? water(actual)
|
||||
: key(column.fluid()).equals(key(actual));
|
||||
if (!matches) {
|
||||
@@ -319,9 +319,9 @@ public final class HydrologyBlockProbe {
|
||||
return evidence;
|
||||
}
|
||||
|
||||
private static void inspectCane(Volume volume, PlatformBlockState cane, int x, int y, int z, Evidence evidence) {
|
||||
private static void inspectCane(Volume volume, NativeBlockState cane, int x, int y, int z, Evidence evidence) {
|
||||
evidence.caneRoots++;
|
||||
PlatformBlockState substrate = volume.block(x, y - 1, z);
|
||||
NativeBlockState substrate = volume.block(x, y - 1, z);
|
||||
if (substrate == null || !cane.canPlaceOnto(substrate)) {
|
||||
evidence.invalidCaneSubstrates++;
|
||||
evidence.example("unsupported cane " + x + "," + y + "," + z + " on " + key(substrate));
|
||||
@@ -335,7 +335,7 @@ public final class HydrologyBlockProbe {
|
||||
censored = true;
|
||||
continue;
|
||||
}
|
||||
PlatformBlockState adjacent = volume.block(nx, y - 1, nz);
|
||||
NativeBlockState adjacent = volume.block(nx, y - 1, nz);
|
||||
if (water(adjacent) || key(adjacent).equals("minecraft:frosted_ice")) {
|
||||
evidence.validCaneRoots++;
|
||||
return;
|
||||
@@ -447,7 +447,7 @@ public final class HydrologyBlockProbe {
|
||||
for (int z = volume.minimumZ; z <= volume.maximumZ; z++) {
|
||||
for (int x = volume.minimumX; x <= volume.maximumX; x++) {
|
||||
for (int y = volume.height - 1; y >= 0; y--) {
|
||||
PlatformBlockState block = volume.block(x, y, z);
|
||||
NativeBlockState block = volume.block(x, y, z);
|
||||
if (block != null && !block.isAir()) {
|
||||
overhead.setRGB(x - volume.minimumX, z - volume.minimumZ, color(block));
|
||||
break;
|
||||
@@ -482,7 +482,7 @@ public final class HydrologyBlockProbe {
|
||||
return List.copyOf(artifacts);
|
||||
}
|
||||
|
||||
private static int color(PlatformBlockState block) {
|
||||
private static int color(NativeBlockState block) {
|
||||
if (block == null || block.isAir()) {
|
||||
return 0xC9E3F0;
|
||||
}
|
||||
@@ -508,11 +508,11 @@ public final class HydrologyBlockProbe {
|
||||
return 0x888C90;
|
||||
}
|
||||
|
||||
private static boolean water(PlatformBlockState block) {
|
||||
private static boolean water(NativeBlockState block) {
|
||||
return block != null && (block.isWater() || block.isWaterLogged());
|
||||
}
|
||||
|
||||
private static String key(PlatformBlockState block) {
|
||||
private static String key(NativeBlockState block) {
|
||||
if (block == null) {
|
||||
return "minecraft:air";
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.biome.IrisBiomeCustom;
|
||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.generation.hydrology.IrisRiverBlendStyle;
|
||||
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.volmlib.util.matter.MatterUpdate;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
@@ -3653,7 +3653,7 @@ public final class HydrologyPackProbe {
|
||||
throw new IllegalStateException("Generated witness differs from the accepted composed hydrology layer.");
|
||||
}
|
||||
HydrologyColumnLayer layer = witness.layer();
|
||||
PlatformBlockState expectedFluid = engine.getComplex().resolveHydrologyFluid(
|
||||
NativeBlockState expectedFluid = engine.getComplex().resolveHydrologyFluid(
|
||||
layer.profileKey(),
|
||||
position.x(),
|
||||
position.z()
|
||||
@@ -3668,7 +3668,7 @@ public final class HydrologyPackProbe {
|
||||
requireNoUpdateMarker(engine, position);
|
||||
}
|
||||
String blockStateKey = stateKey(generated.blockAt(position.x(), position.y(), position.z()));
|
||||
PlatformBiome biome = generated.biomeAt(
|
||||
NativeBiome biome = generated.biomeAt(
|
||||
position.x(),
|
||||
Math.min(position.y(), generated.height() - 1),
|
||||
position.z()
|
||||
@@ -3698,7 +3698,7 @@ public final class HydrologyPackProbe {
|
||||
HydrologyColumnSample sample,
|
||||
HydrologyColumnLayer layer,
|
||||
CavePosition position,
|
||||
PlatformBlockState expectedFluid
|
||||
NativeBlockState expectedFluid
|
||||
) {
|
||||
if (sample.terrainHeight() != layer.bedY()) {
|
||||
throw new IllegalStateException("Accepted surface witness does not own the composed terrain height.");
|
||||
@@ -3706,7 +3706,7 @@ public final class HydrologyPackProbe {
|
||||
if (layer.fluidHeadY() >= sample.naturalHeight()) {
|
||||
throw new IllegalStateException("Generated surface witness is not recessed below natural terrain.");
|
||||
}
|
||||
PlatformBlockState bed = generated.blockAt(position.x(), layer.bedY(), position.z());
|
||||
NativeBlockState bed = generated.blockAt(position.x(), layer.bedY(), position.z());
|
||||
if (bed == null || bed.isAirOrFluid() || matchesConfiguredFluid(bed, expectedFluid, true)) {
|
||||
throw new IllegalStateException("Generated surface witness has no non-fluid channel bed: state="
|
||||
+ stateKey(bed)
|
||||
@@ -3715,7 +3715,7 @@ public final class HydrologyPackProbe {
|
||||
+ ", sampleLayers=" + sample.layers());
|
||||
}
|
||||
requireNonVegetatedBed(bed, "surface");
|
||||
PlatformBlockState fluid = generated.blockAt(position.x(), position.y(), position.z());
|
||||
NativeBlockState fluid = generated.blockAt(position.x(), position.y(), position.z());
|
||||
requireMatchingFluid(
|
||||
fluid,
|
||||
expectedFluid,
|
||||
@@ -3724,7 +3724,7 @@ public final class HydrologyPackProbe {
|
||||
);
|
||||
int composedFluidHead = composedSurfaceFluidHead(sample);
|
||||
if (composedFluidHead + 1 < generated.height()) {
|
||||
PlatformBlockState above = generated.blockAt(position.x(), composedFluidHead + 1, position.z());
|
||||
NativeBlockState above = generated.blockAt(position.x(), composedFluidHead + 1, position.z());
|
||||
if (above != null && matchesConfiguredFluid(above, expectedFluid, true)) {
|
||||
throw new IllegalStateException("Generated surface witness contains " + stateKey(above)
|
||||
+ " above its accepted head at "
|
||||
@@ -3732,7 +3732,7 @@ public final class HydrologyPackProbe {
|
||||
+ ": layer=" + layer + ", sampleLayers=" + sample.layers() + ".");
|
||||
}
|
||||
}
|
||||
PlatformBiome biome = generated.biomeAt(position.x(), layer.fluidHeadY(), position.z());
|
||||
NativeBiome biome = generated.biomeAt(position.x(), layer.fluidHeadY(), position.z());
|
||||
IrisBiome surfaceBiome = engine.getComplex().getTrueBiomeStream().get(position.x(), position.z());
|
||||
String expectedBiomeKey = generatedSurfaceBiomeKey(
|
||||
surfaceBiome,
|
||||
@@ -3784,7 +3784,7 @@ public final class HydrologyPackProbe {
|
||||
IrisHydrologyRuntime runtime,
|
||||
RealPackProbeSupport.GeneratedChunk generated,
|
||||
GeneratedWitness witness,
|
||||
PlatformBlockState expectedFluid,
|
||||
NativeBlockState expectedFluid,
|
||||
VerificationFamily family
|
||||
) {
|
||||
CavePosition position = witness.position();
|
||||
@@ -3828,10 +3828,10 @@ public final class HydrologyPackProbe {
|
||||
+ ", sampleLayers=" + (debugSample == null ? "null" : debugSample.layers())
|
||||
+ ", layer=" + witness.layer() + ".");
|
||||
}
|
||||
PlatformBlockState state = generated.blockAt(position.x(), position.y(), position.z());
|
||||
NativeBlockState state = generated.blockAt(position.x(), position.y(), position.z());
|
||||
if (cell.isWet()) {
|
||||
requireMatchingFluid(state, expectedFluid, "cave", false);
|
||||
PlatformBlockState bed = generated.blockAt(
|
||||
NativeBlockState bed = generated.blockAt(
|
||||
position.x(),
|
||||
witness.layer().bedY(),
|
||||
position.z()
|
||||
@@ -3960,7 +3960,7 @@ public final class HydrologyPackProbe {
|
||||
}
|
||||
}
|
||||
|
||||
private static void requireNonVegetatedBed(PlatformBlockState bed, String label) {
|
||||
private static void requireNonVegetatedBed(NativeBlockState bed, String label) {
|
||||
String key = stateKey(bed).toLowerCase(Locale.ROOT);
|
||||
if (key.endsWith(":grass_block") || key.endsWith(":moss_block")) {
|
||||
throw new IllegalStateException("Generated " + label + " hydrology rests on " + key + ".");
|
||||
@@ -3984,8 +3984,8 @@ public final class HydrologyPackProbe {
|
||||
}
|
||||
|
||||
private static void requireMatchingFluid(
|
||||
PlatformBlockState actual,
|
||||
PlatformBlockState expected,
|
||||
NativeBlockState actual,
|
||||
NativeBlockState expected,
|
||||
String label,
|
||||
boolean allowWaterColumnReplacement
|
||||
) {
|
||||
@@ -3999,8 +3999,8 @@ public final class HydrologyPackProbe {
|
||||
}
|
||||
|
||||
static boolean matchesConfiguredFluid(
|
||||
PlatformBlockState actual,
|
||||
PlatformBlockState expected,
|
||||
NativeBlockState actual,
|
||||
NativeBlockState expected,
|
||||
boolean allowWaterColumnReplacement
|
||||
) {
|
||||
if (actual == null || expected == null) {
|
||||
@@ -4014,7 +4014,7 @@ public final class HydrologyPackProbe {
|
||||
&& (actual.isWaterLogged() || WATER_COLUMN_REPLACEMENTS.contains(materialKey(actual)));
|
||||
}
|
||||
|
||||
private static String materialKey(PlatformBlockState state) {
|
||||
private static String materialKey(NativeBlockState state) {
|
||||
String cached = state.materialKey();
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -4024,7 +4024,7 @@ public final class HydrologyPackProbe {
|
||||
return bracket < 0 ? key : key.substring(0, bracket);
|
||||
}
|
||||
|
||||
private static String stateKey(PlatformBlockState state) {
|
||||
private static String stateKey(NativeBlockState state) {
|
||||
return state == null ? "minecraft:air" : state.key();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.world.IrisWorld;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.IrisServices;
|
||||
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.volmlib.util.hunk.Hunk;
|
||||
|
||||
import java.io.File;
|
||||
@@ -147,8 +147,8 @@ final class RealPackProbeSupport {
|
||||
|
||||
static GeneratedChunk generateChunk(Engine engine, int chunkX, int chunkZ) {
|
||||
int height = engine.getTarget().getHeight();
|
||||
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<PlatformBiome> biomes = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<NativeBlockState> blocks = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<NativeBiome> biomes = Hunk.newArrayHunk(16, height, 16);
|
||||
try {
|
||||
engine.generate(chunkX << 4, chunkZ << 4, blocks, biomes, false);
|
||||
} catch (Exception failure) {
|
||||
@@ -161,8 +161,8 @@ final class RealPackProbeSupport {
|
||||
int chunkX,
|
||||
int chunkZ,
|
||||
int height,
|
||||
Hunk<PlatformBlockState> blocks,
|
||||
Hunk<PlatformBiome> biomes
|
||||
Hunk<NativeBlockState> blocks,
|
||||
Hunk<NativeBiome> biomes
|
||||
) {
|
||||
GeneratedChunk {
|
||||
if (height < 1 || blocks == null || biomes == null) {
|
||||
@@ -170,12 +170,12 @@ final class RealPackProbeSupport {
|
||||
}
|
||||
}
|
||||
|
||||
PlatformBlockState blockAt(int blockX, int y, int blockZ) {
|
||||
NativeBlockState blockAt(int blockX, int y, int blockZ) {
|
||||
validatePosition(blockX, y, blockZ);
|
||||
return blocks.get(Math.floorMod(blockX, 16), y, Math.floorMod(blockZ, 16));
|
||||
}
|
||||
|
||||
PlatformBiome biomeAt(int blockX, int y, int blockZ) {
|
||||
NativeBiome biomeAt(int blockX, int y, int blockZ) {
|
||||
validatePosition(blockX, y, blockZ);
|
||||
return biomes.get(Math.floorMod(blockX, 16), y, Math.floorMod(blockZ, 16));
|
||||
}
|
||||
|
||||
@@ -24,16 +24,16 @@ import art.arcane.iris.structure.object.IrisObjectRotation;
|
||||
import art.arcane.iris.generation.block.TileData;
|
||||
import art.arcane.iris.spi.IrisPlatform;
|
||||
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.generation.geometry.IrisBlockVector;
|
||||
|
||||
import java.io.File;
|
||||
@@ -66,15 +66,15 @@ public final class StubPlatform implements IrisPlatform {
|
||||
TileData.bindPlatformFactory(StubTileData::fromProperties);
|
||||
}
|
||||
|
||||
static PlatformBlockState rotateForTest(IrisObjectRotation rotation, PlatformBlockState state) {
|
||||
static NativeBlockState rotateForTest(IrisObjectRotation rotation, NativeBlockState state) {
|
||||
return rotateState(rotation, state, 0, 0, 0);
|
||||
}
|
||||
|
||||
static PlatformBlockState mergeForTest(PlatformBlockState base, PlatformBlockState update) {
|
||||
static NativeBlockState mergeForTest(NativeBlockState base, NativeBlockState update) {
|
||||
return mergeStates(base, update);
|
||||
}
|
||||
|
||||
static PlatformBlockState blockStateForTest(String key) {
|
||||
static NativeBlockState blockStateForTest(String key) {
|
||||
return StubBlockState.of(key);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
this.dataFolder = dataFolder;
|
||||
}
|
||||
|
||||
private static final class StubBlockState implements PlatformBlockState {
|
||||
private static final class StubBlockState implements NativeBlockState {
|
||||
private static final ConcurrentHashMap<String, StubBlockState> CACHE = new ConcurrentHashMap<>();
|
||||
private final String key;
|
||||
private final String blockKey;
|
||||
@@ -225,7 +225,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceOnto(PlatformBlockState onto) {
|
||||
public boolean canPlaceOnto(NativeBlockState onto) {
|
||||
if (!blockKey.equals("minecraft:sugar_cane")) {
|
||||
return true;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(PlatformBlockState state) {
|
||||
public boolean matches(NativeBlockState state) {
|
||||
return equals(state);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState withProperty(String name, String value) {
|
||||
public NativeBlockState withProperty(String name, String value) {
|
||||
String propertyName = normalizeProperty(name);
|
||||
String propertyValue = normalizeProperty(value);
|
||||
if (propertyValue.equals(properties.get(propertyName))) {
|
||||
@@ -277,7 +277,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
}
|
||||
|
||||
private static PlatformBlockState rotateState(IrisObjectRotation rotation, PlatformBlockState state,
|
||||
private static NativeBlockState rotateState(IrisObjectRotation rotation, NativeBlockState state,
|
||||
int spinX, int spinY, int spinZ) {
|
||||
if (state == null || rotation == null || !rotation.canRotate()) {
|
||||
return state;
|
||||
@@ -311,7 +311,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
return StubBlockState.of(parsed);
|
||||
}
|
||||
|
||||
private static PlatformBlockState mergeStates(PlatformBlockState base, PlatformBlockState update) {
|
||||
private static NativeBlockState mergeStates(NativeBlockState base, NativeBlockState update) {
|
||||
if (base == null) {
|
||||
return update;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
return original.equals(parsedBase.properties()) ? base : StubBlockState.of(parsedBase);
|
||||
}
|
||||
|
||||
private static ParsedState parsedState(PlatformBlockState state) {
|
||||
private static ParsedState parsedState(NativeBlockState state) {
|
||||
return state instanceof StubBlockState stub ? stub.parsed() : ParsedState.parse(state.key());
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
}
|
||||
|
||||
private static final class StubBiome implements PlatformBiome {
|
||||
private static final class StubBiome implements NativeBiome {
|
||||
private static final ConcurrentHashMap<String, StubBiome> CACHE = new ConcurrentHashMap<>();
|
||||
private final String key;
|
||||
|
||||
@@ -522,7 +522,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void region(PlatformWorld world, int chunkX, int chunkZ, Runnable task) {
|
||||
public void region(NativeWorld world, int chunkX, int chunkZ, Runnable task) {
|
||||
task.run();
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void laterRegion(PlatformWorld world, int chunkX, int chunkZ, Runnable task, int ticks) {
|
||||
public void laterRegion(NativeWorld world, int chunkX, int chunkZ, Runnable task, int ticks) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,22 +562,22 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> reachableStructureKeys(PlatformWorld world) {
|
||||
public List<String> reachableStructureKeys(NativeWorld world) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> possibleBiomeKeys(PlatformWorld world) {
|
||||
public List<String> possibleBiomeKeys(NativeWorld world) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeFeature(PlatformWorld world, int x, int y, int z, String featureKey, long seed) {
|
||||
public boolean placeFeature(NativeWorld world, int x, int y, int z, String featureKey, long seed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] placeStructure(PlatformWorld world, int chunkX, int chunkZ, String structureKey, long seed, int maxSpan) {
|
||||
public int[] placeStructure(NativeWorld world, int chunkX, int chunkZ, String structureKey, long seed, int maxSpan) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -594,12 +594,12 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlatformBiome> allBiomes() {
|
||||
public List<NativeBiome> allBiomes() {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
||||
private record StubEntityType(String key) implements PlatformEntityType {
|
||||
private record StubEntityType(String key) implements NativeEntityType {
|
||||
@Override
|
||||
public String namespace() {
|
||||
return "minecraft";
|
||||
@@ -618,42 +618,42 @@ public final class StubPlatform implements IrisPlatform {
|
||||
|
||||
private static final class StubRegistries implements PlatformRegistries {
|
||||
@Override
|
||||
public PlatformBlockState block(String key) {
|
||||
public NativeBlockState block(String key) {
|
||||
return StubBlockState.of(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState blockOrNull(String key) {
|
||||
public NativeBlockState blockOrNull(String key) {
|
||||
return StubBlockState.of(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState blockOrNull(String key, boolean warn) {
|
||||
public NativeBlockState blockOrNull(String key, boolean warn) {
|
||||
return StubBlockState.of(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState air() {
|
||||
public NativeBlockState air() {
|
||||
return StubBlockState.of("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 StubBiome.of(key);
|
||||
}
|
||||
|
||||
@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 key != null && key.startsWith("minecraft:") ? new StubEntityType(key) : null;
|
||||
}
|
||||
|
||||
@@ -708,7 +708,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<PlatformBlockProperty>> blockStateProperties() {
|
||||
public Map<String, List<NativeBlockProperty>> blockStateProperties() {
|
||||
return Map.of();
|
||||
}
|
||||
}
|
||||
@@ -777,7 +777,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package art.arcane.iris.probe;
|
||||
|
||||
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.KMap;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -48,7 +48,7 @@ public final class StubTileData extends TileData {
|
||||
}
|
||||
}
|
||||
|
||||
static StubTileData fromProperties(PlatformBlockState state, KMap<String, Object> properties) {
|
||||
static StubTileData fromProperties(NativeBlockState state, KMap<String, Object> properties) {
|
||||
if (state == null) {
|
||||
throw new IllegalArgumentException("Probe tile data requires a block state");
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import art.arcane.iris.generation.stage.IrisTerrainNormalActuator;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.terrain.Terrain3DColumn;
|
||||
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.hunk.Hunk;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -377,7 +377,7 @@ public final class Terrain3DProbe {
|
||||
failReported("before chunk " + chunkX + "," + chunkZ, RealPackProbeSupport.drainReported());
|
||||
RealPackProbeSupport.GeneratedChunk generated = RealPackProbeSupport.generateChunk(engine, chunkX, chunkZ);
|
||||
int height = generated.height();
|
||||
Hunk<PlatformBlockState> terrain = Hunk.newArrayHunk(16, height, 16);
|
||||
Hunk<NativeBlockState> terrain = Hunk.newArrayHunk(16, height, 16);
|
||||
IrisComplex complex = engine.getComplex();
|
||||
int blockX = chunkX << 4;
|
||||
int blockZ = chunkZ << 4;
|
||||
@@ -400,8 +400,8 @@ public final class Terrain3DProbe {
|
||||
for (int y = 0; y < height; y++) {
|
||||
boolean owned = additionalTerrain && engine.isAdditionalTerrainOwned(worldX, y, worldZ);
|
||||
excluded.set(y, owned);
|
||||
PlatformBlockState rawBlock = terrain.get(x, y, z);
|
||||
PlatformBlockState finalBlock = generated.blocks().get(x, y, z);
|
||||
NativeBlockState rawBlock = terrain.get(x, y, z);
|
||||
NativeBlockState finalBlock = generated.blocks().get(x, y, z);
|
||||
raw[y] = y <= rootTop && !owned && solid(rawBlock);
|
||||
retained[y] = raw[y] && finalBlock != null && rawBlock.matches(finalBlock);
|
||||
}
|
||||
@@ -422,16 +422,16 @@ public final class Terrain3DProbe {
|
||||
}
|
||||
}
|
||||
|
||||
private static ColumnEvidence inspectShapedColumn(Terrain3DColumn column, Hunk<PlatformBlockState> terrain,
|
||||
Hunk<PlatformBlockState> generated, int x, int z) {
|
||||
private static ColumnEvidence inspectShapedColumn(Terrain3DColumn column, Hunk<NativeBlockState> terrain,
|
||||
Hunk<NativeBlockState> generated, int x, int z) {
|
||||
int height = terrain.getHeight();
|
||||
boolean[] predicted = new boolean[height];
|
||||
boolean[] raw = new boolean[height];
|
||||
boolean[] complete = new boolean[height];
|
||||
boolean[] retained = new boolean[height];
|
||||
for (int y = 0; y < height; y++) {
|
||||
PlatformBlockState rawBlock = terrain.get(x, y, z);
|
||||
PlatformBlockState finalBlock = generated.get(x, y, z);
|
||||
NativeBlockState rawBlock = terrain.get(x, y, z);
|
||||
NativeBlockState finalBlock = generated.get(x, y, z);
|
||||
predicted[y] = column.isSolid(y);
|
||||
raw[y] = solid(rawBlock);
|
||||
complete[y] = finalBlock != null && !finalBlock.isAir();
|
||||
@@ -440,7 +440,7 @@ public final class Terrain3DProbe {
|
||||
return inspectColumn((int) Math.round(column.baseHeight()), predicted, raw, complete, retained);
|
||||
}
|
||||
|
||||
private static boolean solid(PlatformBlockState block) {
|
||||
private static boolean solid(NativeBlockState block) {
|
||||
return block != null && !block.isAir() && !block.isFluid();
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ public final class Terrain3DProbe {
|
||||
}
|
||||
}
|
||||
|
||||
private void column(int worldX, int localZ, Hunk<PlatformBlockState> terrain, Hunk<PlatformBlockState> generated,
|
||||
private void column(int worldX, int localZ, Hunk<NativeBlockState> terrain, Hunk<NativeBlockState> generated,
|
||||
int localX, Terrain3DColumn shape, int baseHeight, ColumnEvidence observation) {
|
||||
BufferedImage image = images[localZ];
|
||||
int pixelX = LEFT + worldX - (configuration.minimumChunkX() << 4);
|
||||
@@ -696,7 +696,7 @@ public final class Terrain3DProbe {
|
||||
}
|
||||
}
|
||||
|
||||
private int color(PlatformBlockState block, Terrain3DColumn shape, int baseHeight, int y) {
|
||||
private int color(NativeBlockState block, Terrain3DColumn shape, int baseHeight, int y) {
|
||||
if (block == null || block.isAir()) {
|
||||
return shape != null && y <= shape.topY() && !shape.isSolid(y) ? 0xd8b8ce : 0xeaf1f7;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package art.arcane.iris.probe;
|
||||
import art.arcane.iris.generation.runtime.DimensionStackContext;
|
||||
import art.arcane.iris.generation.runtime.DimensionStackLayout;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.testsupport.IrisRuntimeState;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Test;
|
||||
@@ -410,7 +410,7 @@ public final class DimensionStackSuperflatProbeTest {
|
||||
expected, blockKey(chunk.blockAt(blockX, y, blockZ)));
|
||||
}
|
||||
|
||||
private static String blockKey(PlatformBlockState state) {
|
||||
private static String blockKey(NativeBlockState state) {
|
||||
return state == null || state.isAir() ? AIR : state.key();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package art.arcane.iris.probe;
|
||||
|
||||
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.volmlib.util.hunk.Hunk;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -117,19 +117,19 @@ public final class GenerationOrderProbeTest {
|
||||
@Test
|
||||
public void completeChunkHashSeparatesBlockAndBiomeChanges() {
|
||||
StubPlatform platform = new StubPlatform(new File("/tmp/iris-order-probe-test"));
|
||||
PlatformBlockState stone = StubPlatform.blockStateForTest("minecraft:stone");
|
||||
PlatformBlockState water = StubPlatform.blockStateForTest("minecraft:water[level=0]");
|
||||
PlatformBiome plains = platform.registries().biome("minecraft:plains");
|
||||
PlatformBiome forest = platform.registries().biome("minecraft:forest");
|
||||
Hunk<PlatformBlockState> baselineBlocks = Hunk.newArrayHunk(16, 2, 16);
|
||||
Hunk<PlatformBiome> baselineBiomes = Hunk.newArrayHunk(16, 2, 16);
|
||||
NativeBlockState stone = StubPlatform.blockStateForTest("minecraft:stone");
|
||||
NativeBlockState water = StubPlatform.blockStateForTest("minecraft:water[level=0]");
|
||||
NativeBiome plains = platform.registries().biome("minecraft:plains");
|
||||
NativeBiome forest = platform.registries().biome("minecraft:forest");
|
||||
Hunk<NativeBlockState> baselineBlocks = Hunk.newArrayHunk(16, 2, 16);
|
||||
Hunk<NativeBiome> baselineBiomes = Hunk.newArrayHunk(16, 2, 16);
|
||||
baselineBlocks.set(0, 0, 0, stone);
|
||||
baselineBiomes.set(0, 0, 0, plains);
|
||||
GenerationOrderProbe.ChunkCoordinate coordinate = new GenerationOrderProbe.ChunkCoordinate(0, 0);
|
||||
GenerationOrderProbe.ChunkHash baseline = GenerationOrderProbe.hashChunk(
|
||||
coordinate, baselineBlocks, baselineBiomes, 2);
|
||||
|
||||
Hunk<PlatformBiome> changedBiomes = Hunk.newArrayHunk(16, 2, 16);
|
||||
Hunk<NativeBiome> changedBiomes = Hunk.newArrayHunk(16, 2, 16);
|
||||
changedBiomes.set(0, 0, 0, forest);
|
||||
GenerationOrderProbe.ChunkHash biomeChange = GenerationOrderProbe.hashChunk(
|
||||
coordinate, baselineBlocks, changedBiomes, 2);
|
||||
@@ -137,7 +137,7 @@ public final class GenerationOrderProbeTest {
|
||||
assertNotEquals(baseline.biomes(), biomeChange.biomes());
|
||||
assertNotEquals(baseline.combined(), biomeChange.combined());
|
||||
|
||||
Hunk<PlatformBlockState> changedBlocks = Hunk.newArrayHunk(16, 2, 16);
|
||||
Hunk<NativeBlockState> changedBlocks = Hunk.newArrayHunk(16, 2, 16);
|
||||
changedBlocks.set(0, 0, 0, water);
|
||||
GenerationOrderProbe.ChunkHash blockChange = GenerationOrderProbe.hashChunk(
|
||||
coordinate, changedBlocks, baselineBiomes, 2);
|
||||
|
||||
@@ -6,8 +6,8 @@ import art.arcane.iris.generation.hydrology.HydrologyFeatureRef;
|
||||
import art.arcane.iris.generation.hydrology.HydrologyFeatureType;
|
||||
import art.arcane.iris.generation.hydrology.RiverFootprint;
|
||||
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.testsupport.PlatformLeakGuard;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import org.junit.AfterClass;
|
||||
@@ -211,8 +211,8 @@ public final class HydrologyBlockProbeTest {
|
||||
private static Map<Long, RealPackProbeSupport.GeneratedChunk> chunks(int minimumX, int maximumX) {
|
||||
Map<Long, RealPackProbeSupport.GeneratedChunk> chunks = new HashMap<>();
|
||||
for (int x = minimumX; x <= maximumX; x++) {
|
||||
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);
|
||||
chunks.put(RiverFootprint.pack(x, 0), new RealPackProbeSupport.GeneratedChunk(x, 0, 16, blocks, biomes));
|
||||
}
|
||||
return chunks;
|
||||
@@ -223,7 +223,7 @@ public final class HydrologyBlockProbeTest {
|
||||
.blocks().set(Math.floorMod(x, 16), y, Math.floorMod(z, 16), state(key));
|
||||
}
|
||||
|
||||
private static PlatformBlockState state(String key) {
|
||||
private static NativeBlockState state(String key) {
|
||||
return IrisPlatforms.get().registries().block("minecraft:" + key);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.world.history.GenerationRegistryContractFactory;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
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.volmlib.util.hunk.Hunk;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -182,10 +182,10 @@ public final class HydrologyPackProbeTest {
|
||||
@Test
|
||||
public void generatedChunkMapsNegativeWorldCoordinatesToLocalBuffers() {
|
||||
StubPlatform platform = new StubPlatform(new File("/tmp/iris-hydrology-pack-probe-test"));
|
||||
PlatformBlockState water = StubPlatform.blockStateForTest("minecraft:water[level=8]");
|
||||
PlatformBiome biome = platform.registries().biome("minecraft:river");
|
||||
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(16, 2, 16);
|
||||
Hunk<PlatformBiome> biomes = Hunk.newArrayHunk(16, 2, 16);
|
||||
NativeBlockState water = StubPlatform.blockStateForTest("minecraft:water[level=8]");
|
||||
NativeBiome biome = platform.registries().biome("minecraft:river");
|
||||
Hunk<NativeBlockState> blocks = Hunk.newArrayHunk(16, 2, 16);
|
||||
Hunk<NativeBiome> biomes = Hunk.newArrayHunk(16, 2, 16);
|
||||
blocks.set(15, 1, 15, water);
|
||||
biomes.set(15, 1, 15, biome);
|
||||
RealPackProbeSupport.GeneratedChunk chunk = new RealPackProbeSupport.GeneratedChunk(
|
||||
@@ -199,12 +199,12 @@ public final class HydrologyPackProbeTest {
|
||||
|
||||
@Test
|
||||
public void generatedSurfaceFluidAcceptsOnlyWaterBearingDecorantsForWaterProfiles() {
|
||||
PlatformBlockState water = StubPlatform.blockStateForTest("minecraft:water[level=0]");
|
||||
PlatformBlockState lava = StubPlatform.blockStateForTest("minecraft:lava[level=0]");
|
||||
PlatformBlockState kelp = StubPlatform.blockStateForTest("minecraft:kelp_plant");
|
||||
PlatformBlockState coral = StubPlatform.blockStateForTest(
|
||||
NativeBlockState water = StubPlatform.blockStateForTest("minecraft:water[level=0]");
|
||||
NativeBlockState lava = StubPlatform.blockStateForTest("minecraft:lava[level=0]");
|
||||
NativeBlockState kelp = StubPlatform.blockStateForTest("minecraft:kelp_plant");
|
||||
NativeBlockState coral = StubPlatform.blockStateForTest(
|
||||
"minecraft:brain_coral_fan[waterlogged=true]");
|
||||
PlatformBlockState stone = StubPlatform.blockStateForTest("minecraft:stone");
|
||||
NativeBlockState stone = StubPlatform.blockStateForTest("minecraft:stone");
|
||||
|
||||
assertTrue(HydrologyPackProbe.matchesConfiguredFluid(water, water, false));
|
||||
assertTrue(HydrologyPackProbe.matchesConfiguredFluid(kelp, water, true));
|
||||
|
||||
@@ -3,7 +3,7 @@ package art.arcane.iris.probe;
|
||||
import art.arcane.iris.generation.decoration.IrisSpeleothems;
|
||||
import art.arcane.iris.structure.object.IrisObjectRotation;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.testsupport.PlatformLeakGuard;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import org.junit.AfterClass;
|
||||
@@ -46,20 +46,20 @@ public final class StubPlatformStateTest {
|
||||
|
||||
@Test
|
||||
public void propertyUpdatesAndMergesPreserveCanonicalState() {
|
||||
PlatformBlockState base = state("minecraft:oak_leaves[distance=7,persistent=false]");
|
||||
PlatformBlockState updated = base.withProperty("distance", "2").withProperty("persistent", "true");
|
||||
NativeBlockState base = state("minecraft:oak_leaves[distance=7,persistent=false]");
|
||||
NativeBlockState updated = base.withProperty("distance", "2").withProperty("persistent", "true");
|
||||
|
||||
assertEquals("minecraft:oak_leaves[distance=2,persistent=true]", updated.key());
|
||||
|
||||
PlatformBlockState merged = StubPlatform.mergeForTest(
|
||||
NativeBlockState merged = StubPlatform.mergeForTest(
|
||||
base, state("minecraft:oak_leaves[persistent=true]"));
|
||||
assertEquals("minecraft:oak_leaves[distance=7,persistent=true]", merged.key());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noOpStateTransformsReuseTheCanonicalInstance() {
|
||||
PlatformBlockState stone = state("minecraft:stone");
|
||||
PlatformBlockState leaves = state("minecraft:oak_leaves[distance=7,persistent=false]");
|
||||
NativeBlockState stone = state("minecraft:stone");
|
||||
NativeBlockState leaves = state("minecraft:oak_leaves[distance=7,persistent=false]");
|
||||
|
||||
assertSame(stone, StubPlatform.rotateForTest(IrisObjectRotation.of(0, 90, 0), stone));
|
||||
assertSame(leaves, leaves.withProperty("distance", "7"));
|
||||
@@ -71,9 +71,9 @@ public final class StubPlatformStateTest {
|
||||
|
||||
@Test
|
||||
public void classifiesVanillaFluidStates() {
|
||||
PlatformBlockState water = state("minecraft:water[level=0]");
|
||||
PlatformBlockState lava = state("minecraft:lava[level=0]");
|
||||
PlatformBlockState stone = state("minecraft:stone");
|
||||
NativeBlockState water = state("minecraft:water[level=0]");
|
||||
NativeBlockState lava = state("minecraft:lava[level=0]");
|
||||
NativeBlockState stone = state("minecraft:stone");
|
||||
|
||||
assertTrue(water.isFluid());
|
||||
assertTrue(water.isWater());
|
||||
@@ -94,8 +94,8 @@ public final class StubPlatformStateTest {
|
||||
|
||||
@Test
|
||||
public void resolvesSpikeSupportWithoutServerClasses() {
|
||||
Hunk<PlatformBlockState> blocks = Hunk.newArrayHunk(1, 3, 1);
|
||||
PlatformBlockState spike = state("minecraft:pointed_dripstone[vertical_direction=up,thickness=tip]");
|
||||
Hunk<NativeBlockState> blocks = Hunk.newArrayHunk(1, 3, 1);
|
||||
NativeBlockState spike = state("minecraft:pointed_dripstone[vertical_direction=up,thickness=tip]");
|
||||
blocks.set(0, 0, 0, state("minecraft:stone"));
|
||||
assertTrue(IrisSpeleothems.isSupported(spike, blocks, 0, 0, 1));
|
||||
blocks.set(0, 0, 0, state("minecraft:water[level=0]"));
|
||||
@@ -106,7 +106,7 @@ public final class StubPlatformStateTest {
|
||||
|
||||
@Test
|
||||
public void sugarCaneUsesNativeSubstratesInGeneratedChunkProbes() {
|
||||
PlatformBlockState cane = state("minecraft:sugar_cane[age=0]");
|
||||
NativeBlockState cane = state("minecraft:sugar_cane[age=0]");
|
||||
for (String substrate : new String[]{"sugar_cane", "grass_block", "dirt", "coarse_dirt", "podzol",
|
||||
"mycelium", "rooted_dirt", "moss_block", "pale_moss_block", "mud", "muddy_mangrove_roots",
|
||||
"sand", "red_sand", "suspicious_sand"}) {
|
||||
@@ -117,7 +117,7 @@ public final class StubPlatformStateTest {
|
||||
}
|
||||
}
|
||||
|
||||
private PlatformBlockState state(String key) {
|
||||
private NativeBlockState state(String key) {
|
||||
return IrisPlatforms.get().registries().block(key);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user