[PR #84] [MERGED] Give the fire charge's use sound its own pitch #2315

Closed
opened 2026-11-02 15:54:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/fire-charge-pitch


📝 Commits (1)

  • 162e3d3 Give the fire charge's use sound its own pitch

📊 Changes

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

View changed files

➕ crates/horizon-client/examples/fire_starter_sound_probe.rs (+32 -0)
📝 crates/horizon-client/src/game.rs (+5 -10)
📝 crates/horizon-client/src/items.rs (+21 -0)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFireStarterSoundOracle.java (+66 -0)
➕ tools/test_fire_starter_sound_parity.py (+32 -0)

📄 Description

What was wrong

Placing fire with a fire charge played item.firecharge.use with the flint and steel's pitch: one draw, nextFloat() * 0.4 + 0.8 (game.rs, the fire-starter branch of item use).

What vanilla does

FireChargeItem.useOn plays its sound through the private FireChargeItem.playSound(Level, BlockPos), for both lighting a campfire/candle/candle cake and placing fire: level.playSound(null, pos, SoundEvents.FIRECHARGE_USE, SoundSource.BLOCKS, 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F) with level.getRandom(), so two draws from the level random. FlintAndSteelItem.useOn keeps nextFloat() * 0.4F + 0.8F.

Fix

The sound and pitch of a fire starter are horizon_client::items::fire_starter_sound / fire_starter_pitch (fire charge: two draws; flint and steel: unchanged), used by the item-use code.

Note for #59: its new campfire/candle relighting branch copies the old flint pitch for the fire charge too; once this merges it should call fire_starter_pitch(item == "fire_charge", &mut self.world.random).

Tests

  • New harness tools/test_fire_starter_sound_parity.py (VanillaFireStarterSoundOracle + examples/fire_starter_sound_probe.rs): the real private FireChargeItem.playSound on a ServerLevel stand-in with 20,006 seeded LegacyRandomSources; compares the sound id, volume and pitch bits and the random's next long (the draw count). 20,006/20,006 match.
  • cargo fmt --check, cargo clippy --workspace --all-targets --locked -D warnings and cargo test --workspace --locked pass; tools/check_public_tree.py passes.

🤖 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/84 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/fire-charge-pitch` --- ### 📝 Commits (1) - [`162e3d3`](https://github.com/horizon-rust/horizon/commit/162e3d36f7c00ffc7d34fcfed157c7635b4cd9d4) Give the fire charge's use sound its own pitch ### 📊 Changes **5 files changed** (+156 additions, -10 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/examples/fire_starter_sound_probe.rs` (+32 -0) 📝 `crates/horizon-client/src/game.rs` (+5 -10) 📝 `crates/horizon-client/src/items.rs` (+21 -0) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFireStarterSoundOracle.java` (+66 -0) ➕ `tools/test_fire_starter_sound_parity.py` (+32 -0) </details> ### 📄 Description ## What was wrong Placing fire with a fire charge played `item.firecharge.use` with the flint and steel's pitch: one draw, `nextFloat() * 0.4 + 0.8` (`game.rs`, the fire-starter branch of item use). ## What vanilla does `FireChargeItem.useOn` plays its sound through the private `FireChargeItem.playSound(Level, BlockPos)`, for both lighting a campfire/candle/candle cake and placing fire: `level.playSound(null, pos, SoundEvents.FIRECHARGE_USE, SoundSource.BLOCKS, 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F)` with `level.getRandom()`, so two draws from the level random. `FlintAndSteelItem.useOn` keeps `nextFloat() * 0.4F + 0.8F`. ## Fix The sound and pitch of a fire starter are `horizon_client::items::fire_starter_sound` / `fire_starter_pitch` (fire charge: two draws; flint and steel: unchanged), used by the item-use code. Note for #59: its new campfire/candle relighting branch copies the old flint pitch for the fire charge too; once this merges it should call `fire_starter_pitch(item == "fire_charge", &mut self.world.random)`. ## Tests - New harness `tools/test_fire_starter_sound_parity.py` (`VanillaFireStarterSoundOracle` + `examples/fire_starter_sound_probe.rs`): the real private `FireChargeItem.playSound` on a `ServerLevel` stand-in with 20,006 seeded `LegacyRandomSource`s; compares the sound id, volume and pitch bits and the random's next long (the draw count). 20,006/20,006 match. - `cargo fmt --check`, `cargo clippy --workspace --all-targets --locked -D warnings` and `cargo test --workspace --locked` pass; `tools/check_public_tree.py` passes. 🤖 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 15:54:53 +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#2315
No description provided.