Village mechanics

If you're trying to spawn golems for an iron ingot farm, or just want a few more noses to trade with in your local villager township, then you've come to the right place.

Terminology
A village is defined by several factors: the village gathering sites, radius, number of job sites, number of houses, population (number of villagers), population cap (max. number of villagers, based on housing), cat population, iron golems.

House A village needs at least one house and at least one villager in order to be a "village". A "house" is defined simply as a beds. A village tries to maintain its population above 35% (100% in Bedrock Edition) of the number of houses if there are at least two villagers.

Gathering Site The village gathering site is the center point of village (even when not located in the middle the of village), its defined by claimed bells near claimed beds. When bell is claimed, its indicated by green particle appear on top of bell. Once bell is claimed, its registered as gathering site. The use of gathering site is to make villager gather arround during their mingle behavior. If player is in village, wandering trader will spawn in gathering site. also iron golem spawn near gathering sites, which occur when villager gossiping during mingle behavior.

The bell must within village boundary to be considered as centerpiece of the village, so it need at least 1 villager and 1 beds, if only a villager and a bell without beds, villager won't gather around during mingle schedule, but will search for unclaimed beds.

During raid, in Java Edition villager will go to gathering sites for rang the bell to warn other villagers, while in Bedrock Edition the bell in gathering sites rang automatically.

If the village is big enough, adding extra bell in different location, but still near claimed beds will also turn area in newly placed bell into new gathering site, some villager even decide to split their crowd into two different cluster, one in first gathering site while others in new gathering site, then each villager will remember their gathering site and will try to pathfind toward it during mingle behavior, (villager who claim new gathering site will move toward it even when first gathering sites much closer than new gathering sites)

radius The village radius is the distance from this center point to the furthest bed, or 32 blocks, whichever is greater. This means that the radius is always at least 32, no matter what, but it can be bigger if there are any houses further than 32 blocks from the center. The center point coordinates are truncated, resulting in a tendency towards 0,0.

Symmetrical villages are easy to calculate the centers of, but for more complex villages, such as naturally generated villages, it's a good idea to give yourself a few blocks extra room. Try calculating from the position of the bed closest to your build site. The easiest way is to take the average of all coordinates of the beds in the village:

(x.coordinate_door1 + x.coordinate_door2 + x.coordinate_door3 + ...)/ number-of-doors = x.coordinate_village-center

(y.coordinate_door1 + y.coordinate_door2 + y.coordinate_door3 + ...)/ number-of-doors = y.coordinate_village-center

Housing
A "house" is defined as a claimed bed. Claimed bed is a bed with at least one villager, however if the bed is obstructed by solid block, villager will hardly to pathfind the beds which can cause them to fail claiming beds by showing angry particle over villager head and on top of the beds(losing ownership of the bed, but villager will try to re-claim it), when they successfully to sleep in obstructed bed, villager will suffocated potentially killing the villager and causing the bed no longer registered as village, due bed owner died make bed become unclaimed.( need at least one villager and one bed to be considered as village )

Once Villager has claim a bed, the claimed bed will be registered as house in village and villager will remember exact position of claimed bed, even when underground. During night villager will come back to their house (bed), however if villager cannot reach bed then villager can potentially lose ownership of bed and other villager can claim that beds which casue previous bed owner to forget their house location, but still seek for beds.

<!-- outdated section Example - The door is placed on the wooden planks. The game checks the spaces represented by the light blue wool, to see if they are covered by a "roof" block or not:



The simplest house looks something like this. Just a wooden door, with a dirt block on the ground next to it:



Not much to look at, is it? But it fits the criteria. The dirt blocks the light from reaching the space below it, and so counts as a roof block. There is one "inside" space, covered by a roof block, on the right side of the image (represented by the red wool below) and zero on the left. Since one is more than zero, there are more covered spaces on one side of the door than there are on the other, and so the game counts this as a house:



The following are all examples of houses as well:









It doesn't matter what you build, except for what's directly above the colored wool. Anything to the sides of this can be whatever you want, or nothing at all:



A door is two blocks tall, and this check is performed twice per door, if necessary. If the initial "roof check" (see Fig. 1) fails, then the bottom-most layer is ignored and the check is performed a second time, starting one layer higher. This time, only the spaces above the lime-green wool are checked for roof blocks:



Example - For the door pictured below, the initial roof check finds there are two spaces covered by roof blocks on the left side, and two covered spaces on the right also. With the same number of covered spaces on each side, neither one can be designated the "inside" or the "outside," and so the door is not counted as a house... yet, but we're not through yet, either:



Then since the initial check failed, the bottom layer is ignored, and we perform the test again, this time checking for roof blocks only above (not level with) the green wool. This time, only the two spaces on the left-hand side of the image are covered. Since the "roof check" passed on this second try, the door counts as a house, and its "inside" is on the left where the more covered spaces are:



In the next example, the door passes the test on the initial first check. It has one covered space on the left side and two on the right. This makes it a house with the "inside" to the right. The second check would pass as well (with the "inside" on the left this time), but since the first one already passed, we don't even bother testing again. This door counts as a house, with the "inside" on the right:



The covered spaces don't have to be contiguous. The door below is a house, with the "inside" on the right, which has three covered spaces within the 5-space limit, while the left side has only two:



This next door has three covered spaces on each side, and is not a house:



A house is initiated by a nearby villager. Without a villager nearby, it is not considered a "house," just some blocks and a door:



But as soon as that villager shows up, it becomes a house (and a village):



Villagers will recognize a house within sixteen blocks along both horizontal axes, and up to three blocks above or five blocks below the level of the ground the villager is standing on:



-->

Job Site Naturally spawned villagers start as unemployed, but can also spawn as nitwit. They will change their profession by seeking for unclaimed workplace block.

Naturally generating villages consist of 2 main buildings, the first building is house which is building with beds. The second is job sites building, building with workplace block. In job sites building, no villager will spawn, that mean if naturally village only consist of jobsites building, no villager will spawn making it not registered as village.

Most of villagers will spend their time to work with workstation which begin at morning, with exception is nitwit and baby villagers. Just like claimed bed, once villager workplace block, then villager will remember its position. They work at morning and at afternoon after they gather around.

This can be done be building 2 house. Then spawn first villager in first house and place bed in that house, first villager will remember this building as house. Place smoker (workplace block) in second house, first villager will claim and remember second house as job sites. Then spawn second villager and place bed in second house. Second villager will remember that building as house. Then place another smoker in first house. Second villager will remember first house as job sites. During day, first villager will go to second house to work while second villager will go to first house to work. At night first villager will sleep in first house, while second villager will sleep in second.

From described above, villager will remember position of claimed workplace block and try to pathfind to work in that claimed workplace altough there also same corresponding workplace block which much closer to their position.

Overlapping boundaries
Main article: Tutorials/Village_chaining

Transporting villagers
There are several ways to transport villagers, some quite tedious.

Minecart technique
The first and most well known technique is the minecart technique, where you build a minecart track from the village to the end destination, and push the villagers one by one into a cart and push the cart to the destination.

Water tunnel technique
The second is more tedious but requires less resources, known as the water tunnel technique. Create a tunnel from one location to another, with no exits along the way (2×2, for example), then grab two buckets of water. Use water to push them down the path a few blocks, then use the second bucket to push them further, grab the first water, and repeat.

With the revisions to the water mechanics introduced in update aquatic, this is an effective technique: Place a water source block, followed by several empty blocks at the same level for the water to drain through, then place an ice block under the last waster flow block, then finish by capping it off with a pressure plate or a sign. Repeat the process until you reach your intended destination. (This works best when buried deep underground and while well lit to keep mobs from killing your villagers in transit. Otherwise, you need to build a cover over the area you're using to keep them safe.) Then, if you need to move them upwards, create an upwards bubble column elevator and lift the villagers to the proper location.

Boat technique
A third technique is to transport villagers using a boat. Since Java Edition 1.9, mobs may enter boats, and players can enter the same boat and operate it while the mob sits in the back. This allows players to transport villagers over water, but also over land because as of Java Edition 1.9.4 boats can be sailed on land (albeit very slowly). To move the boat upwards you have to create a bubble column.

Using fake houses
Using the gathered information above in this wiki, there is an easier way to transport villagers, rather than pushing them in a minecart, boat or using the water tunnel. Firstly find a village, and destroy all beds except one to gather the villagers there. Then you can move the villagers by creating fake houses. As long as these meet the house requirements, the villagers will 'follow' the beds. The easiest way to do this is to place a bed with 2 blocks stacked up behind it, removing the old bed so that the villagers will follow and continuing the process again and again.

Using Nether portals
A final and potentially least tedious method of transporting villagers is the "Nether Portal Method". Most entities can travel through nether portals. Keep in mind that this strategy only works if no Nether portals have yet been constructed in the Nether (see here for more details). Create a portal in the location where you want the Villagers to be, i.e. close to your house. Then travel to the nearest Village (it must be within 1024 distance of the first portal) and build another portal there. You can either use a minecart or manually push the Villagers into the portal, transporting them to the Nether, but keep in mind that Villagers cannot be pushed up blocks. Thus it would be ideal to build the portal so that the bottom blocks are level to the ground. Enter the portal and push the villagers out of the portal in the Nether, then wait about 30 seconds. After the villagers undergo "cooldown", they can be pushed back through the portal and should exit from the first portal that you constructed.

A few notes with this strategy. Once the villager has been transported through the portal, it is essentially impossible to return them to their village (but why would you want to do that, right?). However, while wandering they may accidentally reenter the portal, so it is a good idea to block off the portal by surrounding it with a fence.

Breeding and population cap
Villagers breed without player intervention, but there must be at least two adult villagers who can reach each other. If you are starting a village from scratch, or recovering from zombie villagers and there are no villagers left (or only one), then you need to acquire more. The only ways to do that are:
 * Hauling them in from another village or from igloo basement(altough much difficult)
 * They can be shipped by a boat, a minecart, or led through the night with a trail of fake houses.
 * Curing infected zombie villagers
 * Using cheat commands and/or creative mode spawn eggs

As of the Village and Pillage update, villagers will try to keep the village population at approximately the amount of beds in the village. For each bed, one more villager can be made before the village reaches its population cap (population cap = # of beds).

Villagers will go into love mode (indicated by red heart particles above both their heads), if they have enough food to make themselves and their partner willing. They will enter love mode based on their amount of food, not the population cap. Instead, if the population cap is already met, the villagers will also have angry particles above their heads (along with the heart particles), preventing them from mating. Much like with farm animals, when two villagers are feeling "romantic" and can see each other, they will pathfind towards the other and stare for a few seconds, after which a third, smaller ("baby") villager will spawn next to them. Breeding villagers does not drop experience. This new villager will take on clothing dependent on the biome the village is in. It will not acquire a job until it has grown up and there is a valid, unclaimed job site.

Because popularity is stored per village, if the entire village is destroyed, any accumulated popularity, positive or negative, is also eliminated. This may be useful in synthetic village designs, such as when only one villager is kept in range of beds to maintain the existence of the village but is moved out of range in order to destroy the village, such as to stop infinite villager breeding.

Willingness
Villagers must be "willing" in order to breed. After mating, they will no longer be willing and must be traded with again before becoming willing again.

Villagers can become willing by the player trading with them. Willingness is granted the first time a new offer is traded, or at a one-in-five chance on subsequent trades. This will not cause them to immediately seek out a mate, however.

Villagers can also become willing by having either 3 bread, 12 carrots 12 potatoes, or 12 beetroots in their inventory. Farmer villagers will throw harvested crops at villagers, allowing them to pick them up to obtain enough food to become willing.

Curing zombie villagers
There are two ways to cure an infected zombie villager. The first method requires you to travel to the nether and collect at least two blaze rods, to craft a brewing stand, and then to turn the blaze rods into blaze powder to operate the brewing stand (as of JE 1.9). Then you need to brew a splash potion of weakness, and craft a golden apple (the "ordinary" one, that takes ingots to craft). When you find a zombie villager, toss the potion of weakness at it, and then right-click it with the golden apple. The zombie will begin shaking for up to 5 minutes, then it will turn into a villager of the corresponding profession and a random career.

There is another way, for Nether disabled servers, to give the zombie villager in question a potion of weakness, without having a brewing stand. You will need to get a witch and a zombie villager in the same proximity in order to do so. Witches sometimes throw a Splash Potion of Weakness (if a player is within 3 blocks), which you can use to your advantage, with a little work. This method is similar to getting a Skeleton to kill a Creeper, and as such tutorials on that should be followed in order to achieve the process. You will, however, need to have a golden apple ready this way too.

After you've used the splash potion of weakness and the golden apple, the zombie will make a loud sizzling sound, emit orange swirly particles, and begin to shake violently. It takes a couple of minutes for them to convert, so go ahead and trap them somewhere, and make sure they won't burn in the sunlight, or hurt any nearby villagers. After a few minutes, they will turn into a regular villager, at which point you can let them out to roam the village or do whatever.

Finding zombie villagers in the first place shouldn't be all that difficult. About every 20th zombie is a villager zombie, so it shouldn't take you too long to find two of them you can cure back into villagers and get the population booming by more..."natural" means. Additionally, when a villager is attacked by a zombie (any zombie) there is a chance (50% on normal difficulty, and 100% on hard) that they will turn into a villager zombie instead of just being killed. There are also baby villager zombies, which are harder to trap, but can also be cured.

Zombie villagers are a great way to start an artificial village, because unlike villagers, zombie villagers will follow the player long distances. Then when they arrive at the desired location they can be cured.

Cats
Number of cats spawned in village based on number of bed in village. Only require at least one villager and one cat spawn every four beds, beds don't need to be claimed. However number of cats are capped at 10 per village. Up to 40 beds for 10 cats, and cat will respawn based number of beds.

If two village with each village already have 10 cats, merging village into single village not cause cat despawn, but still capped at 10, so if number cat despawned or died, new cat will not spawn even though the village previously has more than 10 cat.

Iron golems
Iron golem always spawn at meeting point in naturally generating villages. However iron golem can also spawn from villager who gossiping during mingle near gathering sites.

Zombie sieges
At night, there is a chance that a zombie siege might occur. This is when a large number of zombies spawn in or near a village, attacking what villagers they can reach, crowding around and pounding on the doors of those they can't. On hard or hardcore mode, they can actually break down the wooden doors (this is true of all zombies, not just during sieges.) A zombie siege requires a village of at least 10 houses and at least 20 villagers.

Zombies in sieges ignore light levels and the 24-block minimum distance from the player, but other than that, behave absolutely normal (i.e., they will not spawn on glowstone or any other transparent or half block, need a 2×1×1 minimum space, etc.). They can also spawn INSIDE doors, making Iron Golem farms difficult to build on hard, as zombies beat down doors on hard (they'll attempt to beat them down on other difficulties, but not succeed). However, zombies won't spawn 128 blocks away from you, even though the siege is technically happening in the game code, so you're safe if you build it high up. You can make houses virtually zombie-proof simply by taking out one ground block from directly in front of the door, and, if necessary, rehanging the door such that the outside is "smooth," i.e. the door's position on its ground block runs consistent with the outside wall. This is because zombies can only break the top half of a door, and if they have to jump, they will never get through.

Raids
When player with bad omen entering entering village, raid will occur, raids are group of illager attacking village, try to kill villagers. You can cancel bad omen effect by drinking milk before entering village to prevent raids, but you can also defend village from raids and villager will give you reward upon successfully completing raids.