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

Sculk sensors are not activated upon pufferfish changing their puff state

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 20w51a, 21w03a, 21w05a, 21w05b, 21w06a, 21w07a, 21w08b, 21w10a, 21w14a, 21w17a, 21w19a, 21w20a, 1.17 Pre-release 1, 1.17 Release Candidate 1, 1.17, 1.17.1 Pre-release 1, 1.17.1, 21w38a, 1.18, 1.18.1, 1.18.2, 22w14a, 22w17a, 1.19, 1.19.2, 1.19.3, 1.19.4, 23w14a, 1.20.1, 1.20.4, 23w51b, 1.20.6, 1.21 Pre-Release 3, 1.21, 1.21.3
    • Confirmed
    • Game Events
    • Low
    • Gameplay

      The Bug:

      Sculk sensors are not activated upon pufferfish changing their puff state.

      Steps to Reproduce:

      1. Build the setup as shown in the attachment below. setup.png
      2. Summon a pufferfish in the water and switch into survival mode.
      3. Slowly approach the pufferfish to make it puff, and watch the sculk sensor closely as you do this.
      4. Take note as to whether or not sculk sensors are activated upon pufferfish changing their puff state.

      Observed Behavior:

      Sculk sensors aren't activated.

      Expected Behavior:

      Sculk sensors would be activated.

      Code Analysis:

      Code analysis by Avoma can be found below.

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

      net.minecraft.world.entity.animal.Pufferfish.java
      public class Pufferfish extends AbstractFish {
         ...
         public void tick() {
            if (!this.level.isClientSide && this.isAlive() && this.isEffectiveAi()) {
               if (this.inflateCounter > 0) {
                  if (this.getPuffState() == 0) {
                     this.playSound(SoundEvents.PUFFER_FISH_BLOW_UP, this.getSoundVolume(), this.getVoicePitch());
                     this.setPuffState(1);
                  } else if (this.inflateCounter > 40 && this.getPuffState() == 1) {
                     this.playSound(SoundEvents.PUFFER_FISH_BLOW_UP, this.getSoundVolume(), this.getVoicePitch());
                     this.setPuffState(2);
                  }
      
                  ++this.inflateCounter;
               } else if (this.getPuffState() != 0) {
                  if (this.deflateTimer > 60 && this.getPuffState() == 2) {
                     this.playSound(SoundEvents.PUFFER_FISH_BLOW_OUT, this.getSoundVolume(), this.getVoicePitch());
                     this.setPuffState(1);
                  } else if (this.deflateTimer > 100 && this.getPuffState() == 1) {
                     this.playSound(SoundEvents.PUFFER_FISH_BLOW_OUT, this.getSoundVolume(), this.getVoicePitch());
                     this.setPuffState(0);
                  }
      
                  ++this.deflateTimer;
               }
            }
      
            super.tick();
         }
         ...

      If we look at the above class, we can see that pufferfish changing their puff states isn't registered as a game event as the gameEvent() method is never called, thus not detecting this action as a vibration.

      Potential Fix:

      Simply calling the gameEvent() method where appropriate within this piece of code should resolve this problem. I feel as if a new game event tag would be expected to be used here as none of the currently existing ones seem to fit this action accordingly.

        1. MC-210281.mp4
          7.72 MB
          bugsbugsbugs
        2. MC-210281.png
          1.09 MB
          [Mod] Avoma
        3. setup.png
          879 kB
          [Mod] Avoma

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

              Created:
              Updated:
              CHK: