Minecraft – Do Endermen teleport along valid paths

minecraft-java-edition

When an Enderman teleports, either by accident or after being angered, does it follow a continuous path to the destination? If so, what are the requirements for such a path?

Minecraft wiki made me think that they teleport similar to spawning, only with limited range. Like they pick a spot within 32 blocks, then disappear and appear at that spot. However, after some in-game observation, I'm now under the impression that their teleportation is the same as any mob's movement, only very fast (and perhaps with the ability to jump a little higher).

To give more specific example:

  • there's a room with ceiling 3 blocks above (enough to fit an Enderman)
  • the room is well-lit (mobs can't spawn)
  • walls are made of cobblestone (Endermen can't grief their way through)
  • one side is open, but a deep ravine (let's say, 70 block deep and 4 block wide) with no way around it lies between the room and a place where Endermen can spawn

Will they be able to teleport into this room? If true, then I suppose they don't need a path after all.

Best Answer

From a decompiled 1.7.10 a teleportRandomly function is present in in the Enderman defintion. it is called if the Enderman is:

  • wet
  • on fire
  • in daylight & not fighting
  • is fighting & is closer than 16 blocks to their target

(in the last case there is a delay on how often this can be done).

The function generates an X, Y and Z coordinate and places the enderman to that location. The function calls rand.nextDouble() or rand.nextInt(64) to generate a value within ±32 of the original value for each of X,Y and Z. It then calls another function a teleportTo() using these values

(Alternatively if they are fighting and further away from their target, there is a teleport to entity function.)

Therefore, an enderman, without being aggressive, can teleport anywhere within a cube of 64 blocks of itself (subject to having a floor, head room and not ending up in a liquid).

So, to answer the question, no pathing is considered, this teleportation is based on moving directly to a random location.

TL;DR If the room is within 32 blocks of a liquid or daylight and the ceiling is atleast 3 blocks high, an enderman "could" get in randomly without you having any previous contact with it.