[PR #1475] [MERGED] Elytra glides on a server's players: START_FALL_FLYING sent and checked #3551

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1475
Author: @ludovic111
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @ludovic111

Base: main ← Head: fix/st-elytra


📝 Commits (5)

  • b8e729b Totems save a server's players: the guest's turn uses it up, and entity event 35 reaches every client
  • de358cd A server's players drop their inventory on death unless keep_inventory is on
  • 52d8ed6 Signs open their editor on a server's players, and what they write reaches the server
  • 5617d70 Books open on a server's players, and what they write and sign reaches the server
  • 5ed8181 Elytra glides on a server's players: the client sends START_FALL_FLYING and the server checks it

📊 Changes

15 files changed (+887 additions, -101 deletions)

View changed files

📝 crates/horizon-client/src/audio.rs (+7 -0)
📝 crates/horizon-client/src/game.rs (+39 -30)
📝 crates/horizon-client/src/game/agent.rs (+7 -0)
📝 crates/horizon-client/src/game/books.rs (+124 -29)
📝 crates/horizon-client/src/game/control.rs (+12 -1)
📝 crates/horizon-client/src/game/lan.rs (+2 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+117 -1)
📝 crates/horizon-client/src/game/lan_stations.rs (+16 -11)
📝 crates/horizon-client/src/game/remote.rs (+26 -1)
📝 crates/horizon-client/src/game/sign_edit.rs (+86 -4)
📝 crates/horizon-client/src/game/station_control.rs (+1 -1)
📝 crates/horizon-client/src/game/totem.rs (+79 -20)
📝 crates/horizon-client/src/lan/hub.rs (+4 -3)
📝 crates/horizon-protocol/src/packets/play.rs (+112 -0)
📝 tools/lan_e2e.py (+255 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #1288.

What

An Elytra now glides for a server's players: LAN guests, and the window's own player when single player runs on the server thread. Before this, they fell straight down.

Why

  • Client. The remote tick (tick_remote) never set player.glider from the chest slot, so the jump in the air never started a glide (tryToStartFallFlying). It also never sent START_FALL_FLYING.
  • Server. The hub set fall_flying = true on that command with no check, and nothing ever cleared it.

How

  • Client
    • The glider check (LivingEntity.canGlideUsing: a glider in the chest slot that its next point of wear won't break) is now one function, glider_worn, used by the window's tick and the remote tick.
    • When a glide starts, the client sends ServerboundPlayerCommandPacket START_FALL_FLYING, as LocalPlayer.aiStep does.
  • Server
    • START_FALL_FLYING now reaches the game, which answers it as handlePlayerCommand does: Player.tryToStartFallFlying, or else stopFallFlying.
    • That start check (canGlide) fails when the player is flying, on the ground, riding, under levitation, wearing no usable glider, or in water or lava.
  • Server, each tick (LivingEntity.updateFallFlying for a gliding guest):
    • the glide ends once canGlide fails;
    • otherwise every 20th tick wears the Elytra by 1 (not in creative), and every 10th tick is an elytra_glide game event;
    • first, checkFallDistanceAccumulation keeps the fall distance at 1 while the glide isn't diving. The server has no velocity for a guest, so the last move's fall stands in for it.
  • Harness: state.player.fall_flying, and fall_flying per guest in lan status.

Not in this PR, and missing in both modes before and after: the damage from flying into a wall (handleFallFlyingCollisions). The server doesn't simulate a guest's travel. This PR also doesn't send a forced stopFallFlying resync to a client whose start the server refused. That only matters under levitation or while riding, and the client's own canGlide refuses those cases anyway.

Evidence

lan_e2e --check elytra. Each player puts an Elytra on, is teleported 60 blocks up facing level, falls for 6 ticks, taps jump, then glides for 30 ticks. The check reads the client's and the server's fall_flying, how far the player went forward and how far down, and whether the glide ended on both sides after landing.

in-frame, before in-frame, after --server-thread, before --server-thread, after
host glides: 12.1 forward, 7.0 down glides: 12.1 / 7.0 falls: 0.0 / 44.4 glides: 14.4 / 8.5
guest falls: 0.0 / 39.1 glides: 13.2 / 7.9 falls: 0.0 / 44.9 glides: 12.7 / 7.1

After the fix, fall_flying is true on the client and on the server while gliding, and false on both once the player lands, for every case. ("Before" has no fall_flying field, so the movement is the evidence.)

How tested

Self-check on the top of the stack (fix/st-held-use, which contains this PR), Mac mini M4 Pro:

  • cargo fmt --all --check: OK
  • cargo clippy --workspace --all-targets -- -D warnings: OK
  • cargo test -p horizon-protocol: 72 passed. cargo test -p horizon-client --lib: 1061 passed (26 ignored). --bins: 98 + 18 passed.
  • python3 tools/parity.py --changed origin/main: 106 harnesses, 106 passed, 0 failed (105 in the full run, which hit its time limit on a busy machine; the last one, world_spawn#4, then passed on its own with the other three world_spawn cases)
  • tools/lan_e2e.py in both modes (in-frame, then --server-thread), host and guest, as tabled above. Before = origin/main b65e082fd built with the same profile, after = this stack.

Stack

This continues the stack of #1463 (totem) → #1464 (keep_inventory) → #1465 (signs) → #1466 (books). This PR sits on top of #1466 and its change is the top commit. Merge order: #1463 → #1464 → #1465 → #1466 → #1475 (Elytra) → #1476 (held use).

The new lan_e2e checks go at the end of the file, after the stack's block, and leave alone the lines that #1419, #1420 and #1423–#1427 change. git merge-tree is clean against each of #1423–#1427. #1419 and #1420 already conflict with main on their own.

Needs Ludovic

A review and a merge, in stack order. Nothing else.

🤖 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/1475 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/st-elytra` --- ### 📝 Commits (5) - [`b8e729b`](https://github.com/horizon-rust/horizon/commit/b8e729b950284890ec79d11e4bb448e3a3e4782c) Totems save a server's players: the guest's turn uses it up, and entity event 35 reaches every client - [`de358cd`](https://github.com/horizon-rust/horizon/commit/de358cd72127156cd9c27ecd662ee73b86adb113) A server's players drop their inventory on death unless keep_inventory is on - [`52d8ed6`](https://github.com/horizon-rust/horizon/commit/52d8ed6721be9b7db334284f14b0fb271ba13f86) Signs open their editor on a server's players, and what they write reaches the server - [`5617d70`](https://github.com/horizon-rust/horizon/commit/5617d702cc62e676de8c24c4506ad055a62617b8) Books open on a server's players, and what they write and sign reaches the server - [`5ed8181`](https://github.com/horizon-rust/horizon/commit/5ed8181adca456aae7ca081bc8b0acd6e1d5b47b) Elytra glides on a server's players: the client sends START_FALL_FLYING and the server checks it ### 📊 Changes **15 files changed** (+887 additions, -101 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/audio.rs` (+7 -0) 📝 `crates/horizon-client/src/game.rs` (+39 -30) 📝 `crates/horizon-client/src/game/agent.rs` (+7 -0) 📝 `crates/horizon-client/src/game/books.rs` (+124 -29) 📝 `crates/horizon-client/src/game/control.rs` (+12 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+117 -1) 📝 `crates/horizon-client/src/game/lan_stations.rs` (+16 -11) 📝 `crates/horizon-client/src/game/remote.rs` (+26 -1) 📝 `crates/horizon-client/src/game/sign_edit.rs` (+86 -4) 📝 `crates/horizon-client/src/game/station_control.rs` (+1 -1) 📝 `crates/horizon-client/src/game/totem.rs` (+79 -20) 📝 `crates/horizon-client/src/lan/hub.rs` (+4 -3) 📝 `crates/horizon-protocol/src/packets/play.rs` (+112 -0) 📝 `tools/lan_e2e.py` (+255 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #1288. ## What An Elytra now glides for a server's players: LAN guests, and the window's own player when single player runs on the server thread. Before this, they fell straight down. ## Why - **Client.** The remote tick (`tick_remote`) never set `player.glider` from the chest slot, so the jump in the air never started a glide (`tryToStartFallFlying`). It also never sent `START_FALL_FLYING`. - **Server.** The hub set `fall_flying = true` on that command with no check, and nothing ever cleared it. ## How - **Client** - The glider check (`LivingEntity.canGlideUsing`: a glider in the chest slot that its next point of wear won't break) is now one function, `glider_worn`, used by the window's tick and the remote tick. - When a glide starts, the client sends `ServerboundPlayerCommandPacket` `START_FALL_FLYING`, as `LocalPlayer.aiStep` does. - **Server** - `START_FALL_FLYING` now reaches the game, which answers it as `handlePlayerCommand` does: `Player.tryToStartFallFlying`, or else `stopFallFlying`. - That start check (`canGlide`) fails when the player is flying, on the ground, riding, under levitation, wearing no usable glider, or in water or lava. - **Server, each tick** (`LivingEntity.updateFallFlying` for a gliding guest): - the glide ends once `canGlide` fails; - otherwise every 20th tick wears the Elytra by 1 (not in creative), and every 10th tick is an `elytra_glide` game event; - first, `checkFallDistanceAccumulation` keeps the fall distance at 1 while the glide isn't diving. The server has no velocity for a guest, so the last move's fall stands in for it. - **Harness:** `state.player.fall_flying`, and `fall_flying` per guest in `lan status`. Not in this PR, and missing in both modes before and after: the damage from flying into a wall (`handleFallFlyingCollisions`). The server doesn't simulate a guest's travel. This PR also doesn't send a forced `stopFallFlying` resync to a client whose start the server refused. That only matters under levitation or while riding, and the client's own `canGlide` refuses those cases anyway. ## Evidence `lan_e2e --check elytra`. Each player puts an Elytra on, is teleported 60 blocks up facing level, falls for 6 ticks, taps jump, then glides for 30 ticks. The check reads the client's and the server's `fall_flying`, how far the player went forward and how far down, and whether the glide ended on both sides after landing. | | in-frame, before | in-frame, after | `--server-thread`, before | `--server-thread`, after | |---|---|---|---|---| | host | glides: 12.1 forward, 7.0 down | glides: 12.1 / 7.0 | **falls: 0.0 / 44.4** | glides: 14.4 / 8.5 | | guest | **falls: 0.0 / 39.1** | glides: 13.2 / 7.9 | **falls: 0.0 / 44.9** | glides: 12.7 / 7.1 | After the fix, `fall_flying` is true on the client and on the server while gliding, and false on both once the player lands, for every case. ("Before" has no `fall_flying` field, so the movement is the evidence.) ## How tested Self-check on the top of the stack (fix/st-held-use, which contains this PR), Mac mini M4 Pro: - `cargo fmt --all --check`: OK - `cargo clippy --workspace --all-targets -- -D warnings`: OK - `cargo test -p horizon-protocol`: 72 passed. `cargo test -p horizon-client --lib`: 1061 passed (26 ignored). `--bins`: 98 + 18 passed. - `python3 tools/parity.py --changed origin/main`: 106 harnesses, 106 passed, 0 failed (105 in the full run, which hit its time limit on a busy machine; the last one, world_spawn#4, then passed on its own with the other three world_spawn cases) - `tools/lan_e2e.py` in both modes (in-frame, then `--server-thread`), host and guest, as tabled above. Before = origin/main b65e082fd built with the same profile, after = this stack. ## Stack This continues the stack of #1463 (totem) → #1464 (keep_inventory) → #1465 (signs) → #1466 (books). This PR sits on top of #1466 and its change is the top commit. Merge order: #1463 → #1464 → #1465 → #1466 → #1475 (Elytra) → #1476 (held use). The new lan_e2e checks go at the end of the file, after the stack's block, and leave alone the lines that #1419, #1420 and #1423–#1427 change. `git merge-tree` is clean against each of #1423–#1427. #1419 and #1420 already conflict with main on their own. ## Needs Ludovic A review and a merge, in stack order. Nothing else. 🤖 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 04:10:21 +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#3551
No description provided.