[PR #6832] [MERGED] Sounds reach the LAN guests strictly inside vanilla's radius #7125

Closed
opened 2026-11-03 06:34:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6832
Author: @MSedgeMC
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/sound-broadcast-range


📝 Commits (1)

  • 99deb65 Sound broadcasts leave out a guest exactly on the radius

📊 Changes

2 files changed (+23 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/lan/containers.rs (+22 -4)
📝 tools/port_map/rest-020.tsv (+1 -1)

📄 Description

Vanilla behaviour

ServerLevel.playSeededSound broadcasts a ClientboundSoundPacket with
PlayerList.broadcast(except, x, y, z, (double) sound.getRange(volume), dimension, packet), and
that loop sends only when d*d + e*e + f*f < radius*radius - javap of PlayerList.broadcast
shows the dcmpg followed by ifge past the send. SoundEvent.getRange(volume) is
fixedRange.orElse(volume > 1 ? 16*volume : 16), and in 26.3 no sound event has a fixed range:
SoundEvent.createFixedRangeEvent is reached only from SoundEvents' private
register(Identifier, Identifier, float), which nothing calls (the only two classes in the client
jar that name createFixedRangeEvent are SoundEvent and SoundEvents). So every sound reaches
16 * max(volume, 1) blocks, strictly inside.

What Horizon got wrong

Hub::broadcast_near compared d <= range * range, so a guest standing exactly on the radius was
sent the packet where vanilla leaves them out. The radius itself was already right: Hub::sound
passes 16 * max(volume, 1), and /playsound recomputes the same bound.

The distance test is now within_range, a strict <, and the ledger row that called
SoundEvent.getRange missing names the broadcast it is folded into.

Proven: cargo test -q -p horizon-client-lib --lib lan::containers - 3 passed, including
a_guest_exactly_on_the_radius_hears_nothing (exactly 16 blocks: out; 15.99: in).
cargo clippy -q -p horizon-client-lib --lib clean, rustfmt --edition 2024 --check clean.
Vanilla: javap of PlayerList.broadcast, ServerLevel.playSeededSound and SoundEvent.getRange.

Not proven: no in-game check. In-game check: a guest at exactly 16 blocks from a volume-1 sound
hears nothing, and one block closer hears it.


🔄 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/6832 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/sound-broadcast-range` --- ### 📝 Commits (1) - [`99deb65`](https://github.com/horizon-rust/horizon/commit/99deb6513804dc6d98d364cf3d6f1cc3b64dea92) Sound broadcasts leave out a guest exactly on the radius ### 📊 Changes **2 files changed** (+23 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/containers.rs` (+22 -4) 📝 `tools/port_map/rest-020.tsv` (+1 -1) </details> ### 📄 Description ## Vanilla behaviour `ServerLevel.playSeededSound` broadcasts a `ClientboundSoundPacket` with `PlayerList.broadcast(except, x, y, z, (double) sound.getRange(volume), dimension, packet)`, and that loop sends only when `d*d + e*e + f*f < radius*radius` - `javap` of `PlayerList.broadcast` shows the `dcmpg` followed by `ifge` past the send. `SoundEvent.getRange(volume)` is `fixedRange.orElse(volume > 1 ? 16*volume : 16)`, and in 26.3 no sound event has a fixed range: `SoundEvent.createFixedRangeEvent` is reached only from `SoundEvents`' private `register(Identifier, Identifier, float)`, which nothing calls (the only two classes in the client jar that name `createFixedRangeEvent` are `SoundEvent` and `SoundEvents`). So every sound reaches `16 * max(volume, 1)` blocks, strictly inside. ## What Horizon got wrong `Hub::broadcast_near` compared `d <= range * range`, so a guest standing exactly on the radius was sent the packet where vanilla leaves them out. The radius itself was already right: `Hub::sound` passes `16 * max(volume, 1)`, and `/playsound` recomputes the same bound. The distance test is now `within_range`, a strict `<`, and the ledger row that called `SoundEvent.getRange` missing names the broadcast it is folded into. **Proven:** `cargo test -q -p horizon-client-lib --lib lan::containers` - 3 passed, including `a_guest_exactly_on_the_radius_hears_nothing` (exactly 16 blocks: out; 15.99: in). `cargo clippy -q -p horizon-client-lib --lib` clean, `rustfmt --edition 2024 --check` clean. Vanilla: `javap` of `PlayerList.broadcast`, `ServerLevel.playSeededSound` and `SoundEvent.getRange`. **Not proven:** no in-game check. In-game check: a guest at exactly 16 blocks from a volume-1 sound hears nothing, and one block closer hears it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:34:18 +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#7125
No description provided.