mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-27 22:40:13 +00:00
Drop dead biome inject writes
- sBiome, floating biomes and publishNaturalMetadata no longer write MatterBiomeInject; nothing reads it - stack metadata clearing only runs for dimension stacks
This commit is contained in:
1 parent
241260a762
commit
3df1fba518
6 files changed
+91
-162
No files matched your search
@@ -230,6 +230,10 @@ public class ChunkContext {
|
|||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasDimensionStack() {
|
||||||
|
return dimensionStackContext != null;
|
||||||
|
}
|
||||||
|
|
||||||
public DimensionStackLayout getDimensionStackLayout(int localX, int localZ) {
|
public DimensionStackLayout getDimensionStackLayout(int localX, int localZ) {
|
||||||
if (dimensionStackContext == null) {
|
if (dimensionStackContext == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import art.arcane.iris.generation.concurrent.MultiBurst;
|
|||||||
import art.arcane.iris.generation.context.ChunkContext;
|
import art.arcane.iris.generation.context.ChunkContext;
|
||||||
import art.arcane.iris.generation.context.IrisContext;
|
import art.arcane.iris.generation.context.IrisContext;
|
||||||
import art.arcane.iris.generation.mantle.EngineMantle;
|
import art.arcane.iris.generation.mantle.EngineMantle;
|
||||||
import art.arcane.iris.generation.stage.IrisBiomeActuator;
|
import art.arcane.iris.generation.stage.IrisDimensionStackActuator;
|
||||||
import art.arcane.iris.generation.stage.IrisTransitionGeometryActuator;
|
import art.arcane.iris.generation.stage.IrisTransitionGeometryActuator;
|
||||||
import art.arcane.iris.integration.Identifier;
|
import art.arcane.iris.integration.Identifier;
|
||||||
import art.arcane.iris.generation.decoration.tree.TreeBlockMaterial;
|
import art.arcane.iris.generation.decoration.tree.TreeBlockMaterial;
|
||||||
@@ -215,7 +215,7 @@ public interface EngineMode extends Staged {
|
|||||||
try (IrisContext.Scope chunkScope = IrisContext.open(getEngine(), generationSessionId, ctx)) {
|
try (IrisContext.Scope chunkScope = IrisContext.open(getEngine(), generationSessionId, ctx)) {
|
||||||
generateTerrain(x, z, blocks, biomes, multicore, ctx);
|
generateTerrain(x, z, blocks, biomes, multicore, ctx);
|
||||||
recordNaturalTerrain(x, z, blocks, biomes, ctx);
|
recordNaturalTerrain(x, z, blocks, biomes, ctx);
|
||||||
IrisBiomeActuator.publishNaturalMetadata(getEngine(), x, z, biomes, ctx);
|
IrisDimensionStackActuator.clearHostNaturalMetadata(getEngine(), x, z, biomes.getHeight(), ctx);
|
||||||
ctx.beginContent();
|
ctx.beginContent();
|
||||||
List<Matter> continuations = restoreObjectContinuations(x, z);
|
List<Matter> continuations = restoreObjectContinuations(x, z);
|
||||||
for (EngineStage i : stages) {
|
for (EngineStage i : stages) {
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import art.arcane.iris.world.history.TransitionGenerationPlan;
|
|||||||
import art.arcane.iris.generation.biome.IrisBiome;
|
import art.arcane.iris.generation.biome.IrisBiome;
|
||||||
import art.arcane.iris.generation.biome.IrisBiomeCustom;
|
import art.arcane.iris.generation.biome.IrisBiomeCustom;
|
||||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||||
import art.arcane.iris.spi.IrisPlatform;
|
|
||||||
import art.arcane.iris.spi.IrisPlatforms;
|
import art.arcane.iris.spi.IrisPlatforms;
|
||||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||||
import art.arcane.iris.generation.context.ChunkContext;
|
import art.arcane.iris.generation.context.ChunkContext;
|
||||||
@@ -35,12 +34,7 @@ import art.arcane.iris.generation.context.ChunkedDataCache;
|
|||||||
import art.arcane.volmlib.util.hunk.Hunk;
|
import art.arcane.volmlib.util.hunk.Hunk;
|
||||||
import art.arcane.volmlib.util.collection.KMap;
|
import art.arcane.volmlib.util.collection.KMap;
|
||||||
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||||
import art.arcane.volmlib.util.mantle.runtime.Mantle;
|
|
||||||
import art.arcane.volmlib.util.mantle.runtime.MantleChunk;
|
|
||||||
import art.arcane.volmlib.util.math.RNG;
|
import art.arcane.volmlib.util.math.RNG;
|
||||||
import art.arcane.volmlib.util.matter.Matter;
|
|
||||||
import art.arcane.volmlib.util.matter.MatterBiomeInject;
|
|
||||||
import art.arcane.volmlib.util.matter.slices.BiomeInjectMatter;
|
|
||||||
import art.arcane.volmlib.util.scheduling.PrecisionStopwatch;
|
import art.arcane.volmlib.util.scheduling.PrecisionStopwatch;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -48,8 +42,8 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
||||||
private final RNG rng;
|
private final RNG rng;
|
||||||
private final KMap<String, ResolvedBiome> resolvedBiomes = new KMap<>();
|
private final KMap<String, NativeBiome> resolvedBiomes = new KMap<>();
|
||||||
private final KMap<String, ResolvedBiome> resolvedPhysicalBiomes = new KMap<>();
|
private final KMap<String, NativeBiome> resolvedPhysicalBiomes = new KMap<>();
|
||||||
|
|
||||||
public IrisBiomeActuator(Engine engine) {
|
public IrisBiomeActuator(Engine engine) {
|
||||||
super(engine, "Biome");
|
super(engine, "Biome");
|
||||||
@@ -64,7 +58,6 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
int depth = h.getDepth();
|
int depth = h.getDepth();
|
||||||
int height = h.getHeight();
|
int height = h.getHeight();
|
||||||
Engine engine = getEngine();
|
Engine engine = getEngine();
|
||||||
Mantle<Matter> mantle = engine.getMantle().getMantle();
|
|
||||||
ChunkedDataCache<IrisBiome> biomeCache = context.getBiome();
|
ChunkedDataCache<IrisBiome> biomeCache = context.getBiome();
|
||||||
IrisComplex complex = context.getComplex();
|
IrisComplex complex = context.getComplex();
|
||||||
DimensionStackContext dimensionStackContext = engine.getDimensionStackContext();
|
DimensionStackContext dimensionStackContext = engine.getDimensionStackContext();
|
||||||
@@ -74,7 +67,7 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
int worldX = x + xf;
|
int worldX = x + xf;
|
||||||
int worldZ = z + zf;
|
int worldZ = z + zf;
|
||||||
IrisBiome biome = biomeCache.get(xf, zf);
|
IrisBiome biome = biomeCache.get(xf, zf);
|
||||||
ResolvedBiome resolved = resolve(biomeKey(
|
NativeBiome platformBiome = resolve(biomeKey(
|
||||||
biome,
|
biome,
|
||||||
getDimension(),
|
getDimension(),
|
||||||
engine,
|
engine,
|
||||||
@@ -82,8 +75,9 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
0,
|
0,
|
||||||
worldZ
|
worldZ
|
||||||
));
|
));
|
||||||
NativeBiome platformBiome = resolved.biome();
|
if (platformBiome != null) {
|
||||||
writeColumn(h, mantle, xf, zf, worldX, worldZ, height, resolved);
|
h.set(xf, 0, zf, xf, height - 1, zf, platformBiome);
|
||||||
|
}
|
||||||
|
|
||||||
if (dimensionStackContext != null) {
|
if (dimensionStackContext != null) {
|
||||||
NativeBiome bottomBiome = platformBiome == null
|
NativeBiome bottomBiome = platformBiome == null
|
||||||
@@ -95,48 +89,19 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
worldX,
|
worldX,
|
||||||
worldZ,
|
worldZ,
|
||||||
h,
|
h,
|
||||||
mantle,
|
|
||||||
engine,
|
engine,
|
||||||
new ResolvedBiome(bottomBiome, resolved.matter()),
|
bottomBiome,
|
||||||
context.getDimensionStackLayout(xf, zf)
|
context.getDimensionStackLayout(xf, zf)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
writeHistoricalColumn(h, mantle, xf, zf, worldX, worldZ, height, engine, complex);
|
writeHistoricalColumn(h, xf, zf, worldX, worldZ, height, engine, complex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
engine.getMetrics().getBiome().put(p.getMilliseconds());
|
engine.getMetrics().getBiome().put(p.getMilliseconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void publishNaturalMetadata(Engine engine, int x, int z, Hunk<NativeBiome> biomes,
|
|
||||||
ChunkContext context) {
|
|
||||||
if (!context.getComplex().allowsMantleChunkWrite(x >> 4, z >> 4)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Mantle<Matter> mantle = engine.getMantle().getMantle();
|
|
||||||
MantleChunk<Matter> chunk = mantle.getChunk(x >> 4, z >> 4).use();
|
|
||||||
try {
|
|
||||||
synchronized (chunk) {
|
|
||||||
IrisDimensionStackActuator.clearNaturalMetadata(chunk, context, biomes.getHeight());
|
|
||||||
chunk.deleteSlices(MatterBiomeInject.class);
|
|
||||||
for (int localX = 0; localX < biomes.getWidth(); localX += 4) {
|
|
||||||
for (int localZ = 0; localZ < biomes.getDepth(); localZ += 4) {
|
|
||||||
for (int y = 0; y < biomes.getHeight(); y += 4) {
|
|
||||||
NativeBiome biome = biomes.getRaw(localX, y, localZ);
|
|
||||||
if (biome != null) {
|
|
||||||
mantle.set(x + localX, y, z + localZ, BiomeInjectMatter.get(biome.key()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
chunk.release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeHistoricalColumn(
|
private void writeHistoricalColumn(
|
||||||
Hunk<NativeBiome> output,
|
Hunk<NativeBiome> output,
|
||||||
Mantle<Matter> mantle,
|
|
||||||
int localX,
|
int localX,
|
||||||
int localZ,
|
int localZ,
|
||||||
int worldX,
|
int worldX,
|
||||||
@@ -167,12 +132,9 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
applyBiomeRange(
|
applyBiomeRange(
|
||||||
localX,
|
localX,
|
||||||
localZ,
|
localZ,
|
||||||
worldX,
|
|
||||||
worldZ,
|
|
||||||
rangeStart,
|
rangeStart,
|
||||||
internalY - 1,
|
internalY - 1,
|
||||||
output,
|
output,
|
||||||
mantle,
|
|
||||||
resolvePhysicalKey(activeKey)
|
resolvePhysicalKey(activeKey)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -181,33 +143,14 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeColumn(
|
|
||||||
Hunk<NativeBiome> output,
|
|
||||||
Mantle<Matter> mantle,
|
|
||||||
int localX,
|
|
||||||
int localZ,
|
|
||||||
int worldX,
|
|
||||||
int worldZ,
|
|
||||||
int height,
|
|
||||||
ResolvedBiome resolved
|
|
||||||
) {
|
|
||||||
if (resolved.biome() != null) {
|
|
||||||
output.set(localX, 0, localZ, localX, height - 1, localZ, resolved.biome());
|
|
||||||
}
|
|
||||||
if (mantle != null) {
|
|
||||||
mantle.set(worldX, 0, worldZ, resolved.matter());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyDimensionStackBiomes(
|
private void applyDimensionStackBiomes(
|
||||||
int localX,
|
int localX,
|
||||||
int localZ,
|
int localZ,
|
||||||
int worldX,
|
int worldX,
|
||||||
int worldZ,
|
int worldZ,
|
||||||
Hunk<NativeBiome> output,
|
Hunk<NativeBiome> output,
|
||||||
Mantle<Matter> mantle,
|
|
||||||
Engine engine,
|
Engine engine,
|
||||||
ResolvedBiome bottom,
|
NativeBiome bottom,
|
||||||
DimensionStackLayout layout
|
DimensionStackLayout layout
|
||||||
) {
|
) {
|
||||||
List<DimensionStackLayout.Layer> layers = layout.layersBottomToTop();
|
List<DimensionStackLayout.Layer> layers = layout.layersBottomToTop();
|
||||||
@@ -222,18 +165,15 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
applyBiomeRange(
|
applyBiomeRange(
|
||||||
localX,
|
localX,
|
||||||
localZ,
|
localZ,
|
||||||
worldX,
|
|
||||||
worldZ,
|
|
||||||
gapMinY,
|
gapMinY,
|
||||||
gapMaxY,
|
gapMaxY,
|
||||||
output,
|
output,
|
||||||
mantle,
|
|
||||||
bottom
|
bottom
|
||||||
);
|
);
|
||||||
if (!layer.visible()) {
|
if (!layer.visible()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ResolvedBiome resolved = bottom;
|
NativeBiome resolved = bottom;
|
||||||
if (layer.biome() != null) {
|
if (layer.biome() != null) {
|
||||||
IrisDimension dimension = layer.terrainContext().getDimension();
|
IrisDimension dimension = layer.terrainContext().getDimension();
|
||||||
resolved = resolve(biomeKey(
|
resolved = resolve(biomeKey(
|
||||||
@@ -248,12 +188,9 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
applyBiomeRange(
|
applyBiomeRange(
|
||||||
localX,
|
localX,
|
||||||
localZ,
|
localZ,
|
||||||
worldX,
|
|
||||||
worldZ,
|
|
||||||
layer.renderMinY(),
|
layer.renderMinY(),
|
||||||
layer.renderMaxY(),
|
layer.renderMaxY(),
|
||||||
output,
|
output,
|
||||||
mantle,
|
|
||||||
resolved
|
resolved
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -262,46 +199,15 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
private void applyBiomeRange(
|
private void applyBiomeRange(
|
||||||
int localX,
|
int localX,
|
||||||
int localZ,
|
int localZ,
|
||||||
int worldX,
|
|
||||||
int worldZ,
|
|
||||||
int minimumY,
|
int minimumY,
|
||||||
int maximumY,
|
int maximumY,
|
||||||
Hunk<NativeBiome> output,
|
Hunk<NativeBiome> output,
|
||||||
Mantle<Matter> mantle,
|
NativeBiome biome
|
||||||
ResolvedBiome resolved
|
|
||||||
) {
|
) {
|
||||||
if (minimumY > maximumY) {
|
if (minimumY > maximumY || biome == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mantle != null) {
|
output.set(localX, minimumY, localZ, localX, maximumY, localZ, biome);
|
||||||
clearBiomeMatterRange(mantle, worldX, worldZ, minimumY, maximumY);
|
|
||||||
}
|
|
||||||
if (resolved.biome() != null) {
|
|
||||||
output.set(
|
|
||||||
localX,
|
|
||||||
minimumY,
|
|
||||||
localZ,
|
|
||||||
localX,
|
|
||||||
maximumY,
|
|
||||||
localZ,
|
|
||||||
resolved.biome()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (mantle != null && resolved.matter() != null) {
|
|
||||||
mantle.set(worldX, minimumY, worldZ, resolved.matter());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void clearBiomeMatterRange(
|
|
||||||
Mantle<Matter> mantle,
|
|
||||||
int worldX,
|
|
||||||
int worldZ,
|
|
||||||
int minimumY,
|
|
||||||
int maximumY
|
|
||||||
) {
|
|
||||||
for (int y = minimumY; y <= maximumY; y++) {
|
|
||||||
mantle.remove(worldX, y, worldZ, MatterBiomeInject.class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String biomeKey(
|
private String biomeKey(
|
||||||
@@ -319,37 +225,28 @@ public class IrisBiomeActuator extends EngineAssignedActuator<NativeBiome> {
|
|||||||
return biome.getSkyBiomeKey(rng, engine, x, y, z);
|
return biome.getSkyBiomeKey(rng, engine, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResolvedBiome resolve(String key) {
|
private NativeBiome resolve(String key) {
|
||||||
ResolvedBiome cached = key == null ? null : resolvedBiomes.get(key);
|
NativeBiome cached = key == null ? null : resolvedBiomes.get(key);
|
||||||
if (cached != null) {
|
if (cached != null) {
|
||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisPlatform platform = IrisPlatforms.get();
|
NativeBiome biome = IrisPlatforms.get().registries().biome(key);
|
||||||
NativeBiome biome = platform.registries().biome(key);
|
|
||||||
ResolvedBiome resolved = new ResolvedBiome(
|
|
||||||
biome,
|
|
||||||
BiomeInjectMatter.get(platform.biomeWriter().biomeIdFor(key))
|
|
||||||
);
|
|
||||||
if (key != null && biome != null) {
|
if (key != null && biome != null) {
|
||||||
resolvedBiomes.put(key, resolved);
|
resolvedBiomes.put(key, biome);
|
||||||
}
|
}
|
||||||
return resolved;
|
return biome;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResolvedBiome resolvePhysicalKey(String key) {
|
private NativeBiome resolvePhysicalKey(String key) {
|
||||||
ResolvedBiome cached = resolvedPhysicalBiomes.get(key);
|
NativeBiome cached = resolvedPhysicalBiomes.get(key);
|
||||||
if (cached != null) {
|
if (cached != null) {
|
||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
NativeBiome biome = IrisPlatforms.get().registries().biome(key);
|
NativeBiome biome = IrisPlatforms.get().registries().biome(key);
|
||||||
ResolvedBiome resolved = new ResolvedBiome(biome, BiomeInjectMatter.get(key));
|
|
||||||
if (biome != null) {
|
if (biome != null) {
|
||||||
resolvedPhysicalBiomes.put(key, resolved);
|
resolvedPhysicalBiomes.put(key, biome);
|
||||||
}
|
}
|
||||||
return resolved;
|
return biome;
|
||||||
}
|
|
||||||
|
|
||||||
private record ResolvedBiome(NativeBiome biome, MatterBiomeInject matter) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+15
-1
@@ -106,7 +106,21 @@ public final class IrisDimensionStackActuator extends EngineAssignedActuator<Nat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearNaturalMetadata(MantleChunk<Matter> chunk, ChunkContext context, int height) {
|
public static void clearHostNaturalMetadata(Engine engine, int x, int z, int height, ChunkContext context) {
|
||||||
|
if (!context.hasDimensionStack() || !context.getComplex().allowsMantleChunkWrite(x >> 4, z >> 4)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MantleChunk<Matter> chunk = engine.getMantle().getMantle().getChunk(x >> 4, z >> 4).use();
|
||||||
|
try {
|
||||||
|
synchronized (chunk) {
|
||||||
|
clearNaturalMetadata(chunk, context, height);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
chunk.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clearNaturalMetadata(MantleChunk<Matter> chunk, ChunkContext context, int height) {
|
||||||
MetadataCleaner metadata = new MetadataCleaner(chunk, height);
|
MetadataCleaner metadata = new MetadataCleaner(chunk, height);
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
|
|||||||
-2
@@ -44,7 +44,6 @@ import art.arcane.volmlib.util.hunk.Hunk;
|
|||||||
import art.arcane.volmlib.util.noise.CNG;
|
import art.arcane.volmlib.util.noise.CNG;
|
||||||
import art.arcane.volmlib.util.collection.KList;
|
import art.arcane.volmlib.util.collection.KList;
|
||||||
import art.arcane.volmlib.util.math.RNG;
|
import art.arcane.volmlib.util.math.RNG;
|
||||||
import art.arcane.volmlib.util.matter.slices.BiomeInjectMatter;
|
|
||||||
import art.arcane.volmlib.util.scheduling.PrecisionStopwatch;
|
import art.arcane.volmlib.util.scheduling.PrecisionStopwatch;
|
||||||
import art.arcane.iris.spi.IrisPlatforms;
|
import art.arcane.iris.spi.IrisPlatforms;
|
||||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||||
@@ -431,7 +430,6 @@ public class IrisFloatingChildBiomeModifier extends EngineAssignedModifier<Nativ
|
|||||||
}
|
}
|
||||||
context.setNaturalBiome(wx & 15, y, wz & 15, selected);
|
context.setNaturalBiome(wx & 15, y, wz & 15, selected);
|
||||||
context.floatingBiomes(chunkHeight).record(wx & 15, y, wz & 15, matter.identity());
|
context.floatingBiomes(chunkHeight).record(wx & 15, y, wz & 15, matter.identity());
|
||||||
getEngine().getMantle().getMantle().set(wx, y, wz, BiomeInjectMatter.get(selected.key()));
|
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
IrisLogging.reportError(e);
|
IrisLogging.reportError(e);
|
||||||
|
|||||||
+48
-32
@@ -20,7 +20,6 @@ import art.arcane.volmlib.util.hunk.Hunk;
|
|||||||
import art.arcane.volmlib.util.mantle.runtime.Mantle;
|
import art.arcane.volmlib.util.mantle.runtime.Mantle;
|
||||||
import art.arcane.volmlib.util.math.RNG;
|
import art.arcane.volmlib.util.math.RNG;
|
||||||
import art.arcane.volmlib.util.matter.Matter;
|
import art.arcane.volmlib.util.matter.Matter;
|
||||||
import art.arcane.volmlib.util.matter.MatterBiomeInject;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -34,13 +33,13 @@ import static org.mockito.ArgumentMatchers.any;
|
|||||||
import static org.mockito.ArgumentMatchers.anyDouble;
|
import static org.mockito.ArgumentMatchers.anyDouble;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.ArgumentMatchers.argThat;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.ArgumentMatchers.same;
|
import static org.mockito.ArgumentMatchers.same;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@@ -54,19 +53,58 @@ public class IrisBiomeActuatorCoordinateTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
public void historicalStackChunkDoesNotClearPersistentMetadata() {
|
||||||
public void historicalChunkDoesNotPublishNewPersistentMetadata() {
|
|
||||||
Engine engine = mock(Engine.class);
|
Engine engine = mock(Engine.class);
|
||||||
ChunkContext context = mock(ChunkContext.class);
|
ChunkContext context = mock(ChunkContext.class);
|
||||||
IrisComplex complex = mock(IrisComplex.class);
|
IrisComplex complex = mock(IrisComplex.class);
|
||||||
|
when(context.hasDimensionStack()).thenReturn(true);
|
||||||
when(context.getComplex()).thenReturn(complex);
|
when(context.getComplex()).thenReturn(complex);
|
||||||
when(complex.allowsMantleChunkWrite(0, 0)).thenReturn(false);
|
when(complex.allowsMantleChunkWrite(0, 0)).thenReturn(false);
|
||||||
|
|
||||||
IrisBiomeActuator.publishNaturalMetadata(engine, 0, 0, mock(Hunk.class), context);
|
IrisDimensionStackActuator.clearHostNaturalMetadata(engine, 0, 0, 16, context);
|
||||||
|
|
||||||
verifyNoMoreInteractions(engine);
|
verifyNoMoreInteractions(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void unstackedChunkNeverTouchesTheMantle() {
|
||||||
|
Engine engine = mock(Engine.class);
|
||||||
|
ChunkContext context = mock(ChunkContext.class);
|
||||||
|
when(context.hasDimensionStack()).thenReturn(false);
|
||||||
|
|
||||||
|
IrisDimensionStackActuator.clearHostNaturalMetadata(engine, 0, 0, 16, context);
|
||||||
|
|
||||||
|
verifyNoMoreInteractions(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void actuatorWritesColumnBiomesWithoutMantleMetadata() {
|
||||||
|
bindPlatform();
|
||||||
|
IrisComplex complex = mock(IrisComplex.class);
|
||||||
|
Engine engine = engine(complex);
|
||||||
|
IrisBiomeActuator actuator = new IrisBiomeActuator(engine);
|
||||||
|
Hunk<NativeBiome> output = mock(Hunk.class);
|
||||||
|
when(output.getWidth()).thenReturn(2);
|
||||||
|
when(output.getDepth()).thenReturn(2);
|
||||||
|
when(output.getHeight()).thenReturn(8);
|
||||||
|
ChunkedDataCache<IrisBiome> biomeCache = currentBiomeCache(engine);
|
||||||
|
ChunkContext context = mock(ChunkContext.class);
|
||||||
|
when(context.getComplex()).thenReturn(complex);
|
||||||
|
when(context.getBiome()).thenReturn(biomeCache);
|
||||||
|
|
||||||
|
actuator.onActuate(100, -200, output, false, context);
|
||||||
|
|
||||||
|
NativeBiome plains = IrisPlatforms.get().registries().biome("minecraft:plains");
|
||||||
|
for (int x = 0; x < 2; x++) {
|
||||||
|
for (int z = 0; z < 2; z++) {
|
||||||
|
verify(output).set(x, 0, z, x, 7, z, plains);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
verifyNoInteractions(engine.getMantle().getMantle());
|
||||||
|
verify(IrisPlatforms.get().biomeWriter(), never()).biomeIdFor(anyString());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void derivativeScatterUsesEachWorldColumnCoordinate() {
|
public void derivativeScatterUsesEachWorldColumnCoordinate() {
|
||||||
@@ -101,19 +139,6 @@ public class IrisBiomeActuatorCoordinateTest {
|
|||||||
assertEquals(List.of("100,-200", "100,-199", "101,-200", "101,-199"), samples);
|
assertEquals(List.of("100,-200", "100,-199", "101,-200", "101,-199"), samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void stackedBiomeReplacementRemovesEveryExistingMarkerWithItsTypedSlice() {
|
|
||||||
Mantle<Matter> mantle = mock(Mantle.class);
|
|
||||||
|
|
||||||
IrisBiomeActuator.clearBiomeMatterRange(mantle, 100, -200, 4, 6);
|
|
||||||
|
|
||||||
verify(mantle).remove(100, 4, -200, MatterBiomeInject.class);
|
|
||||||
verify(mantle).remove(100, 5, -200, MatterBiomeInject.class);
|
|
||||||
verify(mantle).remove(100, 6, -200, MatterBiomeInject.class);
|
|
||||||
verifyNoMoreInteractions(mantle);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void transitionColumnOverlaysFrozenPhysicalKeyAfterCurrentBiome() {
|
public void transitionColumnOverlaysFrozenPhysicalKeyAfterCurrentBiome() {
|
||||||
@@ -143,11 +168,8 @@ public class IrisBiomeActuatorCoordinateTest {
|
|||||||
verify(biomeCache).get(0, 0);
|
verify(biomeCache).get(0, 0);
|
||||||
verify(IrisPlatforms.get().registries()).biome("iris:old-physical");
|
verify(IrisPlatforms.get().registries()).biome("iris:old-physical");
|
||||||
verify(IrisPlatforms.get().biomeWriter(), never()).biomeIdFor("iris:old-physical");
|
verify(IrisPlatforms.get().biomeWriter(), never()).biomeIdFor("iris:old-physical");
|
||||||
Mantle<Matter> mantle = engine.getMantle().getMantle();
|
verify(output, times(2)).set(0, 0, 0, 0, 0, 0, IrisPlatforms.get().registries().biome("iris:old-physical"));
|
||||||
verify(mantle).set(eq(100), eq(0), eq(-200), argThat(value -> {
|
verifyNoInteractions(engine.getMantle().getMantle());
|
||||||
MatterBiomeInject injection = (MatterBiomeInject) value;
|
|
||||||
return !injection.isCustom() && "iris:old-physical".equals(injection.getBiomeKey());
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -184,15 +206,9 @@ public class IrisBiomeActuatorCoordinateTest {
|
|||||||
verify(transitionPlan, never()).historicalPhysicalBiomeKeyAt(anyInt(), 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(NativeBiome.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));
|
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(IrisPlatforms.get().registries()).biome("iris:old-bottom");
|
||||||
verify(mantle).set(eq(100), eq(0), eq(-200), argThat(value -> {
|
verify(IrisPlatforms.get().registries()).biome("iris:old-top");
|
||||||
MatterBiomeInject injection = (MatterBiomeInject) value;
|
verifyNoInteractions(engine.getMantle().getMantle());
|
||||||
return "iris:old-bottom".equals(injection.getBiomeKey());
|
|
||||||
}));
|
|
||||||
verify(mantle).set(eq(100), eq(4), eq(-200), argThat(value -> {
|
|
||||||
MatterBiomeInject injection = (MatterBiomeInject) value;
|
|
||||||
return "iris:old-top".equals(injection.getBiomeKey());
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
Reference in new issue
Block a user