Merge pull request #2459 from kacpherek/fix/jigsaw-distance-padding-defaults

🤖 Agent: Gate check by Ludovic's AI agent (Claude). Checked against 26.3: `JigsawStructure`'s codec defaults (`max_distance_from_center` 80, the default `dimension_padding`), as here. Gate: this wave's 50 PRs merged on main in one tree (union 9033a9c3b): fmt and clippy `-D warnings` clean, the horizon-client (1136 lib plus the integration tests), horizon-client-core (37), horizon-world (165) and horizon-protocol (100) tests pass, the fast build links, and the 140 harnesses `parity.py` picks for the tree's changed files pass on playhorizon (remote_fireworks, a known load flake there, passed on a rerun on a quiet Mac mini). `lan_e2e.py` passes 14 checks with the host on its server thread and in-frame (chest, xp, damage, kills, projectiles, mobs, drops, body, stopsound, digging, instant_digging, books, knockback, barter); `hurt` fails on main too when run after `damage` (check-order dependency, not this wave). Thanks @kacpherek!
This commit is contained in:
Ludovic Marie
2026-10-27 04:12:04 +01:00
committed by GitHub
@@ -275,16 +275,15 @@ fn terrain(name: Option<&str>) -> TerrainAdjustment {
_ => TerrainAdjustment::None,
}
}
fn pair(value: Option<&Value>, a: &str, b: &str, default: i32) -> [i32; 2] {
/// A jigsaw field given as one number or as an object of two. In the object a
/// missing `a` is 0 and a missing `b` is `missing_b` (`JigsawStructure.MaxDistance`
/// and `DimensionPadding` default their second value, not copy the first).
fn pair(value: Option<&Value>, a: &str, b: &str, default: i32, missing_b: i32) -> [i32; 2] {
match value {
Some(Value::Number(n)) => [n.as_i64().unwrap_or(0) as i32; 2],
Some(Value::Object(o)) => {
let get = |k: &str| o.get(k).and_then(Value::as_i64).unwrap_or(0) as i32;
let first = get(a);
[
first,
o.get(b).and_then(Value::as_i64).map_or(first, |v| v as i32),
]
let get = |k: &str| o.get(k).and_then(Value::as_i64).map(|v| v as i32);
[get(a).unwrap_or(0), get(b).unwrap_or(missing_b)]
}
_ => [default; 2],
}
@@ -326,9 +325,11 @@ impl StructureRegistry {
"horizontal",
"vertical",
80,
// DimensionType.Y_SIZE.
4064,
),
aliases: v["pool_aliases"].as_array().cloned().unwrap_or_default(),
padding: pair(v.get("dimension_padding"), "bottom", "top", 0),
padding: pair(v.get("dimension_padding"), "bottom", "top", 0, 0),
waterlogging: v["liquid_settings"].as_str() != Some("ignore_waterlogging"),
checks: super::start_checks::StartChecks::decode(v.get("horizon:start_checks")),
piece_limited: v