[PR #218] [MERGED] Items, orbs and arrows fly to whoever picks them up (#142) #2411

Closed
opened 2026-11-02 15:55:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/pickup-anim-142


📝 Commits (1)

  • aec497c Items, orbs and arrows fly to whoever picks them up (#142)

📊 Changes

12 files changed (+324 additions, -13 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+34 -5)
📝 crates/horizon-client/src/game/allays.rs (+5 -0)
📝 crates/horizon-client/src/game/creatures.rs (+20 -3)
📝 crates/horizon-client/src/game/item_draw.rs (+16 -4)
📝 crates/horizon-client/src/game/lan_actions.rs (+20 -1)
➕ crates/horizon-client/src/game/pickups.rs (+185 -0)
📝 crates/horizon-client/src/game/piglins.rs (+5 -0)
📝 crates/horizon-client/src/game/raids.rs (+9 -0)
📝 crates/horizon-client/src/game/remote.rs (+16 -0)
📝 crates/horizon-client/src/game/render_tick.rs (+1 -0)
📝 crates/horizon-client/src/game/sulfur_cubes.rs (+5 -0)
📝 crates/horizon-client/src/game/villagers.rs (+8 -0)

📄 Description

Fixes #142

Root cause. Horizon removed a taken item, XP orb or arrow on the spot. In vanilla, ClientPacketListener.handleTakeItemEntity adds an ItemPickupParticle for every take. The particle holds the taken entity's render state (extractEntity(from, 1.0F)) and ItemPickupParticleGroup draws it at lerp(((life + partial) / 3)², from, target). The target is the collector's x, (y + eyeY) / 2, z, itself lerped between ticks. The particle lives 3 ticks (LIFE_TIME) and joins its group at the end of the particle tick (ParticleEngine.particlesToAdd).

Fix. game/pickups.rs is a port of that particle and its group:

  • Taken::{Item, Orb, Arrow} is the entity as it was when taken. Collector::{Player, Mob, Guest} is who took it.
  • tick_pickups runs right after ParticleEngine.tick: it ages each particle, removes it at 3, follows the collector, then admits the new ones.
  • The item, orb and arrow renderers also draw the live particles at the lerped position, frozen at partial tick 1 (age, bob, spin and light are the entity's at the take).
  • Particles are added for takes by the player (items, including partial stacks, orbs and arrows), by mobs (allays, villagers, piglins, sulfur cubes, a raider's banner), by LAN guests (the host sees the item fly to the guest's model), and for ClientboundTakeItemEntity on a LAN guest or a server.

Evidence.

  • Unit test: the position follows t² and the target's lerp, at the start, mid-tick and at the end.
  • In game on a vscreen: six diamond blocks are taken. In the first frame the hotbar already shows 6 while their copy is still flying to the player (agent-state/wave6a-shots/pickup-142-flying.png). In the next frame they have arrived (pickup-142-arrived.png).
  • Mac mini: fmt and workspace clippy -D warnings are clean.

Not covered: thrown tridents have their own renderer and are still removed at once. On a LAN guest or server, orbs and arrows aren't tracked by entity id, so only items fly there.

🤖 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/218 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/pickup-anim-142` --- ### 📝 Commits (1) - [`aec497c`](https://github.com/horizon-rust/horizon/commit/aec497c94b088c31f48fbd5657d6b4077a74db76) Items, orbs and arrows fly to whoever picks them up (#142) ### 📊 Changes **12 files changed** (+324 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+34 -5) 📝 `crates/horizon-client/src/game/allays.rs` (+5 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+20 -3) 📝 `crates/horizon-client/src/game/item_draw.rs` (+16 -4) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+20 -1) ➕ `crates/horizon-client/src/game/pickups.rs` (+185 -0) 📝 `crates/horizon-client/src/game/piglins.rs` (+5 -0) 📝 `crates/horizon-client/src/game/raids.rs` (+9 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+16 -0) 📝 `crates/horizon-client/src/game/render_tick.rs` (+1 -0) 📝 `crates/horizon-client/src/game/sulfur_cubes.rs` (+5 -0) 📝 `crates/horizon-client/src/game/villagers.rs` (+8 -0) </details> ### 📄 Description Fixes #142 **Root cause.** Horizon removed a taken item, XP orb or arrow on the spot. In vanilla, `ClientPacketListener.handleTakeItemEntity` adds an `ItemPickupParticle` for every take. The particle holds the taken entity's render state (`extractEntity(from, 1.0F)`) and `ItemPickupParticleGroup` draws it at `lerp(((life + partial) / 3)², from, target)`. The target is the collector's `x, (y + eyeY) / 2, z`, itself lerped between ticks. The particle lives 3 ticks (`LIFE_TIME`) and joins its group at the end of the particle tick (`ParticleEngine.particlesToAdd`). **Fix.** `game/pickups.rs` is a port of that particle and its group: - `Taken::{Item, Orb, Arrow}` is the entity as it was when taken. `Collector::{Player, Mob, Guest}` is who took it. - `tick_pickups` runs right after `ParticleEngine.tick`: it ages each particle, removes it at 3, follows the collector, then admits the new ones. - The item, orb and arrow renderers also draw the live particles at the lerped position, frozen at partial tick 1 (age, bob, spin and light are the entity's at the take). - Particles are added for takes by the player (items, including partial stacks, orbs and arrows), by mobs (allays, villagers, piglins, sulfur cubes, a raider's banner), by LAN guests (the host sees the item fly to the guest's model), and for `ClientboundTakeItemEntity` on a LAN guest or a server. **Evidence.** - Unit test: the position follows `t²` and the target's lerp, at the start, mid-tick and at the end. - In game on a vscreen: six diamond blocks are taken. In the first frame the hotbar already shows 6 while their copy is still flying to the player (`agent-state/wave6a-shots/pickup-142-flying.png`). In the next frame they have arrived (`pickup-142-arrived.png`). - Mac mini: fmt and workspace `clippy -D warnings` are clean. Not covered: thrown tridents have their own renderer and are still removed at once. On a LAN guest or server, orbs and arrows aren't tracked by entity id, so only items fly there. 🤖 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-02 15:55:52 +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#2411
No description provided.