Tutorials/Villager farming

This guide seeks to teach the player how to “farm” villagers. The method of farming is similar to other animal farms. However, villager breeders are significantly more difficult to construct.

Purpose
Farming villagers can be beneficial for a host of reasons. If the player has a villager trading hall, then the player will need to fill it with villagers and replace the ones that the player discards. It is difficult to do this through kidnapping villagers alone, so having an artificial breeder can be very helpful.

Another use is for an iron golem farm as they will only work with a certain number of villagers (10 per golem). For example, if the player wanted to be able to store ten golems in the same village at the same time, the player will need 100 villagers. That is a lot of villagers, and it is only possible in the practical sense if the player builds a villager breeder beforehand.

Mechanics
Unlike for other breedable mobs, Villager breeding cannot be forced, but the player can provide for ideal accommodations to make the process efficient. The decision for a villager to show heart particles depends on how “willing” a villager is to mate. If two villagers nearby are willing at the same time, they will spawn a baby villager in between them. Willingness depends on the food that the player feeds the parents. Below is a table that tells the player approximately how much food they must give to a villager before they are willing.

Willingness can be increased if the player trades with the villagers. Also, a farmer villager will throw excess food to other villagers. So, if the farmer has free access to crops, and they are within range of a village, then that village will be able to support mating.

There are more parameters to willingness. Villagers take a census of the population of their village about every minute. They will only become willing if the population is at or lower than 35% of valid village doors, rounded down. So, if there are 21 village doors, enough to start spontaneously spawning iron golems, the villagers will continually mate until there are about 7 villagers. The population is counted based on whether the villagers are within 5 blocks of a door, in spherical distance. An infinite villager breeder can consist of half a dozen doors that are more than 5 blocks away from the breeding villagers, with a villager nearby to register the doors to a village. By placing the doors farther than 5 blocks away from the breeder, the villagers will think there is only the one detector villager in a 6-door village. Using the 35% rule shows that the villagers will try to mate until there are 2 villagers in that village. No other villagers can get in range of the doors, however, so mating will occur continuously and endlessly.

Setting Up
The area around a villager breeder must be carefully scoured to ensure the breeder works correctly. The village must be small, so the player must ensure that no other villages exist within an 80-block spherical radius. No matter what the player builds,they will need at least three villagers to initiate the process. Their roles are:
 * 1) Farmer - collect food from nearby crops to feed the breeder villagers, can be any brown-coated villager
 * 2) Breeder - collects food from the farmer and they both do the breeding work
 * 3) Detector - registers the nearby doors to a village so that breeding can occur

In some cases, the farmer will be too busy collecting crops. It may take far longer to get baby villagers, so having a second breeder villager can be useful.