[PR #1690] [MERGED] Server clients: dropped items and falling blocks fall by themselves between updates #3690

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

📋 Pull Request Information

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

Base: main ← Head: fix/remote-items-fall


📝 Commits (1)

  • fe253fe Server clients: dropped items and falling blocks fall by themselves between updates

📊 Changes

3 files changed (+106 additions, -26 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+51 -21)
📝 crates/horizon-client/src/game/remote_projectiles.rs (+11 -5)
📝 tools/lan_e2e.py (+44 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #1568.

What

As a server's client, a dropped item or a falling block hung in the air, then jumped down about once a second. That covers multiplayer, LAN guests, and single player on its server thread, which is the default path. On the vanilla 26.3 server, a summoned item sampled every ~0.1 s read:

before: 94.0 ×7, 86.57 ×4, 77.0 …            (hangs, jumps, jumps)
after:  93.96 93.61 92.92 91.93 91.1 89.62 87.88 85.88 84.42 82.04 78.54 77.0 …

The server sends their position only every 20 ticks (updateInterval(20)). Horizon moved them only when a position arrived, three lerp steps towards it, and ignored SetEntityMotion for anything but the player.

Vanilla 26.3

  • ItemEntity.tick and FallingBlockEntity.tick run on the client too: gravity, move, drag and ground friction. Only the server merges, removes or places.
  • Neither overrides Entity.createInterpolationHandler (InterpolationHandler.NO_OP), so moveOrInterpolateTo simply setPoses them to each position packet.
  • Their motion comes from recreateFromPacket (setDeltaMovement(packet.getMovement())) and from handleSetEntityMotion → Entity.lerpMotion, for any entity.

Fix

  • Position packets snap items and falling blocks (and set the item's on-ground flag) instead of starting a lerp.
  • AddEntity's motion and SetEntityMotion set their velocity, kept for an item still waiting for its stack.
  • Each tick the client runs ItemEntity::tick and fall_step, the same code in-frame single player uses. It ignores their "remove" answers: the server removes them. A falling block that lands waits there, with no vertical motion, until the server places it.

How tested

  • New python3 tools/lan_e2e.py --check falling: the host summons a diamond and falling sand 30 blocks above the guest, and the guest samples both every 2 ticks over 16 ticks.
    • Before: FAIL the item fell in 2 of 6 samples: item [None, 94.907, 94.881, 94.881, 94.881, 94.881, 94.881, 89.070], falling block [95.0, 94.960, 94.960 ×5, 89.575]
    • After: PASS item [None, 95.61, 94.92, 93.53, 92.14, 90.49, 88.57, 85.65], falling block [96.0, 95.61, 95.19, 93.93, 92.14, 91.07, 89.24, 86.42]
  • Vanilla 26.3 server.jar on the test bed: the samples above. The item lands at 77.0 where the server has it.

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at 76638aaf8, 51 min 7 s)

Check Result
Scope ✅ 3 files, +106 −26
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ❌ 252 run, FAILED (errors=2) (20 s)
rustfmt ✅ (3 s)
clippy ✅ (12 s)
tests: horizon-client ✅ 1199 passed (3 min 2 s)
doc tests ✅ 0 passed (1 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ✅ 29 affected, 29 passed (47 min 12 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The two Python test errors (test_reuses_until_an_input_or_output_changes, test_report_rejects_sources_changed_during_a_run) fail the same way on main on this Mac (java not on the test's PATH; /private/var vs /var temp paths). They are unrelated.

Not in this PR

Primed TNT and experience orbs have the same pattern (they tick on a client too). That's a follow-up once their interpolation handlers are checked.

Needs Ludovic

Nothing.

🤖 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/1690 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/remote-items-fall` --- ### 📝 Commits (1) - [`fe253fe`](https://github.com/horizon-rust/horizon/commit/fe253fe534c7dc45e371d8f2c4508e25826da898) Server clients: dropped items and falling blocks fall by themselves between updates ### 📊 Changes **3 files changed** (+106 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+51 -21) 📝 `crates/horizon-client/src/game/remote_projectiles.rs` (+11 -5) 📝 `tools/lan_e2e.py` (+44 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #1568. ## What As a server's client, a dropped item or a falling block hung in the air, then jumped down about once a second. That covers multiplayer, LAN guests, and single player on its server thread, which is the default path. On the vanilla 26.3 server, a summoned item sampled every ~0.1 s read: ``` before: 94.0 ×7, 86.57 ×4, 77.0 … (hangs, jumps, jumps) after: 93.96 93.61 92.92 91.93 91.1 89.62 87.88 85.88 84.42 82.04 78.54 77.0 … ``` The server sends their position only every 20 ticks (`updateInterval(20)`). Horizon moved them only when a position arrived, three lerp steps towards it, and ignored `SetEntityMotion` for anything but the player. ## Vanilla 26.3 - `ItemEntity.tick` and `FallingBlockEntity.tick` run on the client too: gravity, `move`, drag and ground friction. Only the server merges, removes or places. - Neither overrides `Entity.createInterpolationHandler` (`InterpolationHandler.NO_OP`), so `moveOrInterpolateTo` simply `setPos`es them to each position packet. - Their motion comes from `recreateFromPacket` (`setDeltaMovement(packet.getMovement())`) and from `handleSetEntityMotion` → `Entity.lerpMotion`, for any entity. ## Fix - Position packets snap items and falling blocks (and set the item's on-ground flag) instead of starting a lerp. - `AddEntity`'s motion and `SetEntityMotion` set their velocity, kept for an item still waiting for its stack. - Each tick the client runs `ItemEntity::tick` and `fall_step`, the same code in-frame single player uses. It ignores their "remove" answers: the server removes them. A falling block that lands waits there, with no vertical motion, until the server places it. ## How tested - New `python3 tools/lan_e2e.py --check falling`: the host summons a diamond and falling sand 30 blocks above the guest, and the guest samples both every 2 ticks over 16 ticks. - Before: `FAIL the item fell in 2 of 6 samples: item [None, 94.907, 94.881, 94.881, 94.881, 94.881, 94.881, 89.070], falling block [95.0, 94.960, 94.960 ×5, 89.575]` - After: `PASS item [None, 95.61, 94.92, 93.53, 92.14, 90.49, 88.57, 85.65], falling block [96.0, 95.61, 95.19, 93.93, 92.14, 91.07, 89.24, 86.42]` - Vanilla 26.3 server.jar on the test bed: the samples above. The item lands at 77.0 where the server has it. **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at 76638aaf8, 51 min 7 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +106 −26 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ❌ 252 run, FAILED (errors=2) (20 s) | | rustfmt | ✅ (3 s) | | clippy | ✅ (12 s) | | tests: horizon-client | ✅ 1199 passed (3 min 2 s) | | doc tests | ✅ 0 passed (1 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ✅ 29 affected, 29 passed (47 min 12 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The two Python test errors (`test_reuses_until_an_input_or_output_changes`, `test_report_rejects_sources_changed_during_a_run`) fail the same way on main on this Mac (`java` not on the test's PATH; `/private/var` vs `/var` temp paths). They are unrelated. ## Not in this PR Primed TNT and experience orbs have the same pattern (they tick on a client too). That's a follow-up once their interpolation handlers are checked. ## Needs Ludovic Nothing. 🤖 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 04:11:27 +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#3690
No description provided.