Minecraft villagers are jumping from a height

I built this building. The idea was that a librarian would live upstairs. But there is a problem: he just jumps off the building. How to fix it? enter image description here enter image description here


Solution 1:

In MineCraft, most mobs will refuse to drop down if the bottom is 4 blocks or lower down (the minimum requirement to fall damage with mobs), however they would happily drop down from three blocks, so make sure that there's not extra blocks or slabs sticking out just enough for the villager to willingly drop down.

However, a gate between the enchanting table room and the exit would be an easy way to make sure your villager stays safe from dropping and fall damage.