Drop stale cave snapshots

- dimension stack metadata clearing and continuation restore rewrite cavern cells after sCave, so they drop the context snapshot and decoration re-reads the mantle
- test that decoration reuses only its own chunk's snapshot
This commit is contained in:
Brian Neumann-Fopiano committed 2026-09-28 13:55:18 -04:00
1 parent 195f1862af
commit 55e4a70b3b
4 files changed
+31 -2

No files matched your search

@@ -17,8 +17,9 @@ import java.util.function.IntFunction;
/**
* The terrain view of one mantle chunk's cavern and hydrology cells (journaled pre-object values win),
* copied once under the chunk monitor. Terrain components finish before any content write reaches a
* chunk and every later write journals the value it replaces, so this view never goes stale while the
* chunk generates.
* chunk and every mantle-writer write journals the value it replaces, so the view holds while the chunk
* generates; the raw writers that run after sCave (dimension stack clearing, continuation restore) drop
* it from the chunk context instead.
*/
public final class CaveTerrainSnapshot {
private static final int SECTION_VOLUME = 4096;
@@ -218,6 +218,9 @@ public interface EngineMode extends Staged {
IrisDimensionStackActuator.clearHostNaturalMetadata(getEngine(), x, z, biomes.getHeight(), ctx);
ctx.beginContent();
List<Matter> continuations = restoreObjectContinuations(x, z);
if (!continuations.isEmpty()) {
ctx.setCaveTerrain(null);
}
for (EngineStage i : stages) {
i.generate(x, z, blocks, biomes, multicore, ctx);
}
@@ -110,6 +110,7 @@ public final class IrisDimensionStackActuator extends EngineAssignedActuator<Nat
if (!context.hasDimensionStack() || !context.getComplex().allowsMantleChunkWrite(x >> 4, z >> 4)) {
return;
}
context.setCaveTerrain(null);
MantleChunk<Matter> chunk = engine.getMantle().getMantle().getChunk(x >> 4, z >> 4).use();
try {
synchronized (chunk) {