Endermen usually do not teleport to any waterlogged blocks, to avoid teleporting into water.
But there is a case where they do.
https://www.youtube.com/watch?v=Ad8H2UvYR54&feature=youtu.be
Steps to reproduce:
1. Open a void world, or go to the end and fly away from the end islands.
2. Make a plattform of waterlogged blocks, with a full surface that are movement-blocking [see comment from 6th April 2021]
(For example waterlogged top slabs: /fill ~ ~ ~10 ~ ~ ~10 minecraft:smooth_stone_slab[type=top,waterlogged=true]
2.1 Light up the platform of slabs, to stop endermen from spawning on it
3. Make another platform of any full block only a few blocks away. (/fill ~ ~ ~ ~10 ~ ~10 minecraft:smooth_stone)
4. Summon endermen on the second platform, for example with a repeating command block in the middle a few blocks above.
(/summon minecraft:enderman ~ ~-4 ~)
Note how none of the endermen teleport to the platform of waterlogged top slabs!
Then:
5. Make a ceiling at least 3 blocks (and maximum 20, so best something like 5) above the waterlogged top slabs -> The endermen will, as expected, teleport to the ceiling (/fill ~ ~ ~ ~10 ~ ~10 minecraft:smooth_stone)
6. Cover the ceiling in water (/fill ~ ~ ~ ~10 ~ ~10 minecraft:water)
NOTE: Now endermen will teleport to the platform of waterlogged slabs!!!
See video for an example of the setup: endermen tp although they shouldn't - YouTube
Comments 6
@Hudson Schlumberger
That makes sense, and that means that there just needs to be some blocks above, that aren't valid for teleporting, like what the water does in how I experienced it
It might not even need to block the teleporting, it will just be less likely and harder to spot, because the endermen would directly teleport to the 'ceiling' blocks
Update: The Endermen teleport to any movement blocking material, even if the water is accessible from the top (like waterlogged bottom slabs, or waterlogged trapdoors(on the lower block) and things. https://youtu.be/RyI8t3DV0Hc
This confirms that the issue has to do with the tags different blocks have (movement-blocking, waterlogged, etc.),
and there needs to be either a new tag created, that classes blocks if the endermen can stand on the top safely,
ORthe Enderman AI has to also check if the block it will teleport to is waterlogged (of course the simpler approach, and more desirable)
I think I see what's happening here, looking at decompiled code for Java 1.19.
1. net.minecraft.world.entity.monster.Enderman
's teleport(double, double, double)
looks for the first block from the target location (inclusive) down for one made of a movement-blocking material (.getMaterial().blocksMotion()
).
2. If that block is not found or is waterlogged, it rejects the teleportation.
3. Otherwise, it calls randomTeleport()
, which is inherited from net.minecraft.world.entity.LivingEntity
. It passes the original target location, not the top of the block found, but the bug here would still occur anyway.
4. randomTeleport()
looks for the first block below that target location that is movement blocking and tries to teleport there, failing if there's a collision.
The case described in the bug happens when a roof block itself (one with air or other non-movement-blocking material below) is selected as the teleport location. Steps 1 stops at the selected roof block itself, and that passes step 2. But step 3, which does the actual teleportation, finds the waterlogged block underneath the roof instead and teleports there.
Chances are the logic in step 1 should be changed to match that in step 3.
A workaround would be to make your roof blocks waterlogged.
I am having a similar bug with endermen teleporting onto waterlogged top slabs when there is a layer of blocks above it that is thicker than ~32 blocks. Something like (/fill ~ ~ ~ ~10 ~40 ~10 minecraft:smooth_stone)