Villager

A Villager (or Testificate) is a passive NPC (Non-Player Character) that spawns and moves about in NPC Villages. Their characteristic look is dominated by their large, bald heads, green eyes, uni-brows, and long, protruding noses. They spawn around the villages and inside the buildings. They spawn at their respective buildings corresponding to the role they have.

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 minecraft.jar file, but one is not used in the game.

Behavior
Villagers will randomly look at the player, and wander the area of the village. They do not attack if attacked, but they will be knocked back. When attacked, they will not run away. If the player does happen to kill one, they drop nothing, and others will do nothing about it, though nearby Iron Golems will attack the player.

Villagers have the ability to utilize doors and ladders, therefore able to go in and out of houses. Villagers will hide in houses during the night, rain, or when chased by Zombies. Villagers also will sometimes stop and appear to read signs, though this is rare.

Villagers seem to favor well lit conditions over dimly lit ones, seemingly due to the lower chance of zombie spawning. Villagers favor houses over well lit areas, even if the house is completely unlit. This is probably due to the fact that houses are assumed to be sufficiently lit.

Villagers will run away from Zombies, which can attack the Villagers. Sieges can occur between these mobs, and the Villager's only "natural" defense are the Iron Golems, which protect Villagers from nearby mobs.

The Villagers will "socialize" with each other and passive mobs. This involves two Villagers simply facing each other. Villagers can socialize with the player as well, if they approach and stand still (they will start moving their heads in a bobbing fashion). Sometimes if three villagers are "socializing" and the player approaches them, one will push the player away.

When Villagers are near an Iron Golem, they will stop and stare at it. The Iron Golems sometimes give roses to the Villagers, symbolizing the friendly relationship between the Villagers and Iron Golems.

Mating and Population
Villagers will mate depending on available housing. A "house" is defined as a wooden door that has an "inside" and an "outside". The "inside" is the side of the door which has more "roof" than the other. A block counts as being part of the "roof" when it is within 5 blocks of the door (in the two directions the door faces), its topside is exposed to sunlight during the day, and its bottom side is higher than the door's bottom side. Notice that a door is not a "house" without a roof, or with equal amount of roof on both sides. A house is initiated by a nearby villager (up to 16 blocks away horizontally along both axis, and up to 4 blocks vertically), and then either added to an existing or a new village. Don't spawn a villager in a house you created for yourself, or it might take it. If so, you have no choice but to kill it, because hitting them won't make them run. Sometimes the Villager AI doesn't behave as expected until the game is restarted.[Lots of clarification needed]

Once housing has been established, Villagers will then mate until the number of adult Villagers equals 0.35 times 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.

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. The bill agrees always like to do it in the golems.

Professions
Each Villager's profession can be identified by its clothing. The Villager's profession does not give them unique differences from each other, however, other than their starting spawn.

(Note that all Villagers have brown clothing under their robes/aprons.)

Trading
See Trading

History
Villagers were first introduced in Beta 1.9 Pre-release 1. They had the same mob AI as a Pig and had the name "TESTIFICATE" over their heads the same way player names are applied in Multiplayer. The names were removed in Beta 1.9 Pre-release 2.

As of 1.1, the original Farmer NPC could be spawned in Creative mode by using Spawn Eggs.

As of Snapshot 12w05a, Villagers can open and close doors, go inside at night, and can detect houses. Before 12w05a, when Villagers did not have the ability to detect houses, Villagers would often wander away from villages.

As of 12w06a, Villagers can socialize with each other and passive mobs, are attacked by and run away from Zombies, and go inside when it rains.

As of 12w07a, Villagers will repopulate NPC villages by the number of houses there are, and their children sprint.

In 12w08a, Iron Golems were added to protect Villagers, by attacking any hostile mob near them or a mob that has attacked a nearby Villager (including the player). They only spawn naturally in villages, but can also be crafted by players (similarly to Snow Golems).

As of 12w18a, Villagers spawned via a Spawn Egg will have a random profession.

After 12w19a, Jeb released a preview of the trading system showing a currency item or coin (stackable to 64). It was first thought that this coin would use redstone as a crafting ingredient, as 4 stacks of redstone were in Jeb's inventory, and the coins had a reddish hue. this was changed, however.

As of 12w21a, you can trade with Villagers using Emeralds.

Future

 * Mojang also mentioned that they are currently focusing on Villagers and their textures.

Bugs

 * As of 1.2.5 a glitch exists where setting the difficulty to peaceful will despawn all the villagers in the nearest village to you. This effectively kills the village as they do not respawn.

Trivia

 * Villager breeding results in random types, not depending on the couple.
 * Due to their peculiar look, Villagers have been ridiculed by a portion of the fanbase, sometimes comparing them to Squidward from SpongeBob SquarePants or Bert from Sesame Street. Notch himself agreed they look like "Caveman Squidwards".
 * Since the Villagers introduction, there has been a texture in the game files indicating a standard Villager type due to their filename. However, this role seems to be filled by the Farmer type instead, with no Villager of this type ever spawning.
 * 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 above.
 * Villager's arms are implied to be jointed, with two parts each to create folded arms. Another likely implication is that the arms are tucked inside the sleeves, so that the sleeves touch.
 * Villagers can climb ladders if they are in their path, like other mobs.
 * Villagers and Squids are the only mobs in the game that don't have any sound effects.
 * Sometimes when there is a zombie outside a villager might still open the door resulting in a "suicide".
 * Sometimes villagers will break into player's houses because of how they can open doors. This can result in them killing you, indirectly, by opening the door at night when there's a hostile mob outside.