From 50084d03d42f473954440933329ff03d3290aa61 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 10 Oct 2026 07:00:31 +0200 Subject: [PATCH] Ignore sections above the noise height and NBT integer widths in the chunk harness The Nether roof and End sky sections are all air in vanilla and Horizon keeps none, and structure templates keep their stored integer width while vanilla re-saves block entities with its own, so neither is a generation difference. Co-Authored-By: Claude Sonnet 5.5 --- tools/test_chunk_generation_parity.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/test_chunk_generation_parity.py b/tools/test_chunk_generation_parity.py index e7ee17aba..2a1a13177 100644 --- a/tools/test_chunk_generation_parity.py +++ b/tools/test_chunk_generation_parity.py @@ -153,6 +153,11 @@ def nbt_matches(vanilla, rust, default): elif value != default.get(key): return False return all(key in vanilla or key in ('x', 'y', 'z') for key in rust) + if isinstance(vanilla, list) and isinstance(rust, list): + return len(vanilla) == len(rust) and all(nbt_matches(a, b, None) for a, b in zip(vanilla, rust)) + if isinstance(vanilla, tuple) and isinstance(rust, tuple) and vanilla[0] in 'bsil' and rust[0] in 'bsil': + # Structure templates keep their stored integer width; vanilla re-saves block entities with its own. + return vanilla[1] == rust[1] return vanilla == rust @@ -167,6 +172,9 @@ def state_names(): return [s[3].removeprefix('Block{').replace('}', '', 1) for s in facts['states']] +AIR = '0' + + def compare(vanilla, rust, names, label, limit=6, quiet=False): """Returns (differing chunks, differing blocks, differing biome cells, differing block entities).""" chunks = blocks = biomes = entities = 0 @@ -181,10 +189,17 @@ def compare(vanilla, rust, names, label, limit=6, quiet=False): ra, rb = a['y'][y], b['y'].get(y) if ra == rb: continue - for i, (u, v) in enumerate(zip(ra.split(' '), (rb or '').split(' '))): + if rb is None: + # Above the noise height (Nether roof, End sky) Horizon keeps no section; vanilla's is all air. + if set(ra.split(' ')) != {AIR}: + block_diffs.append((pos[0] * 16, y, pos[1] * 16, 'non-air section', 'section missing')) + continue + for i, (u, v) in enumerate(zip(ra.split(' '), rb.split(' '))): if u != v: block_diffs.append((pos[0] * 16 + i % 16, y, pos[1] * 16 + i // 16, names[int(u)], names[int(v)])) for q in sorted(a['q']): + if q not in b['q']: + continue # biomes of sections Horizon does not generate (above the noise height) if a['q'][q] != b['q'].get(q): for i, (u, v) in enumerate(zip(a['q'][q].split(' '), b['q'].get(q, '').split(' '))): if u != v: