[PR #5124] [MERGED] Sync item entities immediately after velocity jumps and slime bounces (#5080) #6090

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

📋 Pull Request Information

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

Base: main ← Head: fix-item-slime-bounce-5080


📝 Commits (1)

  • b4980bc Sync item entities immediately after velocity jumps and slime bounces (#5080)

📊 Changes

7 files changed (+71 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/entities.rs (+60 -0)
📝 crates/horizon-client/src/entities/fluids.rs (+1 -0)
📝 crates/horizon-client/src/entity_nbt.rs (+2 -0)
📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/lan.rs (+5 -0)
📝 crates/horizon-client/src/game/machines.rs (+1 -0)
📝 crates/horizon-client/src/game/remote.rs (+1 -0)

📄 Description

🤖 Opened by mulareal's AI agent (Antigravity, Gemini 4 Argon), not by mulareal personally.

What

Dropped items that bounce on a slime block or are launched by a moving slime block immediately sync their new velocity and position to clients instead of waiting for the 20-tick tracker interval.

Fixes #5080

Why

  • minecraft:item has an updateInterval of 20 ticks (EntityType.ITEM). In vanilla, ItemEntity.tick sets this.needsSync = true whenever getDeltaMovement().subtract(oldMovement).lengthSqr() > 0.01, which forces ServerEntity.sendChanges to broadcast ClientboundSetEntityMotionPacket and ClientboundEntityPositionSyncPacket on the same tick.
  • ItemEntity in entities.rs had no needs_sync flag, and lan_tracked_entities in game/lan.rs never set e.needs_sync / e.precise for dropped items, so clients only learned about a slime bounce or piston launch up to 19 ticks later.

Fix

  • Add needs_sync to ItemEntity (entities.rs) and set it in ItemEntity::tick when velocity.subtract(old_velocity).length_squared() > 0.01 and in ItemEntity::piston_slime_bounce.
  • Forward d.needs_sync to e.needs_sync and e.precise in lan_tracked_entities and clear it after lan_sync_entities in tick_server (game/lan.rs).

Checked

  • cargo test -p horizon-client --lib --no-default-features entities::slime_bounce_tests:: (6 passed)
Check Result
Scope ✅ 7 files, +71 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 484 passed
rustfmt ✅
clippy (horizon-client) ✅
tests: horizon-client ✅ 978 passed
doc tests ✅ 0 passed
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

🤖 Generated with Antigravity


🔄 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/5124 **Author:** [@mulareal](https://github.com/mulareal) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix-item-slime-bounce-5080` --- ### 📝 Commits (1) - [`b4980bc`](https://github.com/horizon-rust/horizon/commit/b4980bc77927c020076dc2df9220900fa96b667e) Sync item entities immediately after velocity jumps and slime bounces (#5080) ### 📊 Changes **7 files changed** (+71 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entities.rs` (+60 -0) 📝 `crates/horizon-client/src/entities/fluids.rs` (+1 -0) 📝 `crates/horizon-client/src/entity_nbt.rs` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+5 -0) 📝 `crates/horizon-client/src/game/machines.rs` (+1 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+1 -0) </details> ### 📄 Description > 🤖 Opened by mulareal's AI agent (Antigravity, Gemini 4 Argon), not by mulareal personally. ## What Dropped items that bounce on a slime block or are launched by a moving slime block immediately sync their new velocity and position to clients instead of waiting for the 20-tick tracker interval. Fixes #5080 ## Why - `minecraft:item` has an `updateInterval` of 20 ticks (`EntityType.ITEM`). In vanilla, `ItemEntity.tick` sets `this.needsSync = true` whenever `getDeltaMovement().subtract(oldMovement).lengthSqr() > 0.01`, which forces `ServerEntity.sendChanges` to broadcast `ClientboundSetEntityMotionPacket` and `ClientboundEntityPositionSyncPacket` on the same tick. - `ItemEntity` in `entities.rs` had no `needs_sync` flag, and `lan_tracked_entities` in `game/lan.rs` never set `e.needs_sync` / `e.precise` for dropped items, so clients only learned about a slime bounce or piston launch up to 19 ticks later. ## Fix - Add `needs_sync` to `ItemEntity` (`entities.rs`) and set it in `ItemEntity::tick` when `velocity.subtract(old_velocity).length_squared() > 0.01` and in `ItemEntity::piston_slime_bounce`. - Forward `d.needs_sync` to `e.needs_sync` and `e.precise` in `lan_tracked_entities` and clear it after `lan_sync_entities` in `tick_server` (`game/lan.rs`). ## Checked - `cargo test -p horizon-client --lib --no-default-features entities::slime_bounce_tests::` (6 passed) | Check | Result | |---|---| | Scope | ✅ 7 files, +71 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 484 passed | | rustfmt | ✅ | | clippy (`horizon-client`) | ✅ | | tests: horizon-client | ✅ 978 passed | | doc tests | ✅ 0 passed | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | 🤖 Generated with [Antigravity](https://antigravity.google) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:11:33 +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#6090
No description provided.