[PR #1151] [MERGED] A guest's door, trapdoor, fence gate, lever and button use is predicted, and heard once #3097

Closed
opened 2026-11-02 16:01:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/guest-predicts-door-use


📝 Commits (2)

  • a4247e9 A guest's door, trapdoor, fence gate, lever and button use is predicted
  • 56591ef A guest hears its door at once, and only once

📊 Changes

5 files changed (+187 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/audio.rs (+7 -0)
📝 crates/horizon-client/src/game/control.rs (+1 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+30 -0)
📝 crates/horizon-client/src/game/remote.rs (+99 -7)
📝 tools/lan_e2e.py (+50 -3)

📄 Description

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

Fixes #869

What

Vanilla's MultiPlayerGameMode.useItemOn runs the use on the client's own level inside startPrediction, records each changed block under the packet's sequence (BlockStatePredictionHandler) until ClientboundBlockChangedAckPacket settles them. A Horizon guest only sent the use: its door opened one round trip later.

  • The guest already ran the use on a dry copy of its level; the blocks that use changes are now kept on its level as predictions under the use's sequence when they are all hand-operated: a wooden or copper door, trapdoor or fence gate, a lever or a button (an iron door has no hand use).
  • The use's sound: vanilla plays it with level.playSound(player, ...), so the clicker hears it from its own use and the server sends it to the others only. The guest now plays the sounds of the use it predicts, and the host sends them to the other players only. The control socket's status counts the positional sounds each game played (heard).

Proof

tools/lan_e2e.py --check predict (new): with the host process frozen, the oak door the guest clicks is already open on the guest's side (both halves) and heard once; once the server answers it stays open on both sides and each side heard it once; an iron door stays shut. Passes in-frame and --server-thread.

Self-check

All 18 B5 branches merged on one integration commit over origin/main b31cb422 (Mac mini):

cargo fmt --all --check                                                  ok
set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings   exit 0, no ^error
cargo test -p horizon-client                                             1087 passed, 0 failed
python3 tools/parity.py --changed origin/main                            102 passed, 0 failed (over b7390d78)
python3 tools/parity.py --changed-files <explosion.rs>                   22 passed, 0 failed (over b31cb422, after rebasing onto #1101)

tools/lan_e2e.py, full runs over b31cb422 (48 checks):

  • --server-thread: 47 passed; swings (the guest's hoe) failed after earlier checks and passes alone.
  • in-frame: 44 passed. cracks caught a guest's crack left behind when its own tick broke the block (fixed in the cracks PR; swings then cracks and a 3-break probe now pass in both modes). barter (piglin gone), swings and effects fail only after earlier checks and pass alone.
  • sign (not touched here) fails about 1 run in 4, on main too: place reports 2 ticks after the click, sometimes before the server's answer. Noted in FEATURES.md with the other flakes.

🤖 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/1151 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/guest-predicts-door-use` --- ### 📝 Commits (2) - [`a4247e9`](https://github.com/horizon-rust/horizon/commit/a4247e9323f45f2e1a41c1e9715a3ed1406aa4ea) A guest's door, trapdoor, fence gate, lever and button use is predicted - [`56591ef`](https://github.com/horizon-rust/horizon/commit/56591efa5f4b38f20ce3474b5d8283d15475f989) A guest hears its door at once, and only once ### 📊 Changes **5 files changed** (+187 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/audio.rs` (+7 -0) 📝 `crates/horizon-client/src/game/control.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+30 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+99 -7) 📝 `tools/lan_e2e.py` (+50 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #869 ## What Vanilla's `MultiPlayerGameMode.useItemOn` runs the use on the client's own level inside `startPrediction`, records each changed block under the packet's sequence (`BlockStatePredictionHandler`) until `ClientboundBlockChangedAckPacket` settles them. A Horizon guest only sent the use: its door opened one round trip later. - The guest already ran the use on a dry copy of its level; the blocks that use changes are now kept on its level as predictions under the use's sequence when they are all hand-operated: a wooden or copper door, trapdoor or fence gate, a lever or a button (an iron door has no hand use). - The use's sound: vanilla plays it with `level.playSound(player, ...)`, so the clicker hears it from its own use and the server sends it to the others only. The guest now plays the sounds of the use it predicts, and the host sends them to the other players only. The control socket's `status` counts the positional sounds each game played (`heard`). ## Proof `tools/lan_e2e.py --check predict` (new): with the host process frozen, the oak door the guest clicks is already open on the guest's side (both halves) and heard once; once the server answers it stays open on both sides and each side heard it once; an iron door stays shut. Passes in-frame and `--server-thread`. ### Self-check All 18 B5 branches merged on one integration commit over origin/main `b31cb422` (Mac mini): ``` cargo fmt --all --check ok set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings exit 0, no ^error cargo test -p horizon-client 1087 passed, 0 failed python3 tools/parity.py --changed origin/main 102 passed, 0 failed (over b7390d78) python3 tools/parity.py --changed-files <explosion.rs> 22 passed, 0 failed (over b31cb422, after rebasing onto #1101) ``` `tools/lan_e2e.py`, full runs over `b31cb422` (48 checks): - `--server-thread`: 47 passed; `swings` (the guest's hoe) failed after earlier checks and passes alone. - in-frame: 44 passed. `cracks` caught a guest's crack left behind when its own tick broke the block (fixed in the cracks PR; `swings` then `cracks` and a 3-break probe now pass in both modes). `barter` (piglin gone), `swings` and `effects` fail only after earlier checks and pass alone. - `sign` (not touched here) fails about 1 run in 4, on main too: `place` reports 2 ticks after the click, sometimes before the server's answer. Noted in FEATURES.md with the other flakes. 🤖 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 16:01: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#3097
No description provided.