[PR #1535] [MERGED] Servers wait for the player's client to finish breaking a block #3567

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

📋 Pull Request Information

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

Base: main ← Head: fix/dg1-mining


📝 Commits (1)

  • ea424eb LAN and dedicated servers wait for the player's client to finish breaking a block

📊 Changes

2 files changed (+74 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+6 -1)
📝 tools/lan_e2e.py (+68 -0)

📄 Description

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

What players saw

A player on a Horizon dedicated server (Linux, Vulkan) posted a video where some logs vanish as soon as their cracks finish, with no destroy particles, and the log's item appears before the block is gone. In the frames where it happens, the server removed the block before the player's client predicted the break.

Cause

tick_mining runs for LAN guests and for the dedicated server's players too (as_guest, lan_acting). It broke the block as soon as the server's own count reached 1. Vanilla's ServerPlayerGameMode never does that: its tick only advances the progress and sends the cracks. The block breaks on the client's STOP_DESTROY_BLOCK (progress since START ≥ 0.7), on the delayed destroy, or at once on START when it is instant. A client running even a tick behind the server lost the block before it predicted the break, so it got no particles and no sound.

Fix

For a player acting through the host, tick_mining breaks the block only when it is instant (the first tick); otherwise it waits for guest_stop_digging / guest_delayed_destroy, which already follow vanilla. The host's own mining is unchanged.

Check

tools/lan_e2e.py --check digging:

  • the guest holds attack across six oak logs with a copper axe and must hear six block.wood.break;
  • then it digs stone with a wooden pickaxe and its process is stopped (SIGSTOP) for one second partway through. When it resumes, the stone must still be there on the guest and on the server, and the guest's own crack finishes it (one block.stone.break).
binary digging
main before this branch FAIL: the server broke the stone while the guest stalled (guest progress 0.44, 0 break sounds)
this branch PASS, in single player and --server-thread

Also passing on this branch in both modes: cracks, underwater, deathmining, swings, drops and predict.

One difference remains, cosmetic: for one frame the block can show without its last crack before it vanishes. Horizon re-meshes the chunk off-thread, while vanilla rebuilds it at once when the player changed the block.

Self-check

  • cargo fmt --all -- --check: clean
  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test -p horizon-client: pass
  • tools/parity.py --changed origin/main: 28 passed, 0 failed

🤖 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/1535 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/dg1-mining` --- ### 📝 Commits (1) - [`ea424eb`](https://github.com/horizon-rust/horizon/commit/ea424ebd52dd500173c70c18b6ad5aeecee561d3) LAN and dedicated servers wait for the player's client to finish breaking a block ### 📊 Changes **2 files changed** (+74 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+6 -1) 📝 `tools/lan_e2e.py` (+68 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What players saw A player on a Horizon dedicated server (Linux, Vulkan) posted a video where some logs vanish as soon as their cracks finish, with no destroy particles, and the log's item appears before the block is gone. In the frames where it happens, the server removed the block before the player's client predicted the break. ## Cause `tick_mining` runs for LAN guests and for the dedicated server's players too (`as_guest`, `lan_acting`). It broke the block as soon as the server's own count reached 1. Vanilla's `ServerPlayerGameMode` never does that: its tick only advances the progress and sends the cracks. The block breaks on the client's `STOP_DESTROY_BLOCK` (progress since START ≥ 0.7), on the delayed destroy, or at once on START when it is instant. A client running even a tick behind the server lost the block before it predicted the break, so it got no particles and no sound. ## Fix For a player acting through the host, `tick_mining` breaks the block only when it is instant (the first tick); otherwise it waits for `guest_stop_digging` / `guest_delayed_destroy`, which already follow vanilla. The host's own mining is unchanged. ## Check `tools/lan_e2e.py --check digging`: - the guest holds attack across six oak logs with a copper axe and must hear six `block.wood.break`; - then it digs stone with a wooden pickaxe and its process is stopped (SIGSTOP) for one second partway through. When it resumes, the stone must still be there on the guest and on the server, and the guest's own crack finishes it (one `block.stone.break`). | binary | digging | | --- | --- | | main before this branch | FAIL: `the server broke the stone while the guest stalled` (guest progress 0.44, 0 break sounds) | | this branch | PASS, in single player and `--server-thread` | Also passing on this branch in both modes: cracks, underwater, deathmining, swings, drops and predict. One difference remains, cosmetic: for one frame the block can show without its last crack before it vanishes. Horizon re-meshes the chunk off-thread, while vanilla rebuilds it at once when the player changed the block. ## Self-check - `cargo fmt --all -- --check`: clean - `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo test -p horizon-client`: pass - `tools/parity.py --changed origin/main`: 28 passed, 0 failed 🤖 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:10:29 +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#3567
No description provided.