How can I make minecraft villagers go to a specific place where I want them to be

I'm making a village and I don't want the villagers to go around entering my home or other people's, so how can I make them know where they live?


Solution 1:

The easiest way would be to put them all in mine carts, that way they simply can't wander at all. But you'd lose the feel of having a village.

As Keith M said, The villager AI isn't smart, they will wander around and open/shut wooden doors constantly, and at dusk they will try to find any nearby house to stay in. There's no way to assign specific houses to specific villagers, it's a free-for-all. That said, you can put barriers in place, say cobblestone walls for example, that make just one house available to a villager inside his area.

As for your house, there are many possibilities:

  • Use an iron door with a button to get in. A fence gate would also work, anything the villagers don't understand how to use and won't randomly trigger, like a pressure plate.
  • Wall off your entrance with walls or fences in the same way I mentioned above. Placing carpet on a wall or fence will allow you to jump over it, but no mobs or villagers will be able to.
  • Build your house just outside the village instead of in it. This is what I typically do when I live by one since it also gives you room to grow without running into parts of the village.
  • Make a fun way into your house that villagers can't use, like a slime block + piston launcher. Or a drop onto a slime block that lets you jump over some obstacle. This is a great problem to have fun with and be creative!

Solution 2:

Easy answer, you can't. The game doesn't provide anything like that, the villagers are just random AI.

Solution 3:

You can, by using the command:

/summon minecraft:villager ~ ~ ~ {NoAI:1}

This prevents the villager from walking and looking around. Maybe this is not what you want but I use it in maps very often