[PR #7020] [MERGED] Explosions and wind bursts use a mob's real size #7276

Closed
opened 2026-11-03 06:36:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7020
Author: @HrafnaValkyrja
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/blast-mob-size


📝 Commits (2)

  • 28eb8bc Blast and wind aim at a baby's or slime's real box and eye height
  • 3a8fe38 Merge remote-tracking branch 'origin/main' into fix/blast-mob-size

📊 Changes

2 files changed (+38 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game/entity.rs (+4 -9)
📝 crates/horizon-client/src/game/explosion.rs (+34 -0)

📄 Description

🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself.

What was wrong

Entity for Mob in crates/horizon-client/src/game/entity.rs gave the shared explosion code the adult kind's box and eye height (explosion_box and explosion_eye_height read kind.width/height/eye_height). A baby or a slime of size 2 or more was therefore blasted as if it were full size: wrong share of the box that the blast can see, and the push aimed from the wrong height. The explosion walk (#6919) kept this from the old blast code. The wind walk (#6922) moved wind onto it, so wind lost the scaled height and eye height it used before.

Fixes #7019

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Checked with tools/rea_vanilla.py --jar server-game on the pinned 26.3 jar.

  • ServerExplosion.hurtEntities: the aim point is entity.getEyePosition() (PrimedTnt uses position()), the distance is entity.distanceToSqr(center) over the doubled radius, the push is (1 - dist) * exposure * knockbackMultiplier * (1 - explosion knockback resistance).
  • ServerExplosion.getSeenPercent reads entity.getBoundingBox().
    Both are the mob's current box and eye height, which for a baby or a slime are its scaled ones (Mob.dims() in Horizon already holds them). The fix drops the override of the box (the default is the real bounds()) and takes the eye height from Mob.eye_height().

Proof

Two scenes, tick-stepped 5 ticks, beside the real server (sbs.py, 13 kinds x 4 spots each, tolerance 1e-6): wind_scaled (a wind charge, spots 0.5, 0.9, 1.3 and 2.0 blocks away, the last behind a block) and blast_scaled (primed TNT, 2.5, 5.0, 7.0 and 4.0 behind a block). Kinds: pig and zombie (adult), baby zombie, pig, cow, chicken and villager, slimes of size 1, 2 and 4, magma cube size 2, armor stand and small armor stand.

scene values matching, before the fix after the fix scaled mobs differing before / after
wind_scaled 456 of 624 552 of 624 96 values / 0
blast_scaled 520 of 624 616 of 624 96 values / 0

Example, after the TNT blast, 2.5 blocks away (motion x, y): size-4 slime vanilla 0.6159, 0.3052, Horizon before 0.6836, 0.0721 (the size-1 value), after 0.6159, 0.3052. Baby pig wind charge, 0.5 blocks: vanilla 0.3024, 0.6992, before 0.2388, 0.7234, after equal to vanilla.
The remaining 72 and 8 values are armor stands only: from the first tick a stand summoned with NoGravity:1b gets gravity in Horizon (motion y -0.0784) and stays put in vanilla. That is the summon path, not the blast box; not touched here.
Wind scenes from the earlier wind slice (wind_walk, wind_breeze): 84 of 99 values each, with and without the fix (the earlier slice measured 80 of 99). The 15 values that differ are tridents, orbs, falling blocks and primed TNT, the same kinds as in that slice; no mob or stand among them.

Regression test: game::explosion::tests::a_scaled_mob_is_blasted_by_its_own_box_and_eye_height (baby zombie, size-4 slime): passes with the fix, fails with entity.rs reverted.

Harnesses

python3 tools/parity.py --fresh mace arrow_wind_charge pearl_wind_charge dispenser with DISPLAY=:0 HORIZON_E2E_HEADLESS=1: 4 passed, 0 failed (dispenser 19 s, mace 23 s, arrow_wind_charge 84 s, pearl_wind_charge 84 s).
python3 tools/pr_ready.py --quick: public tree, Python tests, rustfmt, clippy, horizon-client tests, doc tests and mod API all pass (the 267 affected parity harnesses are left to CI, as --quick does).

Proved by script against the real 26.3 server; no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at e6406b7a0, 6 min 16 s)

Check Result
Scope ✅ 2 files, +38 −9
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 611 passed (39 s)
rustfmt ✅ (11 s)
Rust ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (2 min 25 s)
tests: horizon-client ✅ 656 passed (2 min 27 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
mod API up to date ✅ (24 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 266 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute, attribute_updates and 254 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code

https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7020 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/blast-mob-size` --- ### 📝 Commits (2) - [`28eb8bc`](https://github.com/horizon-rust/horizon/commit/28eb8bc61ffbd4d6c5991f740ba84639b6fc30fb) Blast and wind aim at a baby's or slime's real box and eye height - [`3a8fe38`](https://github.com/horizon-rust/horizon/commit/3a8fe38077162cf4eafc422d445d53c2ec4461c0) Merge remote-tracking branch 'origin/main' into fix/blast-mob-size ### 📊 Changes **2 files changed** (+38 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/entity.rs` (+4 -9) 📝 `crates/horizon-client/src/game/explosion.rs` (+34 -0) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What was wrong `Entity for Mob` in `crates/horizon-client/src/game/entity.rs` gave the shared explosion code the adult kind's box and eye height (`explosion_box` and `explosion_eye_height` read `kind.width/height/eye_height`). A baby or a slime of size 2 or more was therefore blasted as if it were full size: wrong share of the box that the blast can see, and the push aimed from the wrong height. The explosion walk (#6919) kept this from the old blast code. The wind walk (#6922) moved wind onto it, so wind lost the scaled height and eye height it used before. Fixes #7019 ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Checked with `tools/rea_vanilla.py --jar server-game` on the pinned 26.3 jar. - `ServerExplosion.hurtEntities`: the aim point is `entity.getEyePosition()` (`PrimedTnt` uses `position()`), the distance is `entity.distanceToSqr(center)` over the doubled radius, the push is `(1 - dist) * exposure * knockbackMultiplier * (1 - explosion knockback resistance)`. - `ServerExplosion.getSeenPercent` reads `entity.getBoundingBox()`. Both are the mob's current box and eye height, which for a baby or a slime are its scaled ones (`Mob.dims()` in Horizon already holds them). The fix drops the override of the box (the default is the real `bounds()`) and takes the eye height from `Mob.eye_height()`. ## Proof Two scenes, tick-stepped 5 ticks, beside the real server (`sbs.py`, 13 kinds x 4 spots each, tolerance 1e-6): `wind_scaled` (a wind charge, spots 0.5, 0.9, 1.3 and 2.0 blocks away, the last behind a block) and `blast_scaled` (primed TNT, 2.5, 5.0, 7.0 and 4.0 behind a block). Kinds: pig and zombie (adult), baby zombie, pig, cow, chicken and villager, slimes of size 1, 2 and 4, magma cube size 2, armor stand and small armor stand. | scene | values matching, before the fix | after the fix | scaled mobs differing before / after | |---|---|---|---| | wind_scaled | 456 of 624 | 552 of 624 | 96 values / 0 | | blast_scaled | 520 of 624 | 616 of 624 | 96 values / 0 | Example, after the TNT blast, 2.5 blocks away (motion x, y): size-4 slime vanilla 0.6159, 0.3052, Horizon before 0.6836, 0.0721 (the size-1 value), after 0.6159, 0.3052. Baby pig wind charge, 0.5 blocks: vanilla 0.3024, 0.6992, before 0.2388, 0.7234, after equal to vanilla. The remaining 72 and 8 values are armor stands only: from the first tick a stand summoned with `NoGravity:1b` gets gravity in Horizon (motion y -0.0784) and stays put in vanilla. That is the summon path, not the blast box; not touched here. Wind scenes from the earlier wind slice (`wind_walk`, `wind_breeze`): 84 of 99 values each, with and without the fix (the earlier slice measured 80 of 99). The 15 values that differ are tridents, orbs, falling blocks and primed TNT, the same kinds as in that slice; no mob or stand among them. Regression test: `game::explosion::tests::a_scaled_mob_is_blasted_by_its_own_box_and_eye_height` (baby zombie, size-4 slime): passes with the fix, fails with `entity.rs` reverted. ## Harnesses `python3 tools/parity.py --fresh mace arrow_wind_charge pearl_wind_charge dispenser` with `DISPLAY=:0 HORIZON_E2E_HEADLESS=1`: 4 passed, 0 failed (dispenser 19 s, mace 23 s, arrow_wind_charge 84 s, pearl_wind_charge 84 s). `python3 tools/pr_ready.py --quick`: public tree, Python tests, rustfmt, clippy, horizon-client tests, doc tests and mod API all pass (the 267 affected parity harnesses are left to CI, as --quick does). Proved by script against the real 26.3 server; no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at e6406b7a0, 6 min 16 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +38 −9 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 611 passed (39 s) | | rustfmt | ✅ (11 s) | | Rust | ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (2 min 25 s) | | tests: horizon-client | ✅ 656 passed (2 min 27 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (24 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 266 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute, attribute_updates and 254 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:36:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7276
No description provided.