Merge pull request #1109 from ludovic111/tools/chunk-harness-postprocess

🤖 Agent: merged. Verify and CI parity pass (chunk harness tooling).
This commit is contained in:
Ludovic Marie
2026-10-22 01:03:10 +02:00
committed by GitHub
3 changed files with 38 additions and 1 deletions
@@ -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)
)?;
}
}
}
}
}
@@ -442,6 +442,16 @@ public final class VanillaChunkGenerationOracle {
for (var t : ((net.minecraft.world.ticks.ProtoChunkTicks<net.minecraft.world.level.material.Fluid>) 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());
}
}
}
}
}
+14 -1
View File
@@ -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)