What is a Village?
A NPC village is a set of one or more houses. For this tutorial, the following properties of villages are important:
- Village Center: The center is at the average coordinate of all houses.
- Village Radius: The (euclidean) distance from the village center to the house farthest away from it. It is at least 32 blocks, however.
- Village Boundaries: Now that we have a center and a radius this should be obvious. Imagine a sphere around the village center.
You can see these values ingame by using Village Info . I highly recommend using it if you’re trying out new design, or if you just want to understand what’s going on with your village.
What is a House?
In Minecraft, a house is a wooden door which meets a certain condition: there must be a clear inside and outside. To determine the inside and outside, Minecraft compares the 5 blocks behind the door to the 5 blocks in front of it (all inline with the door). If there are more roofs or roofed blocks on one side, this side will be the inside. If both sides have the same amount of roofs or roofed blocks, the door won’t be considered a house at all.
A block can be a roof if the block itself is not fully transparent. A roofed block has a non-transparent block anywhere above it (along the Y-axis). Non-transparent blocks are blocks which diminish sunlight when it passes through or completely stop it. For example, opaque blocks (like stone and dirt) completely prevent light from passing through, while water reduces the light level by 3. Stairs and single slabs prevent light propagation as well. So these blocks can be used to create a roof.
Apparently, the direction the door is facing also plays a role here. Whenever you place a door, you’re looking at the front of it, i.e., the direction you’re facing is the one that matters. Blocks on the other sides, and blocks farther away than 5 blocks have no impact at all. Only the 10 blocks inline with the door (and everything above them) matter.
Note that there are no roof blocks above (off-screen). I put the torches there to make counting easier for you. They have no impact because they are not inline with the door.
As you know, doors consist of two blocks vertically. Both blocks are checked individually. If either level passes the house check, the door is considered a house.
Adding Houses To Villages
Every few seconds, Minecraft scans the area around villagers for houses. The area it scans is a cuboid with width and length = 33 blocks and height = 9 blocks, the villager being in the center. This means that in order to add a house, a villager needs to be within 16 blocks of the door in both horizontal axes (x and z), and within 4 blocks vertically (y).
Houses are always scanned from bottom to top, so if the lower and upper level checks would lead to different insides and outsides, the lower level counts. There is one exception though: if the villager is exactly five blocks above the door when the door is scanned for the first time, the lower level won’t be checked at all.
On the top level, there are no roofs or roofed blocks on the left side, but one on the right side, so the inside should be on the right. However, on the bottom level, there are two roofs on the left, so in most cases, the inside is on the left.
When a door passes the check, it will be added to an existing village if the distance to the village center is at most 32 + |Village Radius| blocks (in other words, if the door is at most 32 blocks away from the village boundaries). If there is none, a new village will be created for the house. That’s why all houses in the screenshots up until now are technically villages, too.
Refreshing and Removing Houses
Once a house is added to a village, a villager has to stay nearby to “refresh” it (range is the same as for adding houses: up to 16 blocks for both horizontal axes, and up to 4 blocks vertically). Otherwise, the house will be detached from the village after about 1 minute. If there are no other houses in the village, the village will be removed from the game as well.
When refreshing a house, it doesn’t matter if the house check fails. So when trying out house setups, make sure to destroy the door block after every change to force the game to check the door again. Since Minecraft 1.4, village data is stored in the savegame, meaning houses will not be rechecked after a restart. Walking out of range to unload their chunks will still reset them though. There is one exception: villages in the spawn area will not be reset this way because the area will always be loaded.
Although villagers wander around randomly, they usually stay within the village boundaries. They are also able to locate villages whose boundaries are up to 32 blocks away, and will try to reach them quickly.
During night time or downfall, villagers try to find shelter. Usually, they pick the least occupied house within 16 blocks. If there is none, they pick the closest house. However, many players are observing that villagers are clumping up in one single house. I think this happens because they usually start looking for shelter at about the same time, before any houses are occupied. In this case, they’d pick the house that was first attached to a village (which is random after restart).
After picking a house, they try to reach the position two blocks behind the door (inside the house). They will also move to a different house every now and then, but only if there is an exit that doesn’t involve opening a door (they aren’t able to do so at this point).
When two villagers are close to each other, there is a chance that they start mating and give birth to a baby villager. They can only breed if they are inside a village and if the population is below 0.35 * |Amount of Houses| (population limit), i.e., you need roughly three houses per villager.
When villagers are killed by mobs, or by a damage source that isn’t related to entites (e.g. lava, drowning) while a player is nearby, the whole village won’t breed for 3 minutes.
For breeding, a villager is considered inside the village if he is inside its boundaries. But to count villagers, Minecraft uses a cuboid with width and length = 2 * |Village Radius| and height = 8 blocks.
Iron Golem Spawning
Golems can spawn inside a village if there are at least 21 houses. Additionally, 10 villagers (used to be 16 before 1.4) are required for each golem (i.e., 10 villagers for 1 golem, 20 for 2, 30 for 3, …). Keep in mind that you need at least 29 houses to raise the villager limit to 10 naturally. Golems are counted the same way villagers are (see above), so they may easily be moved out of the zone vertically.
If all conditions are met, the game attempts to spawn a golem every 7000 game ticks on average (= 350 seconds), at which point it randomly chooses up to 10 blocks inside the spawning zone until it finds a valid spawning position. For a position to be valid, the block below must be solid (or stairs or a slab if placed so that the top side is solid), and there mustn’t be a solid block in a 2×2, 4 high space, with the spawning position being at the upper x and z coordinate and at the lowest y coordinate. Liquids and other mobs don’t stop them from spawning.
The spawning area of golems is a cuboid with width and length = 16 and height = 6 blocks. The village center is roughly in the center of the cuboid, but slightly offset, since the numbers are even. Because golems need a solid block to spawn on, and 4 blocks vertical space without any solid blocks, you can only have a maximum of two spawning floors. However, since Minecraft chooses up to 10 blocks each time, this should be enough to get a golem spawn almost every attempt (350s on average). Note that there is no way to increase the spawn rate of a single village any further.
Every night at gametime = 18000 (when the moon is at its zenith), there is a chance of up to 10% that a zombie siege occurs. However, they can only happen if a player is inside the village, and if the village has at least 10 houses and 20 villagers. During a siege, up to 20 zombies will spawn around a random block inside the village (close to the height level of the village center).
The zombies will even spawn if the area is lit up. They can only spawn on top of solid blocks, but they can’t spawn inside liquids (one block above the ground) or directly below solid blocks (two blocks above the ground). Since these are the only conditions, there’s no practical way to prevent them from spawning that I know of. If you don’t want any sieges to happen, I suggest you stay out of the village during night.
The glass pillar allows the underground doors to be recognized as houses (top level only). The villagers are barely in range to trigger the house check, and thus create the village and keep it intact. The village has three houses, which is just enough to set the cap to one villager. However, the villagers are too far above the village center to be counted towards the limit.
This way, the villagers will keep breeding, while the population stays at zero and the limit at one. You can also fence the villagers in, and you can replace the glass or leave air there.
Be aware that if you leave them like this for too long, your game will crash and your savegame may become unplayable.
Obviously, you can transport villagers with minecarts. A much cheaper way to do so is to lure them with houses. During night time, they will walk to the closest house. Since they can sense villages within a range of 32 blocks, they should be walking towards the house as long as they are within 64 blocks of it.
If you’re starting at a village, first destroy all wooden doors except one. During night time, the villagers should gather at that house. Next, place another “house” (using one opaque block and one wooden door) within a distance of up to 16 blocks horizontally and up to 4 blocks vertically. This way, a villager is close enough to add it to the village. Now destroy the other wooden door, and the villagers will all walk to the new one. Go on with the next house and repeat. You can increase the horizontal distance, as long as a villager is nearby. Keeping the vertical distance can be tedious, especially in hilly biomes (avoid them if possible).
Unless you’re playing on peaceful, spawning mobs (especially zombies) can be a pain as well. You could do this during the day. However, the villagers will only stay within a range of 32 blocks, making it easier for them to get lost by getting 64 blocks away from the house. You can always breed some new villagers by using a breeding station on the way as described above (as long as there are at least 2 villagers remaining).
To build a house underground, you have to make sure that there is a column made of transparent blocks, so that the door will pass the test. For your village, you can simply dig 1×1 holes (all the way to your village), one for each house. You can also cover them with glass, chests, or any other transparent block.
ncreasing the Population
When extending a village with real house structures, you may notice the number of villagers being very low. As mentioned before, roughly three houses are required for one villager. You probably want more than that. You could either add more doors to your structures, or you could build some hidden houses (e.g., underground). When building them underground, you should make sure to choose a high spot, so that you don’t lower the village center by too much. For each 1×1 hole, you can build up to 10 houses on one layer (about 3 more villagers).