Mojira Archive
MC-243081

The sounds of throwing some projectiles aren't controlled by the "Players" sound slider

The Bug:

The sounds of throwing some projectiles 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 throwing some projectiles aren't controlled by the "Players" sound slider and are instead controlled by the "Friendly Creatures" sound slider. Below I've constructed a table that highlights these errors.

 

Sound Current Assigned Sound Slider Expected Assigned Sound Slider
Throwing eggs Players Players
Throwing tridents Players Players
Throwing splash potions Players Players
Throwing eyes of ender Friendly Creatures Players
Throwing ender pearls Friendly Creatures Players
Throwing experience bottles Friendly Creatures Players
Throwing lingering potions Friendly Creatures Players
Throwing snowballs Friendly Creatures Players
Throwing wind charges Friendly Creatures Players

 

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 and produce any of the affected sounds as listed above that are not currently controlled by the "Players" sound slider.
  5. Take note as to whether or not the sounds of throwing some projectiles can be heard, (are controlled by the "Friendly Creatures" sound slider instead of the "Players" sound slider).

Observed Behavior:

The sounds of throwing some projectiles aren't controlled by the "Players" sound slider and are instead controlled by the "Friendly Creatures" sound slider.

Expected Behavior:

The sounds of throwing all projectiles would be controlled by the "Players" sound slider. The reason why the affected sounds should be controlled by the "Players" sound slider is that the player is throwing these projectiles and is the cause of these sounds being produced, thus should be controlled by the "Players" sound slider.

Code Analysis:

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

net.minecraft.client.renderer.LevelRenderer.java
         ...
         this.level.playLocalSound($$0, SoundEvents.ENDER_EYE_LAUNCH, SoundSource.NEUTRAL, 1.0F, 1.2F, false);
         ...
net.minecraft.world.item.EnderpearlItem.java
      ...
      $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
      ...
net.minecraft.world.item.ExperienceBottleItem.java
      ...
      $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
      ...
net.minecraft.world.item.LingeringPotionItem.java
      ...
      $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.LINGERING_POTION_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
      ...
net.minecraft.world.item.SnowballItem.java
      ...
      $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.SNOWBALL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
      ...

If we look at the above classes, we can see that the sounds of throwing some projectiles are sourced from SoundSource.NEUTRAL, otherwise known as the "Friendly Creatures" sound slider.

Potential Fix:

Simply changing where all of these sounds are sourced from to SoundSource.PLAYERS should resolve this problem. The correct lines of code within their classes should look something like the following:

net.minecraft.client.renderer.LevelRenderer.java
         ...
         this.level.playLocalSound($$0, SoundEvents.ENDER_EYE_LAUNCH, SoundSource.PLAYERS, 1.0F, 1.2F, false);
         ...
net.minecraft.world.item.EnderpearlItem.java
      ...
      $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.ENDER_PEARL_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
      ...
net.minecraft.world.item.ExperienceBottleItem.java
      ...
      $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
      ...
net.minecraft.world.item.LingeringPotionItem.java
      ...
      $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.LINGERING_POTION_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
      ...
net.minecraft.world.item.SnowballItem.java
      ...
      $$0.playSound((Player)null, $$1.getX(), $$1.getY(), $$1.getZ(), SoundEvents.SNOWBALL_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / ($$0.getRandom().nextFloat() * 0.4F + 0.8F));
      ...

Unresolved

[Mod] Avoma

2021-11-28, 02:36 PM

2024-12-09, 01:21 PM

8

4

Confirmed

Low

Gameplay

Sound

1.17.1 - 1.21.41.17.1, 1.18 Release Candidate 3, 1.18, 1.18.1, 22w03a, 22w05a, 22w06a, 1.18.2 Pre-release 1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20.1, 24w06a, 1.21, 1.21.4

-