[PR #1829] [MERGED] Global level events reach a server's players; explosions play their packet's sound #3795

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

📋 Pull Request Information

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

Base: main ← Head: fix/global-level-events


📝 Commits (1)

  • 749a2dc Global level events reach a server's players; explosions play their packet's sound

📊 Changes

8 files changed (+84 additions, -22 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/dragon.rs (+4 -3)
📝 crates/horizon-client/src/game/end.rs (+4 -3)
📝 crates/horizon-client/src/game/lan.rs (+3 -0)
📝 crates/horizon-client/src/game/lan_particles.rs (+6 -6)
📝 crates/horizon-client/src/game/level_particles.rs (+33 -0)
📝 crates/horizon-client/src/game/remote.rs (+20 -10)
📝 crates/horizon-client/src/lan/containers.rs (+11 -0)

📄 Description

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

What the player reported

.dezerx on Discord (#horizon-bugs, 2026-10-25, single player): "No sound when I unlock the end portal", and "When I throw a wind charge, it sounds like a TNT explosion".

Vanilla rule

  • EnderEyeItem.useOn completing a frame calls level.globalLevelEvent(1038, …), EnderDragon.tickDeath globalLevelEvent(1028, …). ServerLevel.globalLevelEvent sends ClientboundLevelEventPacket with its global flag to every player on the server; LevelEventHandler.globalLevelEvent plays the sound two blocks from the camera towards the event (block.end_portal.spawn 1.0, entity.ender_dragon.death 5.0, entity.wither.spawn 1.0).
  • ClientPacketListener.handleExplosion plays the packet's explosionSound (volume 4, pitch (1 + (r − r) × 0.2) × 0.7) when playSound is set.

Cause

  • end.rs and dragon.rs played these sounds on the Game's own audio without a position. On a server (the server thread that single player runs since #1514, LAN, dedicated) positionless sounds are never forwarded to the players (Audio::capture keeps positioned ones), so nobody heard the portal open or the dragon die.
  • The client's remote_explode always played entity.generic.explode, whatever the packet said. Horizon's own server sends the burst sound separately (so the server thread was right: entity.wind_charge.wind_burst heard), but a vanilla or Paper server's wind charge, bed or anchor blast came out as TNT.

Change

  • global_level_event (level_particles.rs): plays the sound for this window (play_unshared, so it isn't also sent as a positioned sound) and queues the event for every guest; Hub::global_level_event broadcasts it with global: true.
  • A client handles a global LevelEvent with global_level_event_sound.
  • remote_explode resolves the packet's sound holder (remote_sound_name, shared with ClientboundSoundPacket).

Tested

  • Server thread: completing an end portal frame ring with an eye of ender: the client hears block.end_portal.spawn once (status → heard), the portal opens. Before, the sound was only played positionless on the server's audio (not forwarded).
  • --in-frame: heard once, as before.
  • The explosion sound needs a vanilla server to show (Horizon's server sends playSound: false); not run against one, the change is the packet's own holder read the way ClientboundSoundPacket already reads it.
  • The dragon's roar goes through the same function; not run (the dragon on the server thread is #1530).

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 6a065fa48, 5 min 36 s)

Check Result
Scope ✅ 8 files, +84 −22
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ➖ no Python change
rustfmt ✅ (6 s)
clippy ✅ (38 s)
tests: horizon-client ✅ 1236 passed (4 min 24 s)
doc tests ✅ 0 passed (3 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 108 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_transformer, breaking_model, camera and 96 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Named harnesses (local): sound_event PASS, end_gateway PASS, dedicated_server PASS.

🤖 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/1829 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/global-level-events` --- ### 📝 Commits (1) - [`749a2dc`](https://github.com/horizon-rust/horizon/commit/749a2dc9bd5d0c0367701c59b814141e24b65b19) Global level events reach a server's players; explosions play their packet's sound ### 📊 Changes **8 files changed** (+84 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/dragon.rs` (+4 -3) 📝 `crates/horizon-client/src/game/end.rs` (+4 -3) 📝 `crates/horizon-client/src/game/lan.rs` (+3 -0) 📝 `crates/horizon-client/src/game/lan_particles.rs` (+6 -6) 📝 `crates/horizon-client/src/game/level_particles.rs` (+33 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+20 -10) 📝 `crates/horizon-client/src/lan/containers.rs` (+11 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What the player reported .dezerx on Discord (#horizon-bugs, 2026-10-25, single player): "No sound when I unlock the end portal", and "When I throw a wind charge, it sounds like a TNT explosion". ## Vanilla rule - `EnderEyeItem.useOn` completing a frame calls `level.globalLevelEvent(1038, …)`, `EnderDragon.tickDeath` `globalLevelEvent(1028, …)`. `ServerLevel.globalLevelEvent` sends `ClientboundLevelEventPacket` with its global flag to every player on the server; `LevelEventHandler.globalLevelEvent` plays the sound two blocks from the camera towards the event (`block.end_portal.spawn` 1.0, `entity.ender_dragon.death` 5.0, `entity.wither.spawn` 1.0). - `ClientPacketListener.handleExplosion` plays the packet's `explosionSound` (volume 4, pitch `(1 + (r − r) × 0.2) × 0.7`) when `playSound` is set. ## Cause - end.rs and dragon.rs played these sounds on the `Game`'s own audio without a position. On a server (the server thread that single player runs since #1514, LAN, dedicated) positionless sounds are never forwarded to the players (`Audio::capture` keeps positioned ones), so nobody heard the portal open or the dragon die. - The client's `remote_explode` always played `entity.generic.explode`, whatever the packet said. Horizon's own server sends the burst sound separately (so the server thread was right: `entity.wind_charge.wind_burst` heard), but a vanilla or Paper server's wind charge, bed or anchor blast came out as TNT. ## Change - `global_level_event` (level_particles.rs): plays the sound for this window (`play_unshared`, so it isn't also sent as a positioned sound) and queues the event for every guest; `Hub::global_level_event` broadcasts it with `global: true`. - A client handles a global `LevelEvent` with `global_level_event_sound`. - `remote_explode` resolves the packet's sound holder (`remote_sound_name`, shared with `ClientboundSoundPacket`). ## Tested - Server thread: completing an end portal frame ring with an eye of ender: the client hears `block.end_portal.spawn` once (`status` → `heard`), the portal opens. Before, the sound was only played positionless on the server's audio (not forwarded). - `--in-frame`: heard once, as before. - The explosion sound needs a vanilla server to show (Horizon's server sends `playSound: false`); not run against one, the change is the packet's own holder read the way `ClientboundSoundPacket` already reads it. - The dragon's roar goes through the same function; not run (the dragon on the server thread is #1530). **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 6a065fa48, 5 min 36 s) | Check | Result | | --- | --- | | Scope | ✅ 8 files, +84 −22 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ➖ no Python change | | rustfmt | ✅ (6 s) | | clippy | ✅ (38 s) | | tests: horizon-client | ✅ 1236 passed (4 min 24 s) | | doc tests | ✅ 0 passed (3 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 108 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_transformer, breaking_model, camera and 96 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Named harnesses (local): sound_event PASS, end_gateway PASS, dedicated_server PASS. 🤖 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:12:23 +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#3795
No description provided.