diff --git a/crates/horizon-world/examples/chunk_dump.rs b/crates/horizon-world/examples/chunk_dump.rs index 26f8f6adf..125509d99 100644 --- a/crates/horizon-world/examples/chunk_dump.rs +++ b/crates/horizon-world/examples/chunk_dump.rs @@ -292,6 +292,20 @@ fn main() -> Result<(), Error> { p.x, p.y, p.z, t.priority as i32 )?; } + // Postprocessing marks, per section in list order. + let base = chunk.terrain.min_y() >> 4; + for (i, marks) in chunk.terrain.postprocessing().iter().enumerate() { + for &packed in marks { + let p = i32::from(packed); + writeln!( + w, + "p {} {} {}", + x * 16 + (p & 15), + (base + i as i32) * 16 + ((p >> 4) & 15), + z * 16 + ((p >> 8) & 15) + )?; + } + } } } } diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkGenerationOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkGenerationOracle.java index 35b9e6bce..8e2af5f33 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkGenerationOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkGenerationOracle.java @@ -442,6 +442,16 @@ public final class VanillaChunkGenerationOracle { for (var t : ((net.minecraft.world.ticks.ProtoChunkTicks) proto.getFluidTicks()).scheduledTicks()) w.println("t fluid " + net.minecraft.core.registries.BuiltInRegistries.FLUID.getKey(t.type()) + " " + t.pos().getX() + " " + t.pos().getY() + " " + t.pos().getZ() + " " + t.priority().getValue()); } + // Postprocessing marks, per section in list order (LevelChunk.postProcessGeneration + // ticks their fluids and reshapes their blocks once the chunk is live). + var marks = target.getPostProcessing(); + for (int i = 0; i < marks.length; i++) { + if (marks[i] == null) continue; + for (short packed : marks[i]) { + var p = ProtoChunk.unpackOffsetCoordinates(packed, target.getSectionYFromSectionIndex(i), target.getPos()); + w.println("p " + p.getX() + " " + p.getY() + " " + p.getZ()); + } + } } } } diff --git a/tools/test_chunk_generation_parity.py b/tools/test_chunk_generation_parity.py index 9e2487206..13262dc3b 100644 --- a/tools/test_chunk_generation_parity.py +++ b/tools/test_chunk_generation_parity.py @@ -93,7 +93,7 @@ def parse(path): if line.startswith('chunk '): _, x, z = line.split() current = (int(x), int(z)) - chunks[current] = {'q': {}, 'y': {}, 'be': {}, 't': []} + chunks[current] = {'q': {}, 'y': {}, 'be': {}, 't': [], 'p': []} elif line.startswith('q '): _, q, row = line.split(' ', 2) chunks[current]['q'][int(q)] = row @@ -102,6 +102,8 @@ def parse(path): chunks[current]['y'][int(y)] = row elif line.startswith('t '): chunks[current]['t'].append(line[2:]) + elif line.startswith('p '): + chunks[current]['p'].append(line[2:]) elif line.startswith('be '): head, *forms = line.split('\t') parts = head.split(' ') @@ -241,6 +243,17 @@ def compare(vanilla, rust, names, label, limit=6, quiet=False): first = next((i for i, (u, v) in enumerate(zip(ta, tb)) if u != v), min(len(ta), len(tb))) block_diffs.append((pos[0] * 16, 0, pos[1] * 16, f'{len(ta)} ticks, #{first}: {ta[first] if first < len(ta) else "-"}', f'{len(tb)} ticks, #{first}: {tb[first] if first < len(tb) else "-"}')) + # Postprocessing marks: their fluids tick and their blocks are reshaped once the chunk is live. + if a.get('p', []) != b.get('p', []): + pa, pb = a.get('p', []), b.get('p', []) + first = next((i for i, (u, v) in enumerate(zip(pa, pb)) if u != v), min(len(pa), len(pb))) + extra = Counter(pb) - Counter(pa) + missing = Counter(pa) - Counter(pb) + block_diffs.append((pos[0] * 16, 0, pos[1] * 16, + f'{len(pa)} postprocessing marks, #{first}: {pa[first] if first < len(pa) else "-"}' + f' ({sum(missing.values())} not in Horizon, e.g. {next(iter(missing), "-")})', + f'{len(pb)} marks, #{first}: {pb[first] if first < len(pb) else "-"}' + f' ({sum(extra.values())} not in vanilla, e.g. {next(iter(extra), "-")})')) if block_diffs or biome_diffs or entity_diffs: chunks += 1 blocks += len(block_diffs)