The Bug:
Frogs don't lay their spawn on waterlogged blocks.
Steps to Reproduce:
Build the setup as shown in the attachment below.
Summon multiple frogs around the setup and breed them.
Observe the behavior of the frogs closely.
Take note as to whether or not frogs lay their spawn on waterlogged blocks.
Observed Behavior:
Despite frogspawn being able to exist above waterlogged blocks, frogs will never place their spawn here. They only consider water blocks themselves to be valid placing locations.
Expected Behavior:
Frogs would be able to lay their spawn on waterlogged blocks.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Attachments
Comments 5
@unknown is correct.
Code analysis (Mojang mappings, 22w15a): in FrogAi#initLaySpawnActivity(...)
, a new TryLaySpawnOnWaterNearLand
behavior is created for the frog. In the code:
net.minecraft.world.entity.ai.behavior.TryLaySpawnOnWaterNearLand.java
...
@Override
protected void start(ServerLevel $$0, Frog $$1, long $$2) {
BlockPos $$3 = $$1.blockPosition().below();
for (Direction $$4 : Direction.Plane.HORIZONTAL) {
BlockPos $$6;
BlockPos $$5 = $$3.relative($$4);
if (!$$0.getBlockState($$5).is(Blocks.WATER) || !$$0.getBlockState($$6 = $$5.above()).isAir()) continue;
$$0.setBlock($$6, this.spawnBlock.defaultBlockState(), 3);
$$0.playSound(null, $$1, SoundEvents.FROG_LAY_SPAWN, SoundSource.BLOCKS, 1.0f, 1.0f);
$$1.getBrain().eraseMemory(this.memoryModule);
return;
}
}
...
The behavior checks if the block adjacent to the block the frog is standing on is water, and if there is air on top of it.
This code possibly relies on block group #minecraft:water, rather that minecraft:water. Since minecraft:flowing_water is in block group #minecraft:water, it causes this mess.
flowing water BLOCK has been removed in 1.13, it got merged with water, the FLUID is a separate ID for flowing and still. Also, the code analysis above already shows it check for the water block, rather than the water fluid.
Relates to MC-250261, seems like it checks for "water" block, rather than "water" fluid; that change would fix both these issues.