[PR #3608] [MERGED] Draw the phantom's model inside its box (#3008) #5091

Closed
opened 2026-11-03 05:10:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3608
Author: @degepie
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/issue-3008-phantom-hitbox


📝 Commits (1)

  • d32e7ff Draw the phantom's model inside its box

📊 Changes

1 file changed (+41 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/mobs/render.rs (+41 -0)

📄 Description

🤖 Opened by degepie's AI agent (Claude Code), not by degepie personally.

Fixes #3008.

What

With hitboxes shown (F3+B), a phantom's box was drawn about a block below the phantom. The box was correct. The model was drawn too high.

Vanilla

  • EntityType.PHANTOM: 0.9 × 0.5, eye height 0.175. entity-types.json already has these numbers, and horizon-ctl entities reports the summoned position as the feet in both builds, so the box, hits and collisions were never wrong.
  • PhantomRenderer.scale scales the pose by 1 + 0.15 * size. It then translates by (0, 1.3125, 0.1875) in the flipped model space, which moves the model down toward the feet. Without that step the model's origin sits at 1.501 above the feet. With it, the origin sits at 1.501 − 1.3125 = 0.1885 (times the scale). That missing 1.3125 is the "about one block" in the report.
  • PhantomRenderer.setupRotations also rotates the body about X by the phantom's pitch, after the usual yaw.

How

crates/horizon-client/src/mobs/render.rs:

  • species_scale gets a Species::Phantom arm: the size scale, then the translate. It sits in the same place as vanilla's scale hook (after the (-1, -1, 1) flip, before the −1.501 translate).
  • species_rotations gets a Species::Phantom arm: rotate about X by the interpolated head_pitch. This is the field phantom.rs's move control writes, as vanilla's writes xRot.
  • A unit test checks that the model origin of a size-0 phantom and a size-5 phantom ends at (1.501 − 1.3125) × scale above the feet, and 0.1875 × scale along z.

The diff adds lines to two match arms and one test (+41 −0). render.rs is touched by other open PRs, but none of them changes species_scale or species_rotations.

Verified

  • In game, server-thread single player, summon phantom ~ ~1.5 ~4 {NoAI:1b} plus a {NoAI:1b,Size:5} one, F3+B:
    • v0.2.91: both models float well above their boxes.
    • This branch: the bodies sit inside their boxes.
  • cargo test -p horizon-client --lib mobs::render::tests: 5 passed, including the new the_phantom_model_sits_in_its_box.
  • python3 tools/parity.py entity_model: PASS.

Known differences

  • The phantom's size is still never read. Summon/load NBT Size is parsed only for slimes, and the synced DATA_SIZE_ID is not mapped in remote_mob_data.rs. So {Size:5} still draws and boxes like size 0. This change scales the model correctly once the size arrives. Scaling the box by size (Phantom.getDefaultDimensions) is a separate gap.
  • The pitch rotation was not checked against vanilla in game: a NoAI phantom has pitch 0.

pr_ready (tools/pr_ready.py --quick on horizon-build, against origin/main at 11494e17f, 7 min 21 s)

Check Result
Scope ✅ 1 files, +41 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 408 passed (29 s)
rustfmt ✅ (8 s)
clippy ✅ (2 min 21 s)
tests: horizon-client ✅ 799 passed (4 min 4 s)
doc tests ✅ 0 passed (16 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 347 affected, to run in CI (--quick)

🤖 Generated with Claude Code


🔄 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/3608 **Author:** [@degepie](https://github.com/degepie) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/issue-3008-phantom-hitbox` --- ### 📝 Commits (1) - [`d32e7ff`](https://github.com/horizon-rust/horizon/commit/d32e7ff887f0522e87f9446b5da11874a17a9c0e) Draw the phantom's model inside its box ### 📊 Changes **1 file changed** (+41 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/render.rs` (+41 -0) </details> ### 📄 Description > 🤖 Opened by degepie's AI agent (Claude Code), not by degepie personally. Fixes #3008. ## What With hitboxes shown (F3+B), a phantom's box was drawn about a block below the phantom. The box was correct. The model was drawn too high. ## Vanilla - `EntityType.PHANTOM`: 0.9 × 0.5, eye height 0.175. `entity-types.json` already has these numbers, and `horizon-ctl entities` reports the summoned position as the feet in both builds, so the box, hits and collisions were never wrong. - `PhantomRenderer.scale` scales the pose by `1 + 0.15 * size`. It then translates by (0, 1.3125, 0.1875) in the flipped model space, which moves the model down toward the feet. Without that step the model's origin sits at 1.501 above the feet. With it, the origin sits at 1.501 − 1.3125 = 0.1885 (times the scale). That missing 1.3125 is the "about one block" in the report. - `PhantomRenderer.setupRotations` also rotates the body about X by the phantom's pitch, after the usual yaw. ## How `crates/horizon-client/src/mobs/render.rs`: - `species_scale` gets a `Species::Phantom` arm: the size scale, then the translate. It sits in the same place as vanilla's `scale` hook (after the (-1, -1, 1) flip, before the −1.501 translate). - `species_rotations` gets a `Species::Phantom` arm: rotate about X by the interpolated `head_pitch`. This is the field `phantom.rs`'s move control writes, as vanilla's writes xRot. - A unit test checks that the model origin of a size-0 phantom and a size-5 phantom ends at (1.501 − 1.3125) × scale above the feet, and 0.1875 × scale along z. The diff adds lines to two match arms and one test (+41 −0). `render.rs` is touched by other open PRs, but none of them changes `species_scale` or `species_rotations`. ## Verified - In game, server-thread single player, `summon phantom ~ ~1.5 ~4 {NoAI:1b}` plus a `{NoAI:1b,Size:5}` one, F3+B: - v0.2.91: both models float well above their boxes. - This branch: the bodies sit inside their boxes. - `cargo test -p horizon-client --lib mobs::render::tests`: 5 passed, including the new `the_phantom_model_sits_in_its_box`. - `python3 tools/parity.py entity_model`: PASS. ## Known differences - The phantom's size is still never read. Summon/load NBT `Size` is parsed only for slimes, and the synced `DATA_SIZE_ID` is not mapped in `remote_mob_data.rs`. So `{Size:5}` still draws and boxes like size 0. This change scales the model correctly once the size arrives. Scaling the box by size (`Phantom.getDefaultDimensions`) is a separate gap. - The pitch rotation was not checked against vanilla in game: a NoAI phantom has pitch 0. **pr_ready** (`tools/pr_ready.py --quick` on horizon-build, against origin/main at 11494e17f, 7 min 21 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +41 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 408 passed (29 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (2 min 21 s) | | tests: horizon-client | ✅ 799 passed (4 min 4 s) | | doc tests | ✅ 0 passed (16 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 347 affected, to run in CI (--quick) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:10:10 +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#5091
No description provided.