[PR #4224] [MERGED] Riders move their horses on servers, and jump them #5496

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

📋 Pull Request Information

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

Base: main ← Head: fix-2920


📝 Commits (2)

  • 699fae6 Riders move their horses on servers, and jump them
  • aff1d98 The mount a rider's client moves ignores the server's moves of it

📊 Changes

8 files changed (+387 additions, -31 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_attributes.rs (+20 -1)
📝 crates/horizon-client/src/game/lan_vehicles.rs (+63 -19)
📝 crates/horizon-client/src/game/mounts.rs (+3 -0)
📝 crates/horizon-client/src/game/remote.rs (+39 -1)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+21 -0)
📝 crates/horizon-client/src/game/remote_vehicles.rs (+174 -9)
📝 crates/horizon-client/src/mobs/ai.rs (+52 -1)
📝 crates/horizon-client/src/mobs/equine.rs (+15 -0)

📄 Description

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

What and why

On a vanilla or Paper server a saddled horse, donkey or mule did not move or jump at all under a Horizon player (#2920).

Root cause: in vanilla the server does not move a horse a player controls. The controlling passenger's client moves it (Entity.isLocalInstanceAuthoritative, LivingEntity.travelRidden) and reports each move with ServerboundMoveVehiclePacket. A released jump goes to the server as ServerboundPlayerCommandPacket START_RIDING_JUMP, with data floor(jumpRidingScale * 100) (LocalPlayer.sendRidingJump). On the server, travelRidden runs tickRidden (turning the horse) and then, because canSimulateMovement() is false, sets the motion to zero. Horizon's client (remote_ride) only charged the jump bar and waited for the server to move the horse. Only Horizon's own server did that, from PlayerInput, so on a vanilla server nothing moved the horse.

The fix:

  • Client (remote_vehicles.rs): when the player is the first passenger of a saddled horse, donkey, mule, skeleton or zombie horse, or camel, the mount gets the rider's input and ticks on the client, like a boat already does. The client then sends MoveVehicle for it and START_RIDING_JUMP on a released jump, and puts it back when the server sends ClientboundMoveVehiclePacket. While the client drives the mount, it ignores the server's moves of it (ClientPacketListener.handleMoveEntity and handleEntityPositionSync only update the codec base for an entity the client is authoritative for), so no interpolation steps pile up and replay after the rider gets off. A server teleport of the mount still puts it there at once (handleTeleportEntity). The client also applies the synced movement_speed and jump_strength to the horse (remote.rs). Before the server's values arrive, a horse uses its type's default jump strength (0.7 for horses, 0.5 for donkeys and mules) instead of 0.
  • Horizon's server (single player's server thread, LAN, dedicated), so Horizon to Horizon riding keeps working:
    • guest_move_vehicle accepts a guest's MoveVehicle for the horse it controls, with the same moved-too-quickly and moved-wrongly checks as for boats (handleMoveVehicle), using the horse's step height.
    • The mob tick of such a horse turns it but no longer moves it (Rider::client, equine::moved_by_client).
    • The server syncs a horse's rolled jump strength, which randomizeAttributes sets as a base, so vanilla syncs it too.

Pigs, striders, nautili and the happy ghast are not changed here (#4113 does the ghast in the same functions). Horizon's server still ignores START_RIDING_JUMP and keeps rearing the horse and playing its jump sound from PlayerInput, as before. Because Horizon's server now leaves a guest's horse to the guest's client, a guest on an older Horizon build, which does not send MoveVehicle for a horse, can't move it on a host running this change (a vanilla client can, which it could not before).

Fixes #2920

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

Read from the 26.3 jars with javap:

  • Entity.isLocalInstanceAuthoritative, isLocalClientAuthoritative, isClientAuthoritative, canSimulateMovement
  • LivingEntity.aiStep (it calls travelRidden when the controlling passenger is a player) and LivingEntity.travelRidden (tickRidden, then travel, or setDeltaMovement(ZERO) when it can't simulate movement)
  • AbstractHorse.tickRidden (it jumps only on the authoritative side), onPlayerJump, handleStartJump, getControllingPassenger
  • LocalPlayer.aiStep's riding jump and LocalPlayer.sendRidingJump
  • ServerboundMoveVehiclePacket.fromEntity, ServerGamePacketListenerImpl.handleMoveVehicle, ClientPacketListener.handleMoveVehicle
  • ClientPacketListener.handleMoveEntity, handleEntityPositionSync (both skip an entity that isLocalInstanceAuthoritative) and handleTeleportEntity (it snaps such an entity instead of interpolating)
  • Attributes.JUMP_STRENGTH and MOVEMENT_SPEED (both setSyncable(true))

No parity harness covers this client and server split. It is checked by the unit tests below and in game, both against the real vanilla server.jar and on Horizon's own server.

Self-check

tools/pr_ready.py doesn't run on Windows, so these are the commands it runs, run one by one on Windows 11 after rebasing on today's main:

  • cargo fmt --all -- --check: clean
  • cargo clippy -p horizon-client --all-targets -- -D warnings: clean
  • cargo test -p horizon-client --lib -- mobs::ai:: mobs::equine::: 12 passed. This includes the new mobs::ai::ridden_tests::the_server_leaves_a_horse_to_its_riders_client: on the server, a saddled horse ridden forward walks and falls, but stays put with zero motion when its rider's client moves it (client: true), still turned to the rider's yaw.
  • cargo test -p horizon-client --bin horizon-client -- remote_vehicles remote_mob_data lan_attributes lan_vehicles mounts: 17 passed, including three new tests:
    • remote_vehicles::tests::the_rider_moves_a_saddled_horse_on_its_client: the client moves a saddled horse, donkey, mule or camel it is the first passenger of. It does not move a pig, a llama, an unsaddled mount, or a mount where it is not the first passenger.
    • remote_vehicles::tests::the_rider_sends_its_mounts_moves_and_jumps: MoveVehicle carries the mount's position, yaw, pitch and ground flag, and START_RIDING_JUMP is action 3 with data 75 for a 0.75 bar.
    • remote_mob_data::tests::a_servers_horse_jumps_its_types_strength
  • The test fails before the fix (code reverted, test kept): a_servers_horse_jumps_its_types_strength panics with horse: 0 (a server's horse had no jump strength on the client). The other new tests use the new Rider::client field and the new client_moves, mount_move and riding_jump functions, so they don't compile on main. With the fix, all of them pass.
  • In game, on the vanilla 26.3 server.jar (online-mode=false): a Horizon player rides a tamed, saddled horse summoned with speed 0.3 and jump strength 0.9.
    • Before: holding W for 3 s, then jumping, leaves the horse at z = 0.5 by the server's /data get entity.
    • After: the same commands take it to z = 40.1. A charged jump lifts it about 2.5 blocks on the server, and the server log shows no "moved wrongly" warnings.
  • Getting off after the ride, on the vanilla server, sampling the client's copy of the horse about every 100 ms:
    • Without the move-ignoring part (first commit only): the horse stopped at z = 27.51, then one sample showed it back at z = 22.17 before it returned to 27.51 (the queued interpolation steps replayed).
    • With it: every sample stays at z = 28.93 until the server's AI walks the horse off. A /tp of the ridden horse to z = 15.5 moves the client's copy there at once, and riding on from there reaches z = 28.71 on both sides.
  • Single player (server thread), after the fix: riding forward for 2 s moves the horse 26.4 blocks on both the client and the server. Jumping and backing up work, and after the player gets off with sneak, the server's AI moves the horse again.
  • LAN guest (a second game joined the first one, opened to LAN), after the fix: the guest mounts the horse by right-clicking it. Riding forward for 2 s moves it the same 26.4 blocks, and the host sees it there. A charged jump lifts it about 1.9 blocks on the host.

Screenshots

before, on a vanilla 26.3 server: holding W on a horse, F3 shows it still at Z 0.5

after, same server and input: the horse has ridden to Z 40.1

🤖 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/4224 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-2920` --- ### 📝 Commits (2) - [`699fae6`](https://github.com/horizon-rust/horizon/commit/699fae6296ec1c9a79ec24cecc9a473d384a2b24) Riders move their horses on servers, and jump them - [`aff1d98`](https://github.com/horizon-rust/horizon/commit/aff1d9864f6e31d76c59eb0647c76512bfa0024c) The mount a rider's client moves ignores the server's moves of it ### 📊 Changes **8 files changed** (+387 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_attributes.rs` (+20 -1) 📝 `crates/horizon-client/src/game/lan_vehicles.rs` (+63 -19) 📝 `crates/horizon-client/src/game/mounts.rs` (+3 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+39 -1) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+21 -0) 📝 `crates/horizon-client/src/game/remote_vehicles.rs` (+174 -9) 📝 `crates/horizon-client/src/mobs/ai.rs` (+52 -1) 📝 `crates/horizon-client/src/mobs/equine.rs` (+15 -0) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando personally. ## What and why On a vanilla or Paper server a saddled horse, donkey or mule did not move or jump at all under a Horizon player (#2920). Root cause: in vanilla the server does not move a horse a player controls. The controlling passenger's client moves it (`Entity.isLocalInstanceAuthoritative`, `LivingEntity.travelRidden`) and reports each move with `ServerboundMoveVehiclePacket`. A released jump goes to the server as `ServerboundPlayerCommandPacket` `START_RIDING_JUMP`, with data `floor(jumpRidingScale * 100)` (`LocalPlayer.sendRidingJump`). On the server, `travelRidden` runs `tickRidden` (turning the horse) and then, because `canSimulateMovement()` is false, sets the motion to zero. Horizon's client (`remote_ride`) only charged the jump bar and waited for the server to move the horse. Only Horizon's own server did that, from `PlayerInput`, so on a vanilla server nothing moved the horse. The fix: - Client (`remote_vehicles.rs`): when the player is the first passenger of a saddled horse, donkey, mule, skeleton or zombie horse, or camel, the mount gets the rider's input and ticks on the client, like a boat already does. The client then sends `MoveVehicle` for it and `START_RIDING_JUMP` on a released jump, and puts it back when the server sends `ClientboundMoveVehiclePacket`. While the client drives the mount, it ignores the server's moves of it (`ClientPacketListener.handleMoveEntity` and `handleEntityPositionSync` only update the codec base for an entity the client is authoritative for), so no interpolation steps pile up and replay after the rider gets off. A server teleport of the mount still puts it there at once (`handleTeleportEntity`). The client also applies the synced `movement_speed` and `jump_strength` to the horse (`remote.rs`). Before the server's values arrive, a horse uses its type's default jump strength (0.7 for horses, 0.5 for donkeys and mules) instead of 0. - Horizon's server (single player's server thread, LAN, dedicated), so Horizon to Horizon riding keeps working: - `guest_move_vehicle` accepts a guest's `MoveVehicle` for the horse it controls, with the same moved-too-quickly and moved-wrongly checks as for boats (`handleMoveVehicle`), using the horse's step height. - The mob tick of such a horse turns it but no longer moves it (`Rider::client`, `equine::moved_by_client`). - The server syncs a horse's rolled jump strength, which `randomizeAttributes` sets as a base, so vanilla syncs it too. Pigs, striders, nautili and the happy ghast are not changed here (#4113 does the ghast in the same functions). Horizon's server still ignores `START_RIDING_JUMP` and keeps rearing the horse and playing its jump sound from `PlayerInput`, as before. Because Horizon's server now leaves a guest's horse to the guest's client, a guest on an older Horizon build, which does not send `MoveVehicle` for a horse, can't move it on a host running this change (a vanilla client can, which it could not before). Fixes #2920 ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] 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 Read from the 26.3 jars with javap: - `Entity.isLocalInstanceAuthoritative`, `isLocalClientAuthoritative`, `isClientAuthoritative`, `canSimulateMovement` - `LivingEntity.aiStep` (it calls `travelRidden` when the controlling passenger is a player) and `LivingEntity.travelRidden` (`tickRidden`, then `travel`, or `setDeltaMovement(ZERO)` when it can't simulate movement) - `AbstractHorse.tickRidden` (it jumps only on the authoritative side), `onPlayerJump`, `handleStartJump`, `getControllingPassenger` - `LocalPlayer.aiStep`'s riding jump and `LocalPlayer.sendRidingJump` - `ServerboundMoveVehiclePacket.fromEntity`, `ServerGamePacketListenerImpl.handleMoveVehicle`, `ClientPacketListener.handleMoveVehicle` - `ClientPacketListener.handleMoveEntity`, `handleEntityPositionSync` (both skip an entity that `isLocalInstanceAuthoritative`) and `handleTeleportEntity` (it snaps such an entity instead of interpolating) - `Attributes.JUMP_STRENGTH` and `MOVEMENT_SPEED` (both `setSyncable(true)`) No parity harness covers this client and server split. It is checked by the unit tests below and in game, both against the real vanilla `server.jar` and on Horizon's own server. ## Self-check `tools/pr_ready.py` doesn't run on Windows, so these are the commands it runs, run one by one on Windows 11 after rebasing on today's main: - `cargo fmt --all -- --check`: clean - `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean - `cargo test -p horizon-client --lib -- mobs::ai:: mobs::equine::`: 12 passed. This includes the new `mobs::ai::ridden_tests::the_server_leaves_a_horse_to_its_riders_client`: on the server, a saddled horse ridden forward walks and falls, but stays put with zero motion when its rider's client moves it (`client: true`), still turned to the rider's yaw. - `cargo test -p horizon-client --bin horizon-client -- remote_vehicles remote_mob_data lan_attributes lan_vehicles mounts`: 17 passed, including three new tests: - `remote_vehicles::tests::the_rider_moves_a_saddled_horse_on_its_client`: the client moves a saddled horse, donkey, mule or camel it is the first passenger of. It does not move a pig, a llama, an unsaddled mount, or a mount where it is not the first passenger. - `remote_vehicles::tests::the_rider_sends_its_mounts_moves_and_jumps`: `MoveVehicle` carries the mount's position, yaw, pitch and ground flag, and `START_RIDING_JUMP` is action 3 with data 75 for a 0.75 bar. - `remote_mob_data::tests::a_servers_horse_jumps_its_types_strength` - The test fails before the fix (code reverted, test kept): `a_servers_horse_jumps_its_types_strength` panics with `horse: 0` (a server's horse had no jump strength on the client). The other new tests use the new `Rider::client` field and the new `client_moves`, `mount_move` and `riding_jump` functions, so they don't compile on main. With the fix, all of them pass. - In game, on the vanilla 26.3 `server.jar` (`online-mode=false`): a Horizon player rides a tamed, saddled horse summoned with speed 0.3 and jump strength 0.9. - Before: holding W for 3 s, then jumping, leaves the horse at z = 0.5 by the server's `/data get entity`. - After: the same commands take it to z = 40.1. A charged jump lifts it about 2.5 blocks on the server, and the server log shows no "moved wrongly" warnings. - Getting off after the ride, on the vanilla server, sampling the client's copy of the horse about every 100 ms: - Without the move-ignoring part (first commit only): the horse stopped at z = 27.51, then one sample showed it back at z = 22.17 before it returned to 27.51 (the queued interpolation steps replayed). - With it: every sample stays at z = 28.93 until the server's AI walks the horse off. A `/tp` of the ridden horse to z = 15.5 moves the client's copy there at once, and riding on from there reaches z = 28.71 on both sides. - Single player (server thread), after the fix: riding forward for 2 s moves the horse 26.4 blocks on both the client and the server. Jumping and backing up work, and after the player gets off with sneak, the server's AI moves the horse again. - LAN guest (a second game joined the first one, opened to LAN), after the fix: the guest mounts the horse by right-clicking it. Riding forward for 2 s moves it the same 26.4 blocks, and the host sees it there. A charged jump lifts it about 1.9 blocks on the host. ## Screenshots ![before, on a vanilla 26.3 server: holding W on a horse, F3 shows it still at Z 0.5](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/2920-1.png) ![after, same server and input: the horse has ridden to Z 40.1](https://raw.githubusercontent.com/d3grando/horizon/pr-assets/2920-2.png) 🤖 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:59 +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#5496
No description provided.