Village mechanics

This page describes mechanics relating to villages and villagers.

Village definition
As used in this article, the term village means a "logical village", which is an area of a world where village mechanics governs villager behavior. This is in contrast to a "physical village", which is a set of buildings, crop fields, etc. created as part of world generation. Although the two kinds of villages most often coincide, this is not obligatory:
 * A physical village that has no villagers will have no village mechanics. Examples include abandoned villages, villages that were generated while game rule doMobSpawning is set to false, and villages where all the villagers have died or were taken somewhere else.
 * A logical village is most often generated when the chunks of a physical village are generated, but one can also be created where no physical village exists by placing certain kinds of blocks near a villager, or by moving or spawning a villager near such a block.

This article describes the behavior of villagers in a logical village, whether or not they are in a physical village. Some of the behaviors are performed individually, while a couple (namely, spawning of iron golems and cats) are collective; in effect they are behaviors of the village as a whole.

Java villages
Villages do not have a defined center or radius. Rather, a village is defined by proximity to a village subchunk.

Any subchunk (a 16-block-high section of a chunk) containing a claimed bed, bell, or job site block is considered to be a village center, and all 26 subchunks in a 3×3×3 cube around it are also considered part of the village, as used in raids and some pathfinding. Cats will spawn within the 5x5x5 cube around a village center, and patrols will not spawn when the player is in the same range.

Subchunks in a 17×17×17 cube from village subchunks define degrees of proximity to a village.

Mob AI uses these definitions in various cases. For example, when a villager is not in a village and needs to return to one, it sets out in the direction of increasing proximity. When an iron golem patrols the village, it frequently looks for a village subchunk within a 5×5×5 cube of itself to walk to.

Population of a village is never measured. Villager breeding succeeds if the birthing parent can path to an unclaimed bed with at least two empty blocks over its head. Iron golem spawning happens if enough villagers haven't seen a golem recently, when gathered near a bell or panicked by zombies. Cats spawn around players in or near villages if enough beds (and few enough cats) are nearby.

Gathering site
A gathering site is where villagers spend their mingling time during the day and can be anywhere in a village, even if it is not located in the center. It is defined by claimed bells. When a bell is claimed, green particles appear above the bell and the bell is registered as a gathering site.

During a raid, a villager goes to gathering sites and rings the bell to warn other villagers.

Adding a bell establishes a new potential gathering site, even if the village already has one. Villagers remember their specific gathering site and go to it during mingling time, even if another gathering site is closer. However, new or unregistered villagers may choose this new site.

If the player is within 48 blocks of a bell (claimed or not) when a wandering trader is being spawned, the trader spawns within 48 blocks of the bell rather than the player.

Bedrock village
A village is defined through several mechanics: the village gathering sites, village radius, number of job sites, number of houses, villager population, population cap (maximum number of villagers that can live in the village based on available housing), cat population, and Iron Golem population. Players can use these mechanics to build artificial villages.

House
A village needs at least one house and one villager to be considered a village. A house is defined as a bed. The game utilizes villager breeding to try to maintain a 100% population level, so long as there are at least two villagers occupying it.

Gathering site
A gathering site is where villagers spend their mingling time during the day and can be anywhere in a village, even if it is not located in the center. It is defined as a claimed bell. When a bell is claimed, green particles appear above the bell and the bell is registered as a gathering site. If a player is in the village, a wandering trader can spawn from a claimed bell.

The bell must be within the village boundary to be considered a centerpoint of the village, therefore it needs to be located near at least one villager and one bed. If villagers and a bell are present but without housing, the villagers search for unclaimed beds rather than mingle.

During a raid, the bell rings automatically.

Adding a bell at a location near claimed beds establishes a new gathering site, even if the village already has one. Each villager remembers their specific gathering site and goes there during mingling time, even if another gathering site is closer. However, new or unregistered villagers may choose this new location if it is closer.

Size
The village size is always geometrically defined as a rectangle. The borders are 32 blocks (two chunks) from the village center, or 32 blocks from any village point of interest (a point of interest is any bed, bell, or job site block). The village center is typically the northwest corner of the village bell or one of the claimed beds.

Housing
A "house" is defined as a claimed bed. If the bed is obstructed by a solid block, villagers cannot pathfind to it and therefore cannot claim the bed. This causes anger particles to emit from the villager's head and from on top of the bed. If a villager succeeds in sleeping in an obstructed bed, the villager suffocates and dies, leaving the bed unclaimed.

Once a villager has claimed a bed, that bed is registered as a house in the village. The villager remembers their bed location, even when underground. In the evening, villagers return to their beds. However, if a villager cannot reach their bed and then loses ownership of it, other villagers can claim it. In this case the previous bed owner forgets the bed location and searches for another unclaimed bed.

Job site
Naturally spawned villagers spawn either as unemployed or ($$) as a nitwit. The unemployed can then change their profession by seeking and claiming an unclaimed job site block.

Naturally generated villages consist of two main types of buildings: houses (any building with beds) and job sites (a building with job site blocks). No villagers spawn in job site buildings. Therefore if a naturally generated village consists of only job site buildings, no villagers can spawn and ($$) the structures are never registered as a village.

Employed villagers spend their time working at their job site block, starting in the morning. Unemployed villagers, nitwits, and baby villagers have no job site and do not work. Once a villager chooses a job site block, the villager remembers its location. They go to work in the morning, mingle at their gathering point, and return to work in the afternoon.

Breeding and population cap
Villagers can breed without player intervention, but there must be at least two adult villagers who can reach one another.

Villagers 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 enter love mode based on their amount of food and not the population cap, but can produce a baby only if they have their own beds plus an available bed for the baby, and the beds have two empty blocks above them (there needs to be room for the baby to jump on the bed). If the population cap is met, or the beds are obstructed, this prevents them from mating, and angry particles appear above their heads (along with the heart particles). Much like with farm animals, when two villagers are in love mode and can see each other, they go to each other and stare for a few seconds, after which a baby villager spawns next to them. Breeding villagers does not drop experience. The baby villager spawns wearing clothing dependent on the biome the village is in (with a small chance to inherit one of its parents' outfits, if different). It acquires a job after it has grown up and if there is a valid, unclaimed job site.

Willingness
Villagers must be willing in order to breed.

Villagers can become willing by having 12 food points, which are gained by consuming food in the villager's inventory. Bread provides 4 points, while carrots, potatoes, and beetroots each provide only 1. Farmer villagers occasionally throw harvested crops at villagers, allowing them to pick them up to obtain enough food to become willing.

Breeding consumes 12 food points.

Villagers do not accept food or farm food themselves if gamerule 'mobgriefing' is set to false. This makes villager breeding possible only with 'mobgriefing' set to true, because villagers cannot become fully willing without food.

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

Curing zombie villagers
5% of zombies are zombie villagers. Additionally, when a villager is attacked by any zombie they have a chance (50% on normal difficulty, and 100% on hard) of turning into a zombie villager instead of just being killed.

Players can cure Zombie Villagers by a golden apple on them while they are affected by weakness. Players can usually apply weakness by brewing potions. In Nether-disabled servers, a witch and a zombie villager, or weakness tipped arrows from a master fletcher are needed. Witches sometimes throw a splash potion of weakness if a player is within 3 meters, which players can use to their advantage.

After the player uses the splash potion of weakness and a golden apple, the zombie makes a loud sizzling sound, emits orange swirly particles, and shakes. During the conversion time (up to 5 minutes), they still behave as zombies, so they should be protected from sunlight and kept away from nearby villagers. After a few minutes, they turn into regular villagers.

A zombie villager who has been cured gives a permanent discount on trades to the curing player.

Popularity
A player's popularity starts at zero and ranges between −30 and 30. 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 is stored per village; a player's popularity may be high in one village and low in another. When a player acts directly on a villager, particles around that villager 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, the village's naturally-spawned iron golems act hostile to that player until the player's popularity is increased by trading. Golems constructed by the player, however, are always passive toward the player. Summoning golems, trading, and healing increase popularity.

Cats
$$, cats are spawned around players in or near villages. A random position is chosen near the player, and a cat is spawned if that position is within a 5×5×5 subchunk cube around a village center subchunk, and the position is within 48 blocks of at least 4 claimed beds and fewer than 5 cats are within a 97×17×97 box centered around the spawn position.

Cats spawned in this way may despawn if not tamed.

$$, the number of cats spawned in a village is based on the number of beds in that village. Cats require only one villager, and one cat can spawn for every four beds, claimed or not. Up to 40 beds can be present for a maximum of 10 cats, and cats respawn based on the number of beds.

If there are two villages, each already with 10 cats, merging the villages into a single village does not cause any cats to despawn. However, the number of cats is still capped at 10, so no new cats spawn until the number of cats is below 10.

The player can run cats out of the village, thus allowing for more cats to spawn.

Iron golems
$$, iron golems are spawned when villagers are talking. Their spawning requirements are:


 * 1) The villager must be gossiping with another villager or panicking
 * 2) The villager has not seen an iron golem recently
 * 3) The villager has slept in the past day
 * 4) 5 villagers (3 if panicking) within 10 blocks meet those requirements (other than #1)
 * 5) The random location chosen for the Iron Golem isn't air or liquid that blocks light.

Random location choosing is attempted 10 times within 16 blocks of the villager, and is attempted once from 6 blocks above the chosen x and z, to 6 blocks below it.

$$, iron golems are spawned in villages meeting these requirements:


 * 1) The village has at least 20 beds and at least 10 villagers within a 16×6×16 volume around the village center
 * 2) 75% of the villagers must have worked in the past day
 * 3) All of the villagers must be linked to a bed
 * 4) A player must be within 80 blocks of the village horizontally and within 44 blocks vertically

A spawn is attempted on average once every 35 seconds and an iron golem can spawn when the 2×4×2 volume above the spawn point contains only non-solid blocks and the spawn block is solid.

Zombie sieges
At midnight, there is a 10% 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). They'll attempt to beat them down on other difficulties, but not succeed.

Zombies in sieges ignore the 24-block minimum distance from the player, but other than that, behave absolutely normally (i.e., they do not spawn on glowstone or any other transparent or half block, need a 2×1×1 minimum space, etc.). Houses can be zombie-proofed by taking out one ground block from directly in front of the door, and if necessary, rehanging the door such that the outside is flush with the outside wall. This is because zombies can break only the top half of a door, and if they have to jump, they cannot get through. In addition, players can fill the hole with two layers of carpet to achieve the same effect as zombies cannot pathfind into the door.

Raids
When a player with the 'Bad Omen' debuff enters a village, the Bad Omen effect disappears and a raid occurs. Raids are groups of illagers (pillagers, vindicators, evokers, ravagers, and witches) attacking the village with the intent of killing villagers. They can remove the 'Bad Omen' debuff by drinking milk before entering a village to prevent raids; however, the player can also defend a village from a raid, at which point the player gains the 'Hero of the Village' buff. This causes villagers to give the player steep discounts during trading, as well as bestow various gifts upon the player.

村の仕組み Постройка домов для деревенских жителей 教程/村庄机制