The bug
Sculk sensors do not detect turtles placing (laying) an egg. When reproducing, make sure that the turtle doesn't move.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
Comments 5
Can confirm in 1.18.2 and 22w18a. Here's a code analysis regarding this issue.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.18.2 using MCP-Reborn.
net.minecraft.world.entity.animal.Turtle.java
public class Turtle extends Animal {
...
static class TurtleLayEggGoal extends MoveToBlockGoal {
...
public void tick() {
super.tick();
BlockPos blockpos = this.turtle.blockPosition();
if (!this.turtle.isInWater() && this.isReachedTarget()) {
if (this.turtle.layEggCounter < 1) {
this.turtle.setLayingEgg(true);
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
Level level = this.turtle.level;
level.playSound((Player)null, blockpos, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + level.random.nextFloat() * 0.2F);
level.setBlock(this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, Integer.valueOf(this.turtle.random.nextInt(4) + 1)), 3);
this.turtle.setHasEgg(false);
this.turtle.setLayingEgg(false);
this.turtle.setInLoveTime(600);
}
if (this.turtle.isLayingEgg()) {
++this.turtle.layEggCounter;
}
}
}
...
If we look at the above class, we can see that turtles 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. The "BLOCK_PLACE" game event tag would be expected to be used here as turtle eggs are placed into the world. The following line of code could be used in order to fix this:
$LEVEL.gameEvent($PLAYER, GameEvent.BLOCK_PLACE, $BLOCKPOS);
Yes, this also appears to be the case with frogs and frogspawn. I've created a new ticket regarding this which can be found at MC-251934.
Relates to MC-209932