Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-243083

The sounds of filling glass bottles aren't controlled by the "Players" sound slider

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.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
    • None
    • Confirmed
    • Sound
    • Low
    • Gameplay

      The Bug:

      The sounds of filling glass bottles 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 filling glass bottles with water or dragons' breath aren't controlled by the "Players" sound slider when they should be, and are instead controlled by the "Friendly Creatures" sound slider. Please note that this issue cannot be reproduced when filling glass bottles with water from cauldrons.

      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, fill some glass bottles, and listen closely as you do this.
      5. Take note as to whether or not the sounds of filling glass bottles can be heard, (are controlled by the "Friendly Creatures" sound slider instead of the "Players" sound slider).

      Observed Behavior:

      The sounds of filling glass bottles aren't controlled by the "Players" sound slider and are instead controlled by the "Friendly Creatures" sound slider.

      Expected Behavior:

      The sounds of filling glass bottles would be controlled by the "Players" sound slider. The reason why the sounds of filling glass bottles should be controlled by the "Players" sound slider is that the player is filling the glass bottles and is the cause of these sounds being produced, thus should be controlled by the "Players" sound slider.

      Code Analysis:

      Code analysis by Avoma can be found below.

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

      net.minecraft.world.item.BottleItem.java
      public class BottleItem extends Item {
         ...
         public InteractionResultHolder<ItemStack> use(Level $l, Player $p, InteractionHand $ih) {
            ...
               $l.playSound((Player)null, $p.getX(), $p.getY(), $p.getZ(), SoundEvents.BOTTLE_FILL_DRAGONBREATH, SoundSource.NEUTRAL, 1.0F, 1.0F);
               ...
                        $l.playSound($p, $p.getX(), $p.getY(), $p.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F);
                        ...

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

      Potential Fix:

      Simply changing where the sounds of filling glass bottles are sourced from to SoundSource.PLAYERS should resolve this problem. The following lines of code could be used in order to fix this:

      $l.playSound((Player)null, $p.getX(), $p.getY(), $p.getZ(), SoundEvents.BOTTLE_FILL_DRAGONBREATH, SoundSource.PLAYERS, 1.0F, 1.0F);
      $l.playSound($p, $p.getX(), $p.getY(), $p.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.PLAYERS, 1.0F, 1.0F);

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            6 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: