Village

"Villages are some of the most bustling, lively places in Minecraft outside of the player’s own constructions. They’re populated by sort-of-friendly folk involved in various useful pursuits: farmers, fisherman, fletchers, butchers, clerics, armorers and more. Including my favourite: the nitwit."

- Marsh Davies

Villages are groups of buildings inhabited by villagers, cats, iron golems and zombie villagers, that generate naturally in the Overworld.

Generation
Villages generate naturally in Plains, Savanna, Taiga, and Desert biomes. In Bedrock Edition and Legacy Console Edition, villages may also generate in Snowy Tundra and Snowy Taiga biomes. About 10-20 villagers can spawn in the villages depending on the number of those villages. The type of the village, and therefore the style of all structures within it, is determined by the biome at the northwest corner of the village well (defaulting to Plains if it's not one of the other biomes).

2% of villages will generate as zombie villages; see.

Raids and Patrols
An Illager Patrol will spawn within a certain distance of a village. Upon the vicinity, the Illagers in the patrol will invade and attack the village. Once the patrol leader is killed, the Bad Omen effect is applied and if in a village boundary, the raid will activate and groups of Illagers will spawn.

Number and frequency of structures
The number of buildings comprising a village can vary, and not every village is composed of all buildings at once. Apart from the well, which is unique and systematic, the number of buildings of each type is randomly generated, and increased in superflat worlds. Structures are picked from a weighted probability list (libraries are more common than butcher shops). The number of lamp posts has no restriction, as they are generated where no other buildings can be placed. Paths are found between the buildings of the village and often extend beyond them.

Paths


Village paths generate at the level of existing terrain, potentially going up steep hills or down ravines without regard for whether an entity could actually traverse the path. Paths do not go below sea level and will only replace grass blocks (with air above), water, lava, sand, sandstone, and red sandstone; all other blocks are ignored and the blocks underneath are considered for replacement instead.

Village paths generate as grass paths where they replace grass, planks where they replace water or lava, and gravel over cobblestone where they replace sand, sandstone, and red sandstone. They are subject to the block substitutions described below, i.e. in desert villages they generate as sandstone with smooth sandstone bridges over water instead of cobblestone-and-gravel with plank bridges. In Buffet worlds with cave generation, paths may generate on a separate layer from the rest of the buildings. In floating island generation, paths may not generate at all.

Block substitutions
Some blocks in the village structures vary depending on the village's type.

In Bedrock Edition and Legacy Console Edition, Snowy Taiga and Snowy Tundra villages use the Taiga substitution.

Zombie villages
A village has a 2% chance of generating as a zombie village. In such villages, all generated villagers are instead zombie villagers, and all doors and torches are missing. These zombie villagers will not despawn, but have no special resistance to sunlight. In Bedrock Edition and Legacy Console Edition, zombie villages include cobweb and moss stone.

Mechanics
A village is almost always composed of at least one acceptable house and one villager. In some rare cases, villages have generated with a well and nothing else (This appears to occur very frequently on console versions). Upon creation, a village center is defined as the geometric barycenter (i.e. centroid) of the active doors' locations, and the village's size is the greater of 32 blocks or the distance to the furthest door from the center. Any villager, village golem, or siege-spawned zombie will path back into the village if they find themselves farther than "size" blocks from the center.

As the villagers move around, the area near them (a 16x16 square centered at the northwest of the block the villager is standing plus a height of 8, starting at 2 blocks above their head and ending 4 blocks below their feet) is occasionally checked for new valid doors ("houses"). Thus, the random movement of villagers may also slowly change the center of the village they live in, even if no houses are actually changed. If a new valid door is found more than 66 blocks outside of any existing village's center, a new village is created; if a new valid door is found fewer blocks away than that, the door is added to an existing village and the center is recalculated.

The minimum population of a village is 0.35 times the number of valid doors (see Tutorials/Village mechanics). If the population drops below that point (due to death or kidnappings), but there are at least two villagers left who can reach each other, the villagers will mate and breed until the population is above the minimum. In the Bedrock Edition, the minimum population equals the number of doors (1:1 ratio).

Adult villagers can be traded with by pressing the button on them.

Popularity
A player's popularity starts at zero, and ranges between -30 and 10, and the following can alter a player's popularity: A player's popularity does not reset on death, and players cannot alter other players' popularity. Popularity changes only happen once, so if any player attacked a villager, then brought him to a different village, the player would get the -1 popularity in the first village, but not the second. Popularity is stored per village; a player may have a high popularity in one village and a very low one in another. When a player acts directly on a villager, particles around that villager will indicate the change in popularity. Conversely, because popularity is stored per village, if the entire village is destroyed, any accumulated popularity, positive or negative, is also eliminated.

If a player has -15 popularity or less, iron golems of that village will become aggressive to that player. If an iron golem is idle, it may become aggressive to the nearest player with -15 or lower popularity. However, "nearest" can be any distance at all, so if the village's chunks are loaded (perhaps by another player), the golems can turn hostile even after the unpopular player has traveled across the world. This does not apply to player-made golems.

If a villager dies to a non-mob, non-player source while a player is within 16 blocks, or if a monster kills a villager, then no villager in the village will mate for approximately 3 minutes.

Trivia

 * According to Jeb, originally they wanted a system for a village to expand in population if player improves it. But they found that it was computationally expensive to evaluate what constituted a house, so to make it simple, they decided that a door with an inside and outside counts as a house.
 * Farms in the villages avoid overhanging by filling in the area below them with dirt. When the farm overhangs a ravine, this can cause a very tall rectangular dirt structure.
 * Farms will generate a few blocks of open space above them if they happen to generate inside a hill. This can cause sand to float over farms in desert villages.
 * Occasionally, surface ravines will be generated through villages, causing missing pathways or even entire buildings sunken into the ravine. This also applies to cave entrances and other surface oddities.
 * In the Legacy Console Edition, in the TU19 tutorial world, the village behind the castle has a blacksmith, but there is only a Music Disc, not ordinary loot.
 * Villages are the structures that are most likely to be found with generation failures.
 * In rare cases, players can find very small villages containing only one house or even some with only beds or a well, which a player can consider a rare event, however it is a failed generation.
 * If a village is near a jungle biome, the houses that will generate there will be cut off.
 * In the upcoming Village and Pillage update, the village architecture will be overhauled corresponding to each biome.