[PR #4045] [MERGED] A small player's server box follows minecraft:scale #5376

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

📋 Pull Request Information

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

Base: main ← Head: fix-3684-hitbox


📝 Commits (1)

  • 5b3b108 A small player's server box follows minecraft:scale

📊 Changes

3 files changed (+111 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_actions.rs (+50 -14)
📝 crates/horizon-client/src/motion.rs (+50 -0)
📝 crates/horizon-client/src/pose.rs (+11 -0)

📄 Description

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

What and why

After /attribute @s minecraft:scale base set 0.1 the client shrinks its own box, but the server kept checking the player with the old 0.6 × 1.8 one. A small player walking close to a wall was sent back on every step, and standing close to a stone wall killed them with "suffocated in a wall". #3809 reports the same thing as getting stuck and rubberbanded at small scales.

Two causes, both on the server's copy of the player (guest_server_tick, which the single-player owner on the server thread also goes through):

  • The box never changed. Vanilla's LivingEntity.tick runs refreshDirtyAttributes every tick, and onAttributeUpdated(SCALE) calls refreshDimensions. The client's simulation tick already does this (PlayerMotion::refresh_attributes), but the server's copy never did. Its dimensions only changed when its pose changed, so Hub::collide (the "moved wrongly" and "colliding with anything new" checks of handlePlayerPositionChange) kept the full-size box. The new MotionWorld::server_player_pose_tick runs aiStep's Riptide countdown, then refreshDirtyAttributes, then updatePlayerPose, in vanilla's order.
  • The suffocation box was hard-coded. in_wall used a 0.48-wide box at the eyes. Vanilla's Entity.isInWall takes dimensions.width() * 0.8, so at scale 0.1 that box is 0.048 wide. in_wall now takes the body's dimensions. The column arithmetic is in eye_columns, which has a unit test.

Part of #3684 (the hitbox part of the attribute scale item; the model scale was #3752). Also fixes the hitbox part of #3809. Not in this PR: /attribute from the host aimed at a LAN guest answers "not a valid entity", and the first-person hand, camera and rendering items of #3809.

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 javap -c -p on the 26.3 client jar:

  • LivingEntity.tick calls refreshDirtyAttributes (offset 639) before Player.tick goes on to updatePlayerPose. refreshDirtyAttributes calls onAttributeUpdated for each instance in getAttributesToUpdate, and onAttributeUpdated calls refreshDimensions when the attribute is Attributes.SCALE.
  • Entity.isInWall: f = dimensions.width() * 0.8F, AABB.ofSize(getEyePosition(), f, 1.0E-6, f), BlockPos.betweenClosedStream.

Tests: motion::tests::a_server_copy_takes_its_new_scale_box_the_next_tick (a scale base set, then one server tick: the box is 0.06 × 0.18 with its eye at 0.162) and game::lan_actions::tests::a_small_player_checks_only_the_blocks_at_their_small_eyes. tools/test_native_scene_motion.py covers the client's own refresh of attributes, scale and pose. This PR doesn't change that path (see Self-check).

Self-check

tools/pr_ready.py doesn't run on Windows, so these are the commands I ran by hand (Windows 11, CARGO_TARGET_DIR set to my own folder). The branch is rebased on main 6daad36de; fmt, clippy and the tests below were run again there:

  • cargo fmt --all -- --check: clean
  • cargo clippy -p horizon-client --all-targets -- -D warnings: clean
  • cargo test -p horizon-client --lib -- motion::tests::a_server_copy: 1 passed. With the refresh_attributes() line taken out of server_player_pose_tick it fails: left: 0.6, right: 0.060000002 (width).
  • cargo test -p horizon-client --bin horizon-client -- lan_actions::tests: 1 passed. With the old fixed half-width of 0.24 it fails: left: [205..=206, 530..=530], right: [205..=205, 530..=530].
  • cargo test -p horizon-client --lib -- motion:: pose:: attribute_updates lan::guest lan::hub: 37 passed, 1 ignored
  • cargo test -p horizon-client --bin horizon-client -- lan: 13 passed
  • python tools/test_native_scene_motion.py: stops at the same mismatch on this branch and on main (0fff625c2): output line 2242548, the armor and armor_toughness dirty flags of a hurt case (vanilla true, Horizon false). That case has nothing to do with scale, and the probe never calls the new code, so the mismatch isn't caused by this PR.

In game, with the server thread, in survival on a stone floor at y 99, a stone wall at x = 206, and a glass wall at x = 210. I set the scale to 0.1 and teleported the player 0.05 from the wall, then ran horizon-ctl move forward 3:

main (0fff625c2) this branch
beside the stone wall moved 0.196, then died: "suffocated in a wall" moved 12.69 along the wall, 20 health
beside the glass wall (no suffocation) stuck at z 530.696: every step past the next block was sent back moved 12.69 along the wall
5 s standing beside the stone wall (dead) 20 health
ladder against the wall, slab on the floor not tried climbs the ladder, steps up onto the slab and down again

A LAN guest at normal scale (a second game joined over lan open) still walks and collides as before. When a full-size guest is put 0.05 from a stone wall, they suffocate, as they do in vanilla. I couldn't shrink the guest: from the host, /attribute aimed at a guest answers "not a valid entity", and guests get no commands. The guest's server copy goes through the same guest_server_tick as the single-player owner above.

Screenshots

Before: at scale 0.1, one step along a stone wall ends on the death screen, "suffocated in a wall". After: the same small player stands against the same wall with full health and walks the length of it.

🤖 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/4045 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3684-hitbox` --- ### 📝 Commits (1) - [`5b3b108`](https://github.com/horizon-rust/horizon/commit/5b3b10851504b6b10dca174a068bc9370002b91b) A small player's server box follows minecraft:scale ### 📊 Changes **3 files changed** (+111 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_actions.rs` (+50 -14) 📝 `crates/horizon-client/src/motion.rs` (+50 -0) 📝 `crates/horizon-client/src/pose.rs` (+11 -0) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally. ## What and why After `/attribute @s minecraft:scale base set 0.1` the client shrinks its own box, but the server kept checking the player with the old 0.6 × 1.8 one. A small player walking close to a wall was sent back on every step, and standing close to a stone wall killed them with "suffocated in a wall". #3809 reports the same thing as getting stuck and rubberbanded at small scales. Two causes, both on the server's copy of the player (`guest_server_tick`, which the single-player owner on the server thread also goes through): - **The box never changed.** Vanilla's `LivingEntity.tick` runs `refreshDirtyAttributes` every tick, and `onAttributeUpdated(SCALE)` calls `refreshDimensions`. The client's simulation tick already does this (`PlayerMotion::refresh_attributes`), but the server's copy never did. Its dimensions only changed when its pose changed, so `Hub::collide` (the "moved wrongly" and "colliding with anything new" checks of `handlePlayerPositionChange`) kept the full-size box. The new `MotionWorld::server_player_pose_tick` runs aiStep's Riptide countdown, then `refreshDirtyAttributes`, then `updatePlayerPose`, in vanilla's order. - **The suffocation box was hard-coded.** `in_wall` used a 0.48-wide box at the eyes. Vanilla's `Entity.isInWall` takes `dimensions.width() * 0.8`, so at scale 0.1 that box is 0.048 wide. `in_wall` now takes the body's dimensions. The column arithmetic is in `eye_columns`, which has a unit test. Part of #3684 (the hitbox part of the `attribute scale` item; the model scale was #3752). Also fixes the hitbox part of #3809. Not in this PR: `/attribute` from the host aimed at a LAN guest answers "not a valid entity", and the first-person hand, camera and rendering items of #3809. ## 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 `javap -c -p` on the 26.3 client jar: - `LivingEntity.tick` calls `refreshDirtyAttributes` (offset 639) before `Player.tick` goes on to `updatePlayerPose`. `refreshDirtyAttributes` calls `onAttributeUpdated` for each instance in `getAttributesToUpdate`, and `onAttributeUpdated` calls `refreshDimensions` when the attribute is `Attributes.SCALE`. - `Entity.isInWall`: `f = dimensions.width() * 0.8F`, `AABB.ofSize(getEyePosition(), f, 1.0E-6, f)`, `BlockPos.betweenClosedStream`. Tests: `motion::tests::a_server_copy_takes_its_new_scale_box_the_next_tick` (a scale base set, then one server tick: the box is 0.06 × 0.18 with its eye at 0.162) and `game::lan_actions::tests::a_small_player_checks_only_the_blocks_at_their_small_eyes`. `tools/test_native_scene_motion.py` covers the client's own refresh of attributes, scale and pose. This PR doesn't change that path (see Self-check). ## Self-check `tools/pr_ready.py` doesn't run on Windows, so these are the commands I ran by hand (Windows 11, `CARGO_TARGET_DIR` set to my own folder). The branch is rebased on main 6daad36de; fmt, clippy and the tests below were run again there: - `cargo fmt --all -- --check`: clean - `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean - `cargo test -p horizon-client --lib -- motion::tests::a_server_copy`: 1 passed. With the `refresh_attributes()` line taken out of `server_player_pose_tick` it fails: `left: 0.6, right: 0.060000002` (width). - `cargo test -p horizon-client --bin horizon-client -- lan_actions::tests`: 1 passed. With the old fixed half-width of 0.24 it fails: `left: [205..=206, 530..=530], right: [205..=205, 530..=530]`. - `cargo test -p horizon-client --lib -- motion:: pose:: attribute_updates lan::guest lan::hub`: 37 passed, 1 ignored - `cargo test -p horizon-client --bin horizon-client -- lan`: 13 passed - `python tools/test_native_scene_motion.py`: stops at the same mismatch on this branch and on main (0fff625c2): output line 2242548, the armor and armor_toughness dirty flags of a hurt case (vanilla `true`, Horizon `false`). That case has nothing to do with scale, and the probe never calls the new code, so the mismatch isn't caused by this PR. In game, with the server thread, in survival on a stone floor at y 99, a stone wall at x = 206, and a glass wall at x = 210. I set the scale to 0.1 and teleported the player 0.05 from the wall, then ran `horizon-ctl move forward 3`: | | main (0fff625c2) | this branch | |---|---|---| | beside the stone wall | moved 0.196, then died: "suffocated in a wall" | moved 12.69 along the wall, 20 health | | beside the glass wall (no suffocation) | stuck at z 530.696: every step past the next block was sent back | moved 12.69 along the wall | | 5 s standing beside the stone wall | (dead) | 20 health | | ladder against the wall, slab on the floor | not tried | climbs the ladder, steps up onto the slab and down again | A LAN guest at normal scale (a second game joined over `lan open`) still walks and collides as before. When a full-size guest is put 0.05 from a stone wall, they suffocate, as they do in vanilla. I couldn't shrink the guest: from the host, `/attribute` aimed at a guest answers "not a valid entity", and guests get no commands. The guest's server copy goes through the same `guest_server_tick` as the single-player owner above. ## Screenshots Before: at scale 0.1, one step along a stone wall ends on the death screen, "suffocated in a wall". After: the same small player stands against the same wall with full health and walks the length of it. 🤖 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:12: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#5376
No description provided.