mojira.dev
MC-212616

"Dye stains" sound does not play when used on tamed wolves/cats

In 21w03a, a new sound was added for sign dyeing functionality which was also applied to sheep. However, despite wolf and cat collars being dyeable via the exact same functionality, the sound does not play here (note the lack of subtitles in the provided screenshots).

Attachments

Comments 20

[media][media][media][media][media][media][media][media][media][media][media][media][media]

Can confirm in 21w05b.

Can confirm in 21w06a.

Can confirm in 21w08b. Video attached.

10 more comments

Here's a code analysis of this issue. The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn. Please note that I'm quite tentative about this analysis, although I'm persuaded to believe that this is likely the cause of the problem. 🙂

Code Analysis (tentative):

net.minecraft.world.entity.animal.Wolf.java

public class Wolf extends TamableAnimal implements NeutralMob {
   ...
   public InteractionResult mobInteract(Player p_30412_, InteractionHand p_30413_) {
      ...
      if (this.level.isClientSide) {
         ...
      } else {
         if (this.isTame()) {
            ...
            DyeColor dyecolor = ((DyeItem)item).getDyeColor();
            if (dyecolor != this.getCollarColor()) {
               this.setCollarColor(dyecolor);
               if (!p_30412_.getAbilities().instabuild) {
                  itemstack.shrink(1);
               }

               return InteractionResult.SUCCESS;
            }
         } ...

net.minecraft.world.entity.animal.Cat.java

public class Cat extends TamableAnimal {
   ...
   public InteractionResult mobInteract(Player p_28153_, InteractionHand p_28154_) {
      ...
      if (this.level.isClientSide) {
         ...
      } else {
         if (this.isTame()) {
            if (this.isOwnedBy(p_28153_)) {
               ...
               DyeColor dyecolor = ((DyeItem)item).getDyeColor();
               if (dyecolor != this.getCollarColor()) {
                  this.setCollarColor(dyecolor);
                  if (!p_28153_.getAbilities().instabuild) {
                     itemstack.shrink(1);
                  }

                  this.setPersistenceRequired();
                  return InteractionResult.CONSUME;
               }
            }
         } ...

Normally, when a player interacts with an entity that produces a sound upon being interacted with, a method is called that plays the appropriate sound, however, if we look at the above classes, we can see that no methods are called to produce sounds upon these interactions being carried out. As a result of the appropriate method not being called/not existing altogether, no sound is played upon dying wolves' and cats' collars.

Can confirm in 1.18.2.

Can confirm in 1.19 and 22w24a.

Can confirm in 1.19.2.

muzikbike

(Unassigned)

Confirmed

Gameplay

Normal

Sound

missing-sound

21w03a, 21w05b, 21w06a, 21w08b, 21w10a, ..., 1.19.4, 1.20 Pre-release 1, 1.20.1, 1.20.4, 24w34a

Retrieved