The bug
Villagers in a house whose center is at x = -1 look for nearby villages every time their EntityAIMoveIndoors tests if it should execute and try to move to the center of the closest house (in which they are already).
How to reproduce (vanilla)
- Place a block at x = -1
- Build a "house" as shown in House setup (17w06a).png around the block
- Build a second house whose center block is not at x = -1 next to it
- Place on both center blocks a shulker or any other entity which has a collision box
- Set the time to night and spawn some villagers
/time set 16000
→ You should see that the villagers in the house at x = -1 continuously jump around the shulker, even if they have been in the house for some time, whereas the villagers in the house which is not at x = -1 only jump around the shulker for some time after entering the house but stop then and don't start again.
Note: You might see villagers jumping in the house which is not at x = -1. This happens probably because the villagers want to randomly move on top of the block in the center. This should happen less frequent than the villagers jumping in the house at x = -1.
How to reproduce (with MCP)
- In MCP set a breakpoint for the method net.minecraft.entity.ai.EntityAIMoveIndoors.shouldExecute() at the moment it calls the method net.minecraft.village.VillageCollection.getNearestVillage(BlockPos, int)
- Place a block at x = -1
- Place a wooden door two blocks in front of the block
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the class net.minecraft.entity.ai.EntityAIMoveIndoors uses the value -1 to indicate that no house was found. This is in conflict with houses at the position x = -1.