[PR #1280] [MERGED] Fix #1222 at the root: boats, minecarts, frames and lightning for a server's players #3478

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

📋 Pull Request Information

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

Base: main ← Head: fix/1222-server-vehicles


📝 Commits (3)

  • 16b7e60 Fix #1222 at the root: vehicles for a server's players
  • afd3874 Lightning for a server's players: the bolt and the sky flash
  • 1a8dae9 lan_e2e boats: the pool in a stone basin, for worlds that float

📊 Changes

16 files changed (+926 additions, -75 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -0)
📝 crates/horizon-client/src/game/boats.rs (+10 -3)
📝 crates/horizon-client/src/game/control.rs (+2 -0)
📝 crates/horizon-client/src/game/lan.rs (+7 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+57 -7)
📝 crates/horizon-client/src/game/lan_entities.rs (+15 -1)
➕ crates/horizon-client/src/game/lan_vehicles.rs (+288 -0)
📝 crates/horizon-client/src/game/lightning.rs (+26 -1)
📝 crates/horizon-client/src/game/minecarts.rs (+4 -1)
📝 crates/horizon-client/src/game/remote.rs (+58 -8)
📝 crates/horizon-client/src/game/remote_objects.rs (+13 -0)
➕ crates/horizon-client/src/game/remote_vehicles.rs (+181 -0)
📝 crates/horizon-client/src/lan/guest.rs (+10 -0)
📝 crates/horizon-client/src/lan/hub.rs (+6 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+17 -0)
📝 tools/lan_e2e.py (+227 -53)

📄 Description

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

Fixes #1222 at the root, as @rdbtCVS asked on #1257: vehicles now work for players of a server, so the server thread can become the default again. It also fixes the missing lightning on the server thread (the coordinator's FEATURES 4z(f)).

Order with #1265: this PR leaves the default unchanged (in-frame, as #1257 left it), so it can merge on its own. #1265 merges right after it and puts the server thread back as the default. #1265 removes the boats lan_e2e check, but this PR keeps it: it now passes with and without --server-thread, for the host and for a LAN guest. run() here sets HORIZON_SERVER_THREAD the same way #1265 does, so that hunk merges cleanly. The CHECKS list, the check table and the check_boats hunks will conflict. We'll resolve that on #1265 ourselves by keeping boats, minecarts, frames and lightning. @rdbtCVS doesn't need to rebase anything.

What was broken

The single-player window on its server thread, LAN guests and dedicated-server players all go through the same server code, the hub's guests. Before this PR:

  • The client sent Interact and Attack only for mobs.
  • The server aimed only at mobs.
  • Nothing carried riding over the network (no SetPassengers handling, no MoveVehicle, no PaddleBoat).

So boats, minecarts, item frames, armor stands and paintings did nothing for those players.

Lightning bolts were never sent to them either: a bolt lived outside the tracked entities. The client also had nothing to draw for a lightning_bolt AddEntity, so there was no bolt and no sky flash.

How

Client (remote.rs, new remote_vehicles.rs):

  • Sends Interact and Attack for boats, minecarts, item frames, armor stands and paintings, with the hit location (Minecraft.hitResult).
  • SetPassengers seats the player or takes it out.
  • A boat ticks on its rider's client. It is sent every tick as MoveVehicle plus PaddleBoat, and the rider sends only its rotation.
  • A MoveVehicle from the server puts the boat back.
  • A minecart moves on the server; the rider sits in it.
  • The client ignores the server's rotation for the boat it drives.

Server (new lan_vehicles.rs, lan_actions.rs, hub.rs):

  • look_at_entity aims at every one of those objects, at the client's hit point.

  • During a guest's turn, Game.riding is that guest's vehicle (Entity.vehicle).

  • tick_boats and tick_carts leave guest-ridden vehicles to their riders.

  • One rider per vehicle.

  • handleMoveVehicle with its checks:

    • non-finite values: kick with invalid_vehicle_movement;
    • awaiting a teleport or not loaded: ignored;
    • moved too quickly (>100, except the single-player owner);
    • moved wrongly (>0.0625 horizontal residual after collisions);
    • colliding with anything new.

    In those last three cases the server snaps the boat back and sends MoveVehicle.

  • handlePaddleBoat.

  • Player.rideTick:

    • Sneaking gets out. The client gets SetPassengers first, then the teleport (dismountTo).
    • A minecart moves with the rider's PlayerInput.
    • A boat decays its hurt time and damage.
    • A passenger's moves only turn it.
    • A teleport (commands) takes the rider out.
  • Guests are added to hub.riding, so every tracker gets SetPassengers.

Lightning:

  • Each bolt gets an entity id and is tracked like other entities.
  • The client adds a visual-only bolt (LightningBolt.tick off the server: sounds, sky flash, the drawn bolt).
  • The remote level tick runs the bolts and fades the flash.
  • status.lightning reports bolts and flashes.

Mounts (horses, pigs, striders) for server players are not covered here; they need the same riding path plus their own input packets.

How tested (Mac mini)

  • cargo fmt --all --check: passes.
  • cargo clippy --locked --workspace --all-targets -- -D warnings: passes.
  • cargo test -p horizon-client -p horizon-protocol -p horizon-server: passes (1018 + 94 + 69 + 47 + smaller suites).
  • tools/lan_e2e.py passes with and without --server-thread, on the head commit (after rebasing on main):
    • boats: the host and the guest each board a boat, paddle it forward (8.8 blocks; the other side sees it there), sneak out and break it.
    • minecarts: board, sneak out beside the cart, break it.
    • frames: put a diamond in an item frame and turn it; put a helmet on an armor stand and take it back.
    • lightning: a bolt beside each player; both sides get the bolt and the flash.
    • ladder (#1263).
    • Also objects and projectiles, on the commit before rebasing.
  • tools/parity.py --changed origin/main on head 1a8dae9f: 102 passed, 0 failed.

What needs Ludovic

Nothing to decide. Merge this, then #1265.

🤖 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/1280 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1222-server-vehicles` --- ### 📝 Commits (3) - [`16b7e60`](https://github.com/horizon-rust/horizon/commit/16b7e600743006324a1856d357ee1021451cbb59) Fix #1222 at the root: vehicles for a server's players - [`afd3874`](https://github.com/horizon-rust/horizon/commit/afd38744824ed6a5c3b08bbaf0dd07f7c7742e3b) Lightning for a server's players: the bolt and the sky flash - [`1a8dae9`](https://github.com/horizon-rust/horizon/commit/1a8dae9f2102a361c6e8d3d6e0c490921e00508b) lan_e2e boats: the pool in a stone basin, for worlds that float ### 📊 Changes **16 files changed** (+926 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -0) 📝 `crates/horizon-client/src/game/boats.rs` (+10 -3) 📝 `crates/horizon-client/src/game/control.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+7 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+57 -7) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+15 -1) ➕ `crates/horizon-client/src/game/lan_vehicles.rs` (+288 -0) 📝 `crates/horizon-client/src/game/lightning.rs` (+26 -1) 📝 `crates/horizon-client/src/game/minecarts.rs` (+4 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+58 -8) 📝 `crates/horizon-client/src/game/remote_objects.rs` (+13 -0) ➕ `crates/horizon-client/src/game/remote_vehicles.rs` (+181 -0) 📝 `crates/horizon-client/src/lan/guest.rs` (+10 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+6 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+17 -0) 📝 `tools/lan_e2e.py` (+227 -53) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #1222 at the root, as @rdbtCVS asked on #1257: vehicles now work for players of a server, so the server thread can become the default again. It also fixes the missing lightning on the server thread (the coordinator's FEATURES 4z(f)). **Order with #1265:** this PR leaves the default unchanged (in-frame, as #1257 left it), so it can merge on its own. #1265 merges right after it and puts the server thread back as the default. #1265 removes the `boats` lan_e2e check, but this PR keeps it: it now passes with and without `--server-thread`, for the host and for a LAN guest. `run()` here sets `HORIZON_SERVER_THREAD` the same way #1265 does, so that hunk merges cleanly. The `CHECKS` list, the check table and the `check_boats` hunks will conflict. We'll resolve that on #1265 ourselves by keeping `boats`, `minecarts`, `frames` and `lightning`. @rdbtCVS doesn't need to rebase anything. ## What was broken The single-player window on its server thread, LAN guests and dedicated-server players all go through the same server code, the hub's guests. Before this PR: - The client sent Interact and Attack only for mobs. - The server aimed only at mobs. - Nothing carried riding over the network (no SetPassengers handling, no MoveVehicle, no PaddleBoat). So boats, minecarts, item frames, armor stands and paintings did nothing for those players. Lightning bolts were never sent to them either: a bolt lived outside the tracked entities. The client also had nothing to draw for a `lightning_bolt` AddEntity, so there was no bolt and no sky flash. ## How **Client** (`remote.rs`, new `remote_vehicles.rs`): - Sends Interact and Attack for boats, minecarts, item frames, armor stands and paintings, with the hit location (`Minecraft.hitResult`). - `SetPassengers` seats the player or takes it out. - A boat ticks on its rider's client. It is sent every tick as `MoveVehicle` plus `PaddleBoat`, and the rider sends only its rotation. - A `MoveVehicle` from the server puts the boat back. - A minecart moves on the server; the rider sits in it. - The client ignores the server's rotation for the boat it drives. **Server** (new `lan_vehicles.rs`, `lan_actions.rs`, `hub.rs`): - `look_at_entity` aims at every one of those objects, at the client's hit point. - During a guest's turn, `Game.riding` is that guest's vehicle (`Entity.vehicle`). - `tick_boats` and `tick_carts` leave guest-ridden vehicles to their riders. - One rider per vehicle. - `handleMoveVehicle` with its checks: - non-finite values: kick with `invalid_vehicle_movement`; - awaiting a teleport or not loaded: ignored; - moved too quickly (>100, except the single-player owner); - moved wrongly (>0.0625 horizontal residual after collisions); - colliding with anything new. In those last three cases the server snaps the boat back and sends `MoveVehicle`. - `handlePaddleBoat`. - `Player.rideTick`: - Sneaking gets out. The client gets `SetPassengers` first, then the teleport (`dismountTo`). - A minecart moves with the rider's `PlayerInput`. - A boat decays its hurt time and damage. - A passenger's moves only turn it. - A teleport (commands) takes the rider out. - Guests are added to `hub.riding`, so every tracker gets `SetPassengers`. **Lightning:** - Each bolt gets an entity id and is tracked like other entities. - The client adds a visual-only bolt (`LightningBolt.tick` off the server: sounds, sky flash, the drawn bolt). - The remote level tick runs the bolts and fades the flash. - `status.lightning` reports bolts and flashes. Mounts (horses, pigs, striders) for server players are not covered here; they need the same riding path plus their own input packets. ## How tested (Mac mini) - `cargo fmt --all --check`: passes. - `cargo clippy --locked --workspace --all-targets -- -D warnings`: passes. - `cargo test -p horizon-client -p horizon-protocol -p horizon-server`: passes (1018 + 94 + 69 + 47 + smaller suites). - `tools/lan_e2e.py` passes **with and without `--server-thread`**, on the head commit (after rebasing on main): - `boats`: the host and the guest each board a boat, paddle it forward (8.8 blocks; the other side sees it there), sneak out and break it. - `minecarts`: board, sneak out beside the cart, break it. - `frames`: put a diamond in an item frame and turn it; put a helmet on an armor stand and take it back. - `lightning`: a bolt beside each player; both sides get the bolt and the flash. - `ladder` (#1263). - Also `objects` and `projectiles`, on the commit before rebasing. - `tools/parity.py --changed origin/main` on head 1a8dae9f: 102 passed, 0 failed. ## What needs Ludovic Nothing to decide. Merge this, then #1265. 🤖 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:09:48 +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#3478
No description provided.