Villager

A Villager (also called a Testificate from a temporary name tag in Beta 1.9pre1) is a passive NPC (Non-Player Character) that spawns and moves about in NPC Villages. They spawn around the villages and inside the buildings. They spawn at their respective buildings corresponding to the role they have.

Appearance
Their characteristic look is dominated by their large, bald heads, green eyes, unibrows, and large noses. Villagers' arms are implied to be jointed, with two parts each to create folded arms. The arms are tucked inside the sleeves, with the sleeves touching at the seam in the middle.

There are different types, distinguished by the color of their robes, which signify their role in the community. There are 6 unique skins for the villagers which are found in the .jar (previously named minecraft.jar in the old launcher) file, but the generic green robe villager is not used in the game on normal maps. Hood texture files are also present, but no mesh currently exists to display them.

Spawning
Villagers only spawn naturally in NPC Villages. They can also be spawned with spawn eggs in creative mode. They will never despawn even if the player wanders away from them. Unlike other mobs, they won't leave their village even without a barrier (such as a fence) preventing them from doing so.

Villagers can also spawn if the player uses a splash potion of weakness on a Zombie villager and feeds it a regular golden apple. It will then shake and turn into a villager after 2–5 minutes. This tactic can be useful to repopulate villages, to add more citizens, and to create a village if you can't find one.

Behavior


Villagers are mobs that randomly wander inside the area of a village making sounds, falling in love for others villagers and staring at what is around him. They have no attack, so they run from zombies to houses (they are able to use wooden doors) and craft iron golems to protect them. They also go to home at night or when it's raining (even in desert biomes, where doesn't rains).

Villagers will not willingly fall off high cliffs that would kill them, but may occasionally take fall damage. They will not stay away from fire or lava or change their behavior around fires. They will just carry on as usual, and rarely, but possibly, walk straight into the fire and cacti. They will not flee, run, or change their behavior when being damaged by fire or cacti.

There is evidence that villagers are prone to overcrowding certain areas of a village while leaving other areas completely empty. There is speculation that villagers will crowd predictably into set areas; however, exactly which areas has still not been discovered. The overcrowding can lead to villagers swarming into a few houses at night rather than spreading themselves. The sheer amount of villagers trying to enter such a small area can result in a portion of the villagers taking more time to enter the safety of their homes. In extreme cases, some villagers will become stranded outside. There is no known way to prevent this type of overcrowding. A portion of this behaviour is due to a bug. See issue MC-78 (below) for more details.

As of 1.8, villager farmers can actually farm crops by destroying them and replanting them. Note that they usually pick up what they farm so you must be quick to take the crops yourself. Butchers can also pick up wheat. They make bread to supply the other villagers. They can only harvest wheat, carrots, and potatoes for now. This can be used as an automated farm, with hopper minecarts under the farmland to pick up any crops the villager didn't pick up first.

Zombies
Zombies will find villagers from up to 31 block radius, and will attempt to break down doors if the difficulty is Hard. Villagers will run away from zombies, which can attack the villagers and the villager's only "natural" defense are the Iron Golems, which protect villagers from nearby mobs.

Zombies have a chance of turning a villager into a zombie villager if the difficulty is on Normal or Hard, or Hardcore gamemode.(Easy or Peaceful gamemode have 0% chance of villagers being infected. Normal is 50%, and Hard or Hardcore is 100%) This can also happen with baby villagers, resulting in Baby Villager Zombies or Baby Zombies. Using a Golden Apple and weakness potion it's possible to turn them back.

Mating and population


Villagers will mate depending on the number of valid doors. A valid door is any door (within the city radius) where the number of "outside" spaces within 5 blocks (in a straight line) on one side of the door is not the same as the number of "outside" spaces within 5 blocks on the other side of the door. A space is considered to be "outside" if it is hit by the sun during the day, i.e. it is transparent, and has nothing but transparent blocks above it all the way to the sky. (This means that starting a village deep underground, such as in a cavern or buried ravine, is not feasible.) Notice that a door is not a valid door without a roof on one side, or with equal amount of roof on both sides. Sometimes the villager AI (such as mating and housing) doesn't behave as expected until the game is restarted (as in save and quit, then reload the world).

Once housing has been established, villagers will then mate until the number of adult villagers equals 35% of the number of doors. Any remaining children will grow up as usual, resulting in a total number of adult villagers somewhere above one third of the number of nearby wooden doors. The type of villager that the child is doesn't depend on what type the parents are, e.g., two farmer villagers can have a child that is any of the occupations. Unlike other breed-able mobs, the parents and child have no personal interactions other than socializing. It takes exactly 20 minutes for a villager-baby to grow up to an adult.

The game engine periodically takes a census to determine the current population of the village. All villagers within the horizontal boundary of the village and within 5 vertical blocks of the center will be counted as part of the population to determine if continued villager mating is allowed. However, any villager within the horizontal boundary of the village and within a vertical distance of 32 blocks downwards of the center of the village will attempt to enter mating mode as long as there is at least one villager within the boundary. Therefore, it is possible to create an unlimited population by holding only two villagers within the village boundary and forcing all other villagers outside the 5 block vertical range of the census. If two villagers simultaneously enter mating mode while they are close to one another, they will mate with each other and produce a child.

Villager children will sprint about, entering and leaving houses at will. The villager children will also chase each other around the village to simulate that they are playing tag. These children will sometimes stop sprinting to stare at an Iron Golem. If the Iron Golem is holding a poppy, the children will cautiously take the flower from its hands. Villager children can be infected by Zombies. Zombie children will not burn in daylight and run faster. Villager children can be spawned by right-clicking an adult villager with a villager Spawn Egg.

As of 14w02b, villagers must be traded to become willing to mate (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. After mating, they will no longer be willing and must be traded with again before becoming willing again.

Farming
Villagers can be farmed by enclosing two villagers in an area with a lot of doors. The villager children can then be grown up and traded with. Villagers cannot be traded with until they've matured to adulthood. The most efficient design is to make a stone pen surrounded by doors, as shown:

Iron door is for access.

They can then be put in a Glowstone pen with an Iron Golem to keep them safe, also surrounded by doors, and reared to adulthood.

For more info, read Tutorials/Village mechanics.

Professions and Careers
Each villager has a profession, which can be identified by their clothing. In Snapshot 14w02b and later, villagers also have careers specific to their profession. The player can identify a villager's profession by reading the title at the top of the trading interface. Below is a table listing the various villagers, with their careers in relation to their professions, as well as the IDs specifying these.

Notes:
 * Generic villagers can only be spawned via summon command or external editing.
 * In Snapshot 14w02c, while their texture still exists, they were removed from the Profession list due to being incompatible with recent changes to trading, causing crashes when being accessed to trade. Their ID now rotates back to Farmers, as such making any villager previously a Generic villager into a Farmer.
 * Zombie Villagers have a 1 in 20 chance of spawning instead of a normal Zombie.

Trading


The trading system is a gameplay mechanic that allows players to trade emeralds for items and vice-versa with villagers.

Right-clicking a villager will allow a player to trade with them, and display their career. Villagers will make offers based on their profession and career, and will only make trades based on whatever offers they are making. Different offers may be viewed by pressing the left and right buttons next to the currently displayed offer. Most offers involve emerald as a currency, and some item pertinent to the villager's profession and career. Trading allows the acquisition of uncommon items that would otherwise be fairly difficult to obtain, such as chain armor. It is also the only legitimate method of acquiring a Bottle o' Enchanting in Survival mode (no longer available as of 14w02b). When villagers get a new trade, purple particles and green cross particles appear.

After trading once, the villager will open a new trade after a short period of time. After a few trades the villager will lock the trade offer. When this happens you will have to use the last trade offer (or any available offer, as of 14w02b) in the villager's window once and then wait for a short time and all previous trades will reopen. This makes it necessary to trade emeralds for items in order to re-trade items for emeralds (Or vice-versa). There is a maximum number of trades each villager can possess. Once the villager has maxed out its number trades (or, as of 14w02b, unlocked all of its tiers), it will not open any new ones. However, then you will be able to renew all offers by trading for the last item in the villager's list. In 14w02b villagers can now spawn with more than one initial trade, depending on the first tier of their career.

Zombie Villager
A zombie villager looks and acts like a normal Zombie except its head is similar to that of a villager, and are much rarer. They occur when a zombie murders a villager during Sieges with a likelihood depending on the difficulty, (Hard=100%, Normal=50%, Easy & Peaceful 0%.) of which they will be zombified and transform into their zombie counterpart. Their eye color changes to red, their heads turn green, and they get the clothes of The Player and stick out their arms. They have a 5% chance to spawn naturally including from a Monster Spawner in zombie Dungeons and the creative spawn egg. They can be cured to change them back into normal villagers. (See below) along with the trivia.


 * Zombie Villagers can be cured by throwing a Splash Potion of Weakness at it, feeding the villager a Golden Apple, and then waiting for a certain period of time until the villager turns back into their normal state. A villager who was infected and cured will not lose their profession.
 * When villagers turn into Zombie Villagers, they become less reminiscent of an actual Villager and more Zombie-like, with their normally wrapped-up arms now held outwards, much like an actual Zombie, with red eyes, tall heads, long noses, and unibrows.
 * Zombie Villagers will continue to attack uninfected villagers even when under the cure. This is why it's important to separate infected villagers from the rest of the villagers during the curing process.
 * Villagers have robes and aprons but when infected, they will change their attire to a regular zombie's clothing.
 * The swirls induced by the Weakness Potion will turn red when you right-click (feed) the Villager Zombie with the golden apple.
 * Villagers will normally take between 180s and 192s but they will be cured quicker when there are beds or iron bars nearby. The speed at which they cure is proportional to (the number of these blocks in a 7x7x7 cube around their feet) * 0.3 + 1. This could be to encourage players to put zombie villagers in some sort of prison cell or a pen.
 * Zombie Villagers may spawn from a zombie spawner or egg, and even naturally, (5% chance) and can still be cured.

Trivia



 * The villagers were inspired by the shop keepers in Dungeon Master 2.
 * Due to their peculiar look (and now their peculiar sound), villagers have been compared to Squidward from SpongeBob SquarePants, and Bert from Sesame Street. Notch himself agreed they look like "Caveman Squidwards".
 * A texture in the main mob directory of Minecraft appears to be the default character texture ("Steve") reoriented to be a villager texture. As is expected, applying it to the current villager model produces a very broken look, as seen to the side. This texture was removed in Minecraft 1.6, along with the pigman's texture.
 * Villagers can climb ladders if they are in their path, like other mobs.
 * Sometimes, when children are playing tag, a child may grow up and still be playing tag until the villagers stop for a break. The adult will then continue with a normal life.
 * Originally, the mobs populating villages were to be pigmen.
 * Flaming villagers will ignore the fact that they are on fire and may even continue to stand in it.
 * Villagers treat Zombie Pigmen as Zombies, running from them. However, Zombie Pigmen will not chase or attack Villagers.
 * This is because the Zombie shares code with the Zombie Pigman
 * Villagers will commonly stare at random mobs, and certain blocks. Villagers will also stare at zombies through doors or glass panes.
 * You can manually spawn baby villagers in creative by right-clicking the villager with their spawn egg. This works for all other mobs that can breed.
 * Since villagers will buy renewable resources from you for emeralds, emeralds and anything purchased with them may be considered renewable.
 * The villager was a Pigman before it was added, from the idea for the Zombie Pigman, which was added before the idea for a living Pigman was.
 * When a baby villager is attacked, it usually runs towards its parents.
 * If you sleep in the presence of villagers, they will look at the spot where your head would be if you were standing on the bed.
 * When a villager gives off particles from a new trade, they get 10 seconds of regeneration, which gives them 8 health points or 4 hearts, that will also happen when a zombie villager is transforming into a normal villager, but with a weakness effect by 5 minutes.
 * It is possible to name baby villagers with name tags but not adult villagers without the help of another player trading while you use the name tag.
 * As of 1.6.2, when a villager gets infected by a zombie, they also have a chance to spawn as a baby.
 * Renaming a Zombie Villager and curing it will not create a Villager with the same name.
 * As of 1.6.2, A child villager infected by a zombie can rarely spawn as a generic baby zombie.
 * When villagers walk along a walkway, they prefer to remain near the edges of the walkway rather than the center of the walkway.
 * Before their removal in 14w02c, Generic Villagers could be spawned by typing "/summon Villager ~ ~ ~ {Profession:5}" into a  Command Block, and only had one trade: 8/9 Gold Ingot for an Emerald.