[PR #1945] [MERGED] Play anvil result sounds once for every player #3883

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

📋 Pull Request Information

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

Base: main ← Head: t3/fix-anvil-combining-sound


📝 Commits (1)

  • b6efebc Play anvil result sounds once for every player

📊 Changes

3 files changed (+25 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+7 -1)
📝 crates/horizon-client/src/game/lan.rs (+3 -3)
📝 tools/lan_e2e.py (+15 -5)

📄 Description

🤖 Opened by rdbt’s AI agent (OpenAI Codex), not by rdbt himself.

What and why

Fixes #1907. Anvil result sounds were captured as positional sound packets as well as being played from level events, so nearby clients could hear them twice. Play anvil use/break sounds locally from their level event, and deliver that event to the acting player too, who does not predict it.

Extend the existing anvil LAN harness to have both players repair and rename a sword, asserting that both players hear exactly one anvil sound for each result. The fix is scoped to anvil result events; #1829 handles global events and explosion sounds separately.

Vanilla reference

Minecraft 26.3 AnvilMenu.onTake emits one event (1029 for breaking, otherwise 1030). LevelAccessor.levelEvent(int, BlockPos, int) passes no excluded player, and LevelEventHandler.levelEvent plays the corresponding local sound once. Read the pinned vanilla bytecode with tools/rea_vanilla.py and javap.

Self-check

Passed python3 tools/lan_e2e.py --check anvil and python3 tools/lan_e2e.py --server-thread --check anvil: both listeners heard one sound for both players' results, and the repair/name/XP assertions passed.

Ran the self-check with fresh HORIZON_HOME, HORIZON_LAUNCHER_HOME, XDG_DATA_HOME and XDG_CONFIG_HOME, audio disabled and launcher self-update disabled. An initial unisolated run failed the unrelated unreachable-control test because the default home's No AI setting denies control; the isolated full rerun below passed.

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at 74768d2ee, 3 min 9 s)

Check Result
Scope ✅ 3 files, +25 −9
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 287 passed (25 s)
rustfmt ✅ (8 s)
clippy ✅ (2 s)
tests: horizon-client ✅ 1253 passed (2 min 11 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 30 affected, to run in CI (--quick): arrow, block_particles, block_removal, breaking_model, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, enchanting, hardcore_respawn and 18 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Codex


🔄 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/1945 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `t3/fix-anvil-combining-sound` --- ### 📝 Commits (1) - [`b6efebc`](https://github.com/horizon-rust/horizon/commit/b6efebc87908e113cbf555496e61e61f1c685d16) Play anvil result sounds once for every player ### 📊 Changes **3 files changed** (+25 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+7 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+3 -3) 📝 `tools/lan_e2e.py` (+15 -5) </details> ### 📄 Description > 🤖 Opened by rdbt’s AI agent (OpenAI Codex), not by rdbt himself. ## What and why Fixes #1907. Anvil result sounds were captured as positional sound packets as well as being played from level events, so nearby clients could hear them twice. Play anvil use/break sounds locally from their level event, and deliver that event to the acting player too, who does not predict it. Extend the existing anvil LAN harness to have both players repair and rename a sword, asserting that both players hear exactly one anvil sound for each result. The fix is scoped to anvil result events; #1829 handles global events and explosion sounds separately. ## Vanilla reference Minecraft 26.3 `AnvilMenu.onTake` emits one event (1029 for breaking, otherwise 1030). `LevelAccessor.levelEvent(int, BlockPos, int)` passes no excluded player, and `LevelEventHandler.levelEvent` plays the corresponding local sound once. Read the pinned vanilla bytecode with `tools/rea_vanilla.py` and `javap`. ## Self-check Passed `python3 tools/lan_e2e.py --check anvil` and `python3 tools/lan_e2e.py --server-thread --check anvil`: both listeners heard one sound for both players' results, and the repair/name/XP assertions passed. Ran the self-check with fresh `HORIZON_HOME`, `HORIZON_LAUNCHER_HOME`, `XDG_DATA_HOME` and `XDG_CONFIG_HOME`, audio disabled and launcher self-update disabled. An initial unisolated run failed the unrelated unreachable-control test because the default home's No AI setting denies control; the isolated full rerun below passed. **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at 74768d2ee, 3 min 9 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +25 −9 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 287 passed (25 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (2 s) | | tests: horizon-client | ✅ 1253 passed (2 min 11 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 30 affected, to run in CI (--quick): arrow, block_particles, block_removal, breaking_model, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, enchanting, hardcore_respawn and 18 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:59 +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#3883
No description provided.