[PR #1979] [MERGED] Check a server player's moves with the box of its pose #3908

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1979
Author: @kacpherek
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/1899-swim-ceiling


📝 Commits (1)

  • c7432c2 Check a server player's moves with the box of its pose

📊 Changes

2 files changed (+16 additions, -6 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_actions.rs (+3 -0)
📝 crates/horizon-client/src/lan/hub.rs (+13 -6)

📄 Description

Fixes #1899.

What and why

Sprint-swimming up against a ceiling (a cave under the ocean) sent the player back every tick in
single player on the server thread, and for LAN guests: the swimmer stalled about 1.2 blocks below
the ceiling and jittered there.

The server never updated a server player's pose, so it stayed standing, and the collision check of
handlePlayerPositionChange (lan/hub.rs collide) used a hard-coded box: 1.8 tall, 1.5 when
sneaking, 0.6 only while gliding. The client moves with the 0.6-block swimming box, so a swimmer
whose head reached the ceiling looked to the server like a standing player pushed into the block
above, and isEntityCollidingWithAnythingNew refused the move.

  • The server player's tick (game/lan_actions.rs) now ends with updatePlayerPose, as
    Player.tick does, after the moves and the shift key are applied.
  • The move check uses the box of that pose (getBoundingBox): the body's dimensions, scale
    included. Gliding keeps its 0.6 box, and a body not loaded yet keeps the old heights.

Vanilla reference

  • Player.tick → updatePlayerPose (getDesiredPose: swimming, gliding, spin attack, crouching;
    canPlayerFitWithinBlocksAndEntitiesWhen falls back to crouching, then swimming to crawl).
  • Entity.updateSwimming (Player.updateSwimming): sprinting and under water to start, in water to
    keep swimming.
  • ServerGamePacketListenerImpl.handleMovePlayer: oldAABB = player.getBoundingBox(), then
    isEntityCollidingWithAnythingNew(level, player, oldAABB, ...) with that box moved.

Checked in game with horizon-ctl on the server thread: a 7x5x7 water pool under a stone ceiling
at y=105, sprint-swimming up at pitch -45 for 4 seconds.

highest y send-backs
before 103.31 (a standing box's limit, 103.2) the swimmer jitters there
after 104.39 none, it rests under the ceiling
vanilla 104.4 (105 - 0.6)

Harnesses run (each script directly):

  • test_swimming_parity: client and server 191,142 swimming output lines match Rust.
  • test_server_player_damage_parity: client and server 373,455 lines match.
  • test_entity_move_parity: client and server 543,653 lines match.

The in-frame path is unchanged (it never runs the server's move check).

Self-check

I did not paste a tools/pr_ready.py block: I work on Windows, where tools/parity.py cannot run (it needs
fcntl) and three horizon-client tests fail on upstream/main as well
(crash::tests::stacks_start_at_the_panicking_frame,
packs::cache::tests::directory_inputs_config_and_owned_output_recovery,
save::tests::session_lock_is_exclusive). cargo fmt --all -- --check passes; CI runs clippy and the
tests on Linux, and the harnesses above were run one by one (python tools/test_<name>_parity.py).


🔄 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/1979 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1899-swim-ceiling` --- ### 📝 Commits (1) - [`c7432c2`](https://github.com/horizon-rust/horizon/commit/c7432c21e152dfc566580a40917d092c227ac197) Check a server player's moves with the box of its pose ### 📊 Changes **2 files changed** (+16 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_actions.rs` (+3 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+13 -6) </details> ### 📄 Description Fixes #1899. ## What and why Sprint-swimming up against a ceiling (a cave under the ocean) sent the player back every tick in single player on the server thread, and for LAN guests: the swimmer stalled about 1.2 blocks below the ceiling and jittered there. The server never updated a server player's pose, so it stayed standing, and the collision check of `handlePlayerPositionChange` (`lan/hub.rs` `collide`) used a hard-coded box: 1.8 tall, 1.5 when sneaking, 0.6 only while gliding. The client moves with the 0.6-block swimming box, so a swimmer whose head reached the ceiling looked to the server like a standing player pushed into the block above, and `isEntityCollidingWithAnythingNew` refused the move. - The server player's tick (`game/lan_actions.rs`) now ends with `updatePlayerPose`, as `Player.tick` does, after the moves and the shift key are applied. - The move check uses the box of that pose (`getBoundingBox`): the body's dimensions, scale included. Gliding keeps its 0.6 box, and a body not loaded yet keeps the old heights. ## Vanilla reference - `Player.tick` → `updatePlayerPose` (`getDesiredPose`: swimming, gliding, spin attack, crouching; `canPlayerFitWithinBlocksAndEntitiesWhen` falls back to crouching, then swimming to crawl). - `Entity.updateSwimming` (`Player.updateSwimming`): sprinting and under water to start, in water to keep swimming. - `ServerGamePacketListenerImpl.handleMovePlayer`: `oldAABB = player.getBoundingBox()`, then `isEntityCollidingWithAnythingNew(level, player, oldAABB, ...)` with that box moved. Checked in game with `horizon-ctl` on the server thread: a 7x5x7 water pool under a stone ceiling at y=105, sprint-swimming up at pitch -45 for 4 seconds. | | highest y | send-backs | | --- | ---: | --- | | before | 103.31 (a standing box's limit, 103.2) | the swimmer jitters there | | after | 104.39 | none, it rests under the ceiling | | vanilla | 104.4 (105 - 0.6) | | Harnesses run (each script directly): - `test_swimming_parity`: client and server 191,142 swimming output lines match Rust. - `test_server_player_damage_parity`: client and server 373,455 lines match. - `test_entity_move_parity`: client and server 543,653 lines match. The in-frame path is unchanged (it never runs the server's move check). ## Self-check I did not paste a `tools/pr_ready.py` block: I work on Windows, where `tools/parity.py` cannot run (it needs `fcntl`) and three horizon-client tests fail on upstream/main as well (`crash::tests::stacks_start_at_the_panicking_frame`, `packs::cache::tests::directory_inputs_config_and_owned_output_recovery`, `save::tests::session_lock_is_exclusive`). `cargo fmt --all -- --check` passes; CI runs clippy and the tests on Linux, and the harnesses above were run one by one (`python tools/test_<name>_parity.py`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13: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#3908
No description provided.