[PR #4911] [MERGED] Player swimming needs !isPassenger(), in both of Entity.updateSwimming's branches #5937

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4911
Author: @sirrayi
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/guest-passenger-swim


📝 Commits (1)

  • f5d8035 Player swimming needs !isPassenger(), in both of Entity.updateSwimming's branches

📊 Changes

3 files changed (+73 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_actions.rs (+6 -0)
📝 crates/horizon-client/src/motion.rs (+61 -0)
📝 crates/horizon-client/src/motion/fluids.rs (+6 -0)

📄 Description

🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi themselves.

What and why

Fixes #4427. Horizon has two ports of Entity.updateSwimming, and they disagree about one term.

  • crates/horizon-world/src/swimming.rs::update is the faithful one: !world.is_passenger()? in both
    branches, with update_player (Player.updateSwimming) delegating to it. tools/test_swimming_parity.py
    compares it against the real class, and VanillaSwimmingOracle varies passenger among its inputs and
    logs the query, so vanilla's dependence on isPassenger() is pinned by a harness on main today.
  • crates/horizon-client/src/motion/fluids.rs::fluid_base_tick — the client's copy, ledger row
    tools/port_map/game2-005.tsv:106 — left the term out.

Consequence: the server's copy of a guest who boards a boat while swimming kept swimming, and
Player.updatePlayerPose follows it. It sat in the seat in the 0.6x0.6 box with its eye height 0.4
instead of 1.62; the boat's seat is roughly the boat's own y, so that eye sat at the waterline, and
tick_environment_damage's submerged = is_eye_in_fluid(WATER) drained air and then applied
minecraft:drown (and in_wall at 1.0 from the same eye) to a player whose own screen showed them sitting
up.

The change is two behaviour points:

  1. PlayerMotion::is_passenger (motion.rs), set from the guest's vehicle as as_guest swaps its state in
    (game/lan_actions.rs), so boarding and getting out both land. fluid_base_tick gains && !is_passenger,
    exactly as swimming::update already had it.
  2. guest_server_tick uses passenger_pose_tick for a riding guest instead of server_player_pose_tick —
    what the window's own player already does at game/remote.rs:4587, so the server's copy and the client's
    no longer disagree. count_down_server_spin and refresh_attributes, which server_player_pose_tick
    wrapped around the pose, are kept explicitly.

The local player is not on this path twice over: game/remote.rs ticks it only !dead && !riding, so a
riding body was never swimming client-side either.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

Entity.updateSwimming (both branches test !isPassenger()) and Player.updateSwimming (the flying-ability
guard over it), both already ported faithfully in horizon-world/src/swimming.rs and covered by
tools/test_swimming_parity.py + VanillaSwimmingOracle with passenger among the varied fields. This
change makes the client's second port agree with the port that harness already checks.

The new test motion::tests::a_riding_guest_keeps_no_swim_in_the_fluid_phase asserts the box the flag picks
(eye 0.4 swimming vs 1.62 standing, both without assets), then, where .local/ exists, that a sprinting body
under water swims, that setting is_passenger stops it and gives the standing box in the seat, and that
clearing it starts the swim again.

Self-check

cargo fmt --all -- --check                                    ✅
cargo clippy -p horizon-client --lib --tests -- -D warnings    ✅
cargo test -p horizon-client --lib a_riding_guest_keeps_no_swim 1 passed; 0 failed

cargo exit codes were checked with set -o pipefail; an earlier pass in this worktree reported tail's
status by mistake, so this one was re-run properly.

Two honest caveats:

  • The test exercises a field it adds, so it cannot be shown red on main — on main it does not compile.
    What makes this a parity fix is the evidence above, not the test; the test pins the behaviour from here on.
  • This branch does not currently build CI-clean for a reason outside it: main at the time of writing
    fails to compile in horizon-client-render (streaming.rs's SectionMask, filed as #4896). I verified
    this change with that breakage patched locally (two lines, not part of this branch): with it,
    cargo clippy -p horizon-client --lib --tests -- -D warnings and the test above both pass.

🔄 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/4911 **Author:** [@sirrayi](https://github.com/sirrayi) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/guest-passenger-swim` --- ### 📝 Commits (1) - [`f5d8035`](https://github.com/horizon-rust/horizon/commit/f5d803562600c8b3369d0242f6e6de3bdf5e82a0) Player swimming needs !isPassenger(), in both of Entity.updateSwimming's branches ### 📊 Changes **3 files changed** (+73 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_actions.rs` (+6 -0) 📝 `crates/horizon-client/src/motion.rs` (+61 -0) 📝 `crates/horizon-client/src/motion/fluids.rs` (+6 -0) </details> ### 📄 Description > 🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi themselves. ## What and why Fixes #4427. Horizon has **two** ports of `Entity.updateSwimming`, and they disagree about one term. - `crates/horizon-world/src/swimming.rs::update` is the faithful one: `!world.is_passenger()?` in **both** branches, with `update_player` (`Player.updateSwimming`) delegating to it. `tools/test_swimming_parity.py` compares it against the real class, and `VanillaSwimmingOracle` varies `passenger` among its inputs and logs the query, so vanilla's dependence on `isPassenger()` is pinned by a harness on `main` today. - `crates/horizon-client/src/motion/fluids.rs::fluid_base_tick` — the client's copy, ledger row `tools/port_map/game2-005.tsv:106` — left the term out. Consequence: the server's copy of a guest who boards a boat while swimming kept `swimming`, and `Player.updatePlayerPose` follows it. It sat in the seat in the 0.6x0.6 box with its **eye height 0.4** instead of 1.62; the boat's seat is roughly the boat's own y, so that eye sat at the waterline, and `tick_environment_damage`'s `submerged = is_eye_in_fluid(WATER)` drained air and then applied `minecraft:drown` (and `in_wall` at 1.0 from the same eye) to a player whose own screen showed them sitting up. The change is two behaviour points: 1. `PlayerMotion::is_passenger` (`motion.rs`), set from the guest's vehicle as `as_guest` swaps its state in (`game/lan_actions.rs`), so boarding and getting out both land. `fluid_base_tick` gains `&& !is_passenger`, exactly as `swimming::update` already had it. 2. `guest_server_tick` uses `passenger_pose_tick` for a riding guest instead of `server_player_pose_tick` — what the window's own player already does at `game/remote.rs:4587`, so the server's copy and the client's no longer disagree. `count_down_server_spin` and `refresh_attributes`, which `server_player_pose_tick` wrapped around the pose, are kept explicitly. The local player is not on this path twice over: `game/remote.rs` ticks it only `!dead && !riding`, so a riding body was never swimming client-side either. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `Entity.updateSwimming` (both branches test `!isPassenger()`) and `Player.updateSwimming` (the flying-ability guard over it), both already ported faithfully in `horizon-world/src/swimming.rs` and covered by `tools/test_swimming_parity.py` + `VanillaSwimmingOracle` with `passenger` among the varied fields. This change makes the client's second port agree with the port that harness already checks. The new test `motion::tests::a_riding_guest_keeps_no_swim_in_the_fluid_phase` asserts the box the flag picks (eye 0.4 swimming vs 1.62 standing, both without assets), then, where `.local/` exists, that a sprinting body under water swims, that setting `is_passenger` stops it and gives the standing box in the seat, and that clearing it starts the swim again. ## Self-check ``` cargo fmt --all -- --check ✅ cargo clippy -p horizon-client --lib --tests -- -D warnings ✅ cargo test -p horizon-client --lib a_riding_guest_keeps_no_swim 1 passed; 0 failed ``` `cargo` exit codes were checked with `set -o pipefail`; an earlier pass in this worktree reported `tail`'s status by mistake, so this one was re-run properly. Two honest caveats: - The test exercises a field it adds, so it cannot be shown red on `main` — on `main` it does not compile. What makes this a parity fix is the evidence above, not the test; the test pins the behaviour from here on. - **This branch does not currently build CI-clean for a reason outside it**: `main` at the time of writing fails to compile in `horizon-client-render` (`streaming.rs`'s `SectionMask`, filed as #4896). I verified this change with that breakage patched locally (two lines, not part of this branch): with it, `cargo clippy -p horizon-client --lib --tests -- -D warnings` and the test above both pass. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:03 +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#5937
No description provided.