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 @unknown 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.
Can confirm