[PR #2257] [MERGED] Container sounds: random pitch from the right spot, and a close sound on the server thread #4150

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

📋 Pull Request Information

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

Base: main ← Head: fix/container-open-sound-pitch


📝 Commits (5)

  • b3a499d Play chest, barrel and shulker box sounds with a random pitch from the right spot
  • 7102727 Play the container close sound when a server-thread player closes it
  • 18f4dd9 Play container open and close sounds only when the opener count crosses zero
  • 1b9f8ca Merge origin/main into fix/container-open-sound-pitch
  • 86e5db1 Merge origin/main into fix/container-open-sound-pitch

📊 Changes

4 files changed (+109 additions, -75 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+9 -59)
📝 crates/horizon-client/src/game/block_entity_anims.rs (+20 -14)
📝 crates/horizon-client/src/game/lan_actions.rs (+6 -2)
📝 crates/horizon-client/src/game/storage.rs (+74 -0)

📄 Description

What and why

Opening or closing a chest, barrel, shulker box or ender chest played the sound at a fixed pitch of 1.0. Vanilla picks a random pitch from 0.9 to 1.0 every time. A double chest also played from the half you clicked, and a barrel from its centre; vanilla plays a double chest once from the middle of both halves and a barrel from the face it opens on.

A new container_sound helper rolls the pitch and works out the position, and the open and close code now use it.

Closing a container made no sound at all in single player on its server thread: the server handles a player's ContainerClose in guest_container_closed, which updated the lid but never played the close sound (opening goes through the shared use code, so it was heard). That path now plays the same close sound, for everyone around.

Vanilla reference

  • ChestBlockEntity.playSound (volume 0.5, pitch nextFloat * 0.1 + 0.9; the left half stays silent, the right half plays at the combined centre)
  • BarrelBlockEntity.playSound (centre moved half a block along facing)
  • ShulkerBoxBlockEntity.startOpen / stopOpen
  • ChestBlockEntity openersCounter.onClose: playSound with no player, so the closing player hears it too

Self-check

cargo check -p horizon-client passes.


🔄 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/2257 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/container-open-sound-pitch` --- ### 📝 Commits (5) - [`b3a499d`](https://github.com/horizon-rust/horizon/commit/b3a499d85d720acf6d133f47f79806edfa485560) Play chest, barrel and shulker box sounds with a random pitch from the right spot - [`7102727`](https://github.com/horizon-rust/horizon/commit/7102727197458311255f1c8ccf9f903cdb611d50) Play the container close sound when a server-thread player closes it - [`18f4dd9`](https://github.com/horizon-rust/horizon/commit/18f4dd92aea541b501a154f341b36135210ac4d1) Play container open and close sounds only when the opener count crosses zero - [`1b9f8ca`](https://github.com/horizon-rust/horizon/commit/1b9f8cab588abf8e04ed5bfc4805276f9a88d4c7) Merge origin/main into fix/container-open-sound-pitch - [`86e5db1`](https://github.com/horizon-rust/horizon/commit/86e5db17b51e531c05eb1a8690db0ac1648e39d8) Merge origin/main into fix/container-open-sound-pitch ### 📊 Changes **4 files changed** (+109 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+9 -59) 📝 `crates/horizon-client/src/game/block_entity_anims.rs` (+20 -14) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+6 -2) 📝 `crates/horizon-client/src/game/storage.rs` (+74 -0) </details> ### 📄 Description ## What and why Opening or closing a chest, barrel, shulker box or ender chest played the sound at a fixed pitch of 1.0. Vanilla picks a random pitch from 0.9 to 1.0 every time. A double chest also played from the half you clicked, and a barrel from its centre; vanilla plays a double chest once from the middle of both halves and a barrel from the face it opens on. A new `container_sound` helper rolls the pitch and works out the position, and the open and close code now use it. Closing a container made no sound at all in single player on its server thread: the server handles a player's `ContainerClose` in `guest_container_closed`, which updated the lid but never played the close sound (opening goes through the shared use code, so it was heard). That path now plays the same close sound, for everyone around. ## Vanilla reference - `ChestBlockEntity.playSound` (volume 0.5, pitch `nextFloat * 0.1 + 0.9`; the left half stays silent, the right half plays at the combined centre) - `BarrelBlockEntity.playSound` (centre moved half a block along `facing`) - `ShulkerBoxBlockEntity.startOpen` / `stopOpen` - `ChestBlockEntity` `openersCounter.onClose`: `playSound` with no player, so the closing player hears it too ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:15:03 +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#4150
No description provided.