The Bug
The goat horn sounds are controlled by the Jukebox/Note Block sound slider
Reproduce
Turn off Jukebox/Note Block sounds
Get a Goat Horn
Play it
Observed Result
It didn't play any sound when the Jukebox/Note Block slider was off
Expected Result
It wouldn't be controlled by the Jukebox/Note Block sound slider instead controlled by the Players slider since the sound is being produced by a player
Code Analysis
Code analysis by @unknown can be found in this comment.
Attachments
Comments 6
I can confirm this behavior in 1.19 Pre-release 2. Here's a code analysis regarding this issue.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.19 Pre-release 2 using Mojang mappings.
net.minecraft.world.item.InstrumentItem.java
public class InstrumentItem extends Item {
...
private static void play(Level level, Player player, Instrument instrument) {
SoundEvent soundEvent = instrument.soundEvent();
float f = instrument.range() / 16.0f;
level.playSound(player, player, soundEvent, SoundSource.RECORDS, f, 1.0f);
level.gameEvent(GameEvent.INSTRUMENT_PLAY, player.position(), GameEvent.Context.of(player));
}
...
If we look at the above class, we can see that the sounds of instruments (goat horns) playing are sourced from SoundSource.RECORDS
, otherwise known as the "Jukebox/Note Blocks" sound slider.
Potential Fix:
Simply changing where the sounds of instruments (goat horns) playing are sourced from to SoundSource.PLAYER
(the "Players" sound slider) should resolve this problem.
I can confirm that this occurs, but this might be intended because goat horns are somewhat musical.