[PR #2280] [MERGED] Firework rockets: smooth flight and spark trail on a server #4169

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

📋 Pull Request Information

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

Base: main ← Head: fix/elytra-firework-trail


📝 Commits (4)

  • 2f3dade Show the firework trail on a boosting rocket and hide its sprite
  • 4248048 Merge origin/main into fix/elytra-firework-trail
  • 91d6bdb Fly firework rockets on by themselves between server updates
  • 484cc94 Add the rockets list to the remote motion test fixture

📊 Changes

4 files changed (+119 additions, -61 deletions)

View changed files

📝 crates/horizon-client/src/game/fireworks.rs (+58 -40)
📝 crates/horizon-client/src/game/remote.rs (+9 -0)
📝 crates/horizon-client/src/game/remote_projectiles.rs (+50 -20)
📝 tests/test_remote_motion.py (+2 -1)

📄 Description

What and why

Fixes #2216.

Two things players see with firework rockets on a server-thread client (single player and LAN guests).

Elytra boost: no spark trail, and a static rocket sprite. When boosting with a rocket while flying with an elytra, there was no spark trail, and the rocket showed up as a static item sprite near the player.

Cause: the server sends the boost rocket with its attached-to id, but the client's rocket tick only moved the rocket for the local player while gliding, never spawned the spark particle, and the renderer only skipped rockets flagged as attached on the host side, not ones attached by id.

Fix:

  • Each client rocket tick now follows the entity it is attached to (the local player, or another player) and spawns the firework spark with vanilla's random velocity.
  • A rocket attached to an entity is not drawn.

Rockets in flight stutter. A rocket that is not attached to anything only eased towards the last position the server tracks (every 10 ticks), so it moved in jerks and stood still in between. In vanilla a rocket 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.

Fix:

  • A server move now sets the rocket's position directly, and a motion packet sets its velocity.
  • Between updates the client tick flies it on: faster by 1.15 horizontally and 0.04 up each tick (an angled crossbow rocket keeps its motion), stopped by blocks. The in-frame rocket tick uses the same flight code, so it behaves as before.

The in-frame path already spawned the trail and skipped the sprite, so that part is unchanged.

Vanilla reference

  • FireworkRocketEntity.tick: attached rocket follows attachedToEntity (setPos, setDeltaMovement); not attached: multiply(1.15, 1.0, 1.15).add(0.0, 0.04, 0.0) unless shot at an angle, then move; on the client every tick it adds ParticleTypes.FIREWORK with nextGaussian() * 0.05, -deltaMovement.y * 0.5, nextGaussian() * 0.05.
  • FireworkRocketEntity.shouldRender / shouldRenderAtSqrDistance: not rendered while isAttachedToEntity.
  • Entity.moveOrInterpolateTo with InterpolationHandler.NO_OP; Entity.lerpMotion for the motion packet.

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/2280 **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/elytra-firework-trail` --- ### 📝 Commits (4) - [`2f3dade`](https://github.com/horizon-rust/horizon/commit/2f3dade42ffd73511b597f8993b3f94b564ca310) Show the firework trail on a boosting rocket and hide its sprite - [`4248048`](https://github.com/horizon-rust/horizon/commit/4248048ab6b0730b1b9dc04f4c1e1b4e2e38933f) Merge origin/main into fix/elytra-firework-trail - [`91d6bdb`](https://github.com/horizon-rust/horizon/commit/91d6bdba85be4bc2f81b5f44ab896257799ecbf5) Fly firework rockets on by themselves between server updates - [`484cc94`](https://github.com/horizon-rust/horizon/commit/484cc945aa0b4c9cf558da2262169e8ae09642fb) Add the rockets list to the remote motion test fixture ### 📊 Changes **4 files changed** (+119 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/fireworks.rs` (+58 -40) 📝 `crates/horizon-client/src/game/remote.rs` (+9 -0) 📝 `crates/horizon-client/src/game/remote_projectiles.rs` (+50 -20) 📝 `tests/test_remote_motion.py` (+2 -1) </details> ### 📄 Description ## What and why Fixes #2216. Two things players see with firework rockets on a server-thread client (single player and LAN guests). **Elytra boost: no spark trail, and a static rocket sprite.** When boosting with a rocket while flying with an elytra, there was no spark trail, and the rocket showed up as a static item sprite near the player. Cause: the server sends the boost rocket with its attached-to id, but the client's rocket tick only moved the rocket for the local player while gliding, never spawned the spark particle, and the renderer only skipped rockets flagged as attached on the host side, not ones attached by id. Fix: - Each client rocket tick now follows the entity it is attached to (the local player, or another player) and spawns the `firework` spark with vanilla's random velocity. - A rocket attached to an entity is not drawn. **Rockets in flight stutter.** A rocket that is not attached to anything only eased towards the last position the server tracks (every 10 ticks), so it moved in jerks and stood still in between. In vanilla a rocket 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. Fix: - A server move now sets the rocket's position directly, and a motion packet sets its velocity. - Between updates the client tick flies it on: faster by 1.15 horizontally and 0.04 up each tick (an angled crossbow rocket keeps its motion), stopped by blocks. The in-frame rocket tick uses the same flight code, so it behaves as before. The in-frame path already spawned the trail and skipped the sprite, so that part is unchanged. ## Vanilla reference - `FireworkRocketEntity.tick`: attached rocket follows `attachedToEntity` (`setPos`, `setDeltaMovement`); not attached: `multiply(1.15, 1.0, 1.15).add(0.0, 0.04, 0.0)` unless shot at an angle, then `move`; on the client every tick it adds `ParticleTypes.FIREWORK` with `nextGaussian() * 0.05`, `-deltaMovement.y * 0.5`, `nextGaussian() * 0.05`. - `FireworkRocketEntity.shouldRender` / `shouldRenderAtSqrDistance`: not rendered while `isAttachedToEntity`. - `Entity.moveOrInterpolateTo` with `InterpolationHandler.NO_OP`; `Entity.lerpMotion` for the motion packet. ## 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:11 +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#4169
No description provided.