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

Sculk sensors are not activated upon chickens laying eggs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.19 Pre-release 3
    • 20w51a, 21w03a, 21w05a, 21w05b, 21w06a, 21w07a, 21w08b, 21w10a, 21w14a, 21w15a, 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
    • Confirmed
    • Game Events
    • Normal

      The Bug:

      Sculk sensors are not activated upon chickens laying eggs.

      Steps to Reproduce:

      • Place down a sculk sensor.
      • Summon a chicken that will immediately lay an egg nearby.
      • /summon minecraft:chicken ~ ~ ~ {NoAI:1b,EggLayTime:1}
      • Take note as to whether or not sculk sensors are activated upon chickens laying eggs.

      Observed Behavior:

      Sculk sensors are not activated upon chickens laying eggs.

      Expected Behavior:

      Sculk sensors would be activated upon chickens laying eggs.

      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.Chicken.java
      public class Chicken extends Animal {
         ...
         public void aiStep() {
            super.aiStep();
            ...
            if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
               this.playSound(SoundEvents.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
               this.spawnAtLocation(Items.EGG);
               this.eggTime = this.random.nextInt(6000) + 6000;
            }
      
         }
         ...

      If we look at the above class, we can see that chickens laying eggs simply 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-210277.mp4
          4.24 MB
          bugsbugsbugs
        2. MC-210277.png
          2.47 MB
          [Mod] Avoma
        3. MC-210277-1.mp4
          3.77 MB
          [Mod] Avoma

            kingbdogz [Mojang] Brandon Pearce
            Avoma [Mod] Avoma
            Votes:
            7 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: