mojira.dev
MC-139041

The sounds of fishing bobbers aren't controlled by the "Players" sound slider

The Bug:

The sounds of fishing bobbers aren't controlled by the "Players" sound slider.

Any action that is created through the player doing something that doesn't result in blocks being changed, is normally controlled by the "Players" sound slider. For example, the sounds of players milking cows, shearing sheep, and throwing tridents, are all controlled by the "Players" sound slider as they should be, because the player is producing these sounds and performing these actions.

The sounds of retrieving and throwing fishing bobbers aren't controlled by the "Players" sound slider when they should be, and are instead controlled by the "Friendly Creatures" sound slider.

Steps to Reproduce:

  1. Navigate to the "Music & Sounds" settings menu.

  2. Turn the "Players" sound slider to "OFF".

  3. Turn every other sound slider to "100%".

  4. Exit this menu, obtain a fishing rod, use it multiple times, and listen closely as you do this.

  5. Take note as to whether or not the sounds of fishing bobbers can be heard, (are controlled by the "Friendly Creatures" sound slider instead of the "Players" sound slider).

Observed Behavior:

The sounds of fishing bobbers aren't controlled by the "Players" sound slider and are instead controlled by the "Friendly Creatures" sound slider.

Expected Behavior:

The sounds of fishing bobbers would be controlled by the "Players" sound slider. The reason why the sounds of fishing bobbers should be controlled by the "Players" sound slider is that the player is retrieving or throwing the fishing bobbers and is the cause of these sounds being produced, thus should be controlled by the "Players" sound slider.

Code Analysis:

Code analysis by @unknown can be found below.

The following is based on a decompiled version of Minecraft 1.17.1 using MCP-Reborn.

net.minecraft.world.item.FishingRodItem.java

...
         $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.NEUTRAL, 1.0F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
         ...
         $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.FISHING_BOBBER_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
         ...

If we look at the above class, we can see that the sounds of fishing bobbers are sourced from SoundSource.NEUTRAL, otherwise known as the "Friendly Creatures" sound slider.

Potential Fix:

Simply changing where the sounds of fishing bobbers are sourced from to SoundSource.PLAYERS should resolve this problem. The correct line of code within its class should look something like the following:

net.minecraft.world.item.FishingRodItem.java

...
         $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.PLAYERS, 1.0F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
         ...
         $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.FISHING_BOBBER_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
         ...

Linked issues

Attachments

Comments

TwoPoint

This is still an issue in 1.16.4

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w05b.

Avoma

Can confirm in 1.17.

Avoma

Can confirm in 1.17.1.

Avoma

Can confirm in 21w42a. Here are some extra details regarding this problem.

The Bug:

Fishing rod sounds are controlled by the "Friendly Creatures" sound slider.

Steps to Reproduce:

  • Navigate to the "Music & Sounds" settings menu.

  • Turn the "Friendly Creatures" sound slider to "0%".

  • Turn every other sound slider to "100%".

  • Exit this menu and obtain a fishing rod.

  • Use the fishing rod multiple times, and as you do this, listen closely.

  • Take note as to whether or not fishing rod sounds can be heard, (are controlled by the "Friendly Creatures" sound slider).

Observed Behavior:

Fishing rod sounds are controlled by the "Friendly Creatures" sound slider.

Expected Behavior:

Fishing rod sounds would not be controlled by the "Friendly Creatures" sound slider.

Avoma

Here's a code analysis along with a potential fix regarding this issue. The following is based on a decompiled version of Minecraft 1.17.1 using MCP-Reborn.

Code Analysis:

net.minecraft.world.item.FishingRodItem.java

...
         $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.NEUTRAL, 1.0F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
         ...
         $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.FISHING_BOBBER_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
         ...

If we look at the above class, we can see that fishing rod sounds are sourced from SoundSource.NEUTRAL, otherwise known as the "Friendly Creatures" sound slider.

Potential Fix:

Simply changing where fishing rods sounds are sourced from to SoundSource.PLAYERS should resolve this problem. The correct line of code within its class should look something like the following:

net.minecraft.world.item.FishingRodItem.java

...
         $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.PLAYERS, 1.0F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
         ...
         $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.FISHING_BOBBER_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
         ...
AMGAMES04

Can confirm in 23w33a

 

NOoooo3333

Along with the fix made by Avoma, include:

public SoundSource getSoundSource() {
        return SoundSource.PLAYERS;
    }

This makes all other sounds, such as splashing and sliding down a honey block use the Players category.

Robert

Avoma

(Unassigned)

Confirmed

Platform

Low

Sound

fishing_bobber, fishing_rod

Minecraft 1.13.2, Minecraft 19w12b, Minecraft 19w13b, 1.14.4, 19w36a, ..., 1.21, 1.21.3, 1.21.4, 25w08a, 1.21.5

Retrieved