-
Bug
-
Resolution: Fixed
-
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.
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.