[PR #2356] [MERGED] Thrown tridents: smooth flight and Loyalty return on a server #4237

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

📋 Pull Request Information

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

Base: main ← Head: fix/trident-client-flight


📝 Commits (4)

  • 886a84d Fly thrown tridents on by themselves between server updates
  • 10872bd Add the tridents field to the remote motion test fixture
  • d97b58f Send the thrower's entity id with a tracked trident
  • c6276db Merge main into fix/trident-client-flight

📊 Changes

5 files changed (+120 additions, -22 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_entities.rs (+3 -0)
📝 crates/horizon-client/src/game/remote.rs (+13 -0)
📝 crates/horizon-client/src/game/remote_projectiles.rs (+35 -4)
📝 crates/horizon-client/src/game/trident.rs (+67 -16)
📝 tests/test_remote_motion.py (+2 -2)

📄 Description

What and why

Thrown tridents stutter on a server-thread client (single player, LAN guests and dedicated servers). A trident only eased towards the last position the server tracks, which arrives every 20 ticks for arrows, so it jerked along and stood still in between. A Loyalty trident coming back had the same problem.

In vanilla a thrown trident is an arrow (AbstractArrow) and keeps Entity's no-op interpolation: a move packet puts it at the server's position at once, and its own client tick flies it on. Now Horizon does the same:

  • a server move sets the trident's position (and look) directly, and a motion packet sets its velocity;
  • between updates the client tick applies drag (0.99) and gravity (0.05), and a block it reaches holds it;
  • the trident's data now reaches the client: no physics, stuck in the ground and the Loyalty level (before this, a stuck or returning trident was never told it was);
  • a Loyalty trident that has dealt damage or is returning is pulled up and towards its owner's eye by the same code the local game uses, and the owner is the entity id the server sent when it added the trident;
  • the trident turns to face its motion each tick.

Only the server decides what a trident hits and when it is picked up; the client does not.

Vanilla reference

  • Entity.moveOrInterpolateTo with InterpolationHandler.NO_OP; Entity.lerpMotion for the motion packet
  • AbstractArrow.tick (drag, gravity, stop at a block, rotation from motion)
  • ThrownTrident.tick (Loyalty return towards getOwner().getEyePosition()), ThrownTrident.ID_LOYALTY, AbstractArrow.ID_FLAGS and IN_GROUND
  • Projectile.getAddEntityPacket (the owner's id as the data)

Self-check

cargo check -p horizon-client passes.


🔄 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/2356 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/trident-client-flight` --- ### 📝 Commits (4) - [`886a84d`](https://github.com/horizon-rust/horizon/commit/886a84dea086f4c67674a40a4b72e3b90dd904ac) Fly thrown tridents on by themselves between server updates - [`10872bd`](https://github.com/horizon-rust/horizon/commit/10872bdd64bcb3c96cf02a8d544d0645020111c6) Add the tridents field to the remote motion test fixture - [`d97b58f`](https://github.com/horizon-rust/horizon/commit/d97b58fd4a836bd2ba0d5cc4a842c4ef431b3f8a) Send the thrower's entity id with a tracked trident - [`c6276db`](https://github.com/horizon-rust/horizon/commit/c6276dbbdeb56bcf5eff241151cfabbb82e94d9e) Merge main into fix/trident-client-flight ### 📊 Changes **5 files changed** (+120 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_entities.rs` (+3 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+13 -0) 📝 `crates/horizon-client/src/game/remote_projectiles.rs` (+35 -4) 📝 `crates/horizon-client/src/game/trident.rs` (+67 -16) 📝 `tests/test_remote_motion.py` (+2 -2) </details> ### 📄 Description ## What and why Thrown tridents stutter on a server-thread client (single player, LAN guests and dedicated servers). A trident only eased towards the last position the server tracks, which arrives every 20 ticks for arrows, so it jerked along and stood still in between. A Loyalty trident coming back had the same problem. In vanilla a thrown trident is an arrow (`AbstractArrow`) and keeps `Entity`'s no-op interpolation: a move packet puts it at the server's position at once, and its own client tick flies it on. Now Horizon does the same: - a server move sets the trident's position (and look) directly, and a motion packet sets its velocity; - between updates the client tick applies drag (0.99) and gravity (0.05), and a block it reaches holds it; - the trident's data now reaches the client: no physics, stuck in the ground and the Loyalty level (before this, a stuck or returning trident was never told it was); - a Loyalty trident that has dealt damage or is returning is pulled up and towards its owner's eye by the same code the local game uses, and the owner is the entity id the server sent when it added the trident; - the trident turns to face its motion each tick. Only the server decides what a trident hits and when it is picked up; the client does not. ## Vanilla reference - `Entity.moveOrInterpolateTo` with `InterpolationHandler.NO_OP`; `Entity.lerpMotion` for the motion packet - `AbstractArrow.tick` (drag, gravity, stop at a block, rotation from motion) - `ThrownTrident.tick` (Loyalty return towards `getOwner().getEyePosition()`), `ThrownTrident.ID_LOYALTY`, `AbstractArrow.ID_FLAGS` and `IN_GROUND` - `Projectile.getAddEntityPacket` (the owner's id as the data) ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:15:41 +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#4237
No description provided.