Endermen can teleport through any type of block if there is ample space on the other side.
What you could do is cover the ground outside with blocks they can not teleport on top of .
As far as my understanding goes, the only blocks they can't teleport to are water lava and transparent blocks.
( Source ).
Alternativly place cobweb on its legs which will completely disable it
plus you can do the same with other mobs.
Always remember to name them to stop them despawning.
gaming.stackexchange.com/users/17870/Hex
Endermen can only pick up the following blocks source Grass Block Dirt Mycelium Sand Gravel Clay Dandelion Rose Brown Mushroom Red Mushroom Cactus Pumpkin Melon TNT As long as you make zoo out of something else (like cobblestone, fences, wood etc...)
the Endermen should not be able to break your zoo.
Note
however the Endermen have the ability to teleport
- this is probably why they are escaping.
To my knowledge the Endermen will teleport to any available space, regardless of what blocks are between those two points.
The only way I can think of to prevent the Endermen from teleporting would be to invalidate all of the potential teleport destinations within teleport range of the zoo, for example by getting rid of any 3-high spaces (Endermen are 3 blocks high and so can only teleport into 3 block high spaces)
Also the Endermen can despawn , and so could also "escape" that way.
gaming.stackexchange.com/users/2862/Justin
You can just put a sign in the cage, that says "escaped Enderman on the loose, watch out".
Maybe add some humour to the whole thing.
I can near guarantee, if there is another cage around the Enderman, he will teleport to it.
Enderman are not meant to be contained, be warned!
gaming.stackexchange.com/users/38986/nick
You can make everythinbg BUT the cage that the endermen is in only 2½ blocks tall, by putting slabs on the roof.
Put water on the roof too.
gaming.stackexchange.com/users/41824/TheOnlyNiceTroll
Just dig down deep into the ground.
Have ladders on the hole going down.
Endermen have a teleporting range of 32 blocks.
Make every part of the tunnle 2 blocks high, for the enderman can't teleport to any place that is less then 3 blocks high (as in tunnel size).
Make sure the cage is 3 blocks for the enderman to wander around.
And don't let any other cage exceed the 2 block high opening.
gaming.stackexchange.com/users/42067/Thomas I think
I'm trying to build a mob zoo but the Enderman keeps escaping. Is there any way I can keep it in? Are there blocks they can't teleport through?
Are there any blocks Endermen can't teleport through?
gaming.stackexchange.com
<minecraft-java-edition>
gaming.stackexchange.com/questions/86377
gaming.stackexchange.com/users/33801/Jesse
The Endermen will teleport to any available space within a range of 32 blocks. Endermen can teleport anywhere.
It is stated that Endermen teleportation can't be blocked in a specific range of blocks.