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 long, protruding noses. Villager's 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 minecraft.jar file, but one is not used in the game on normal maps. Hood texture files are also present, but no mesh currently exists to display them.

Behavior


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

Villagers have the ability to utilize doors and ladders, and are 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. Another rare instance is if you throw down an item in front of a villager, he might look at it.

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. As of the upcoming 1.4 update, Zombies have a chance of turning a villager into a zombie if the difficulty is on Normal or Hard, or Hardcore gamemode. This can also happen with baby villagers, resulting in Baby Zombies.

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. On some occasions, villagers will gather in a large group in one point in a village, seemingly without any cause. They are also attracted to pumpkins and doors. They will sometimes appear to socialize with Snow Golems probably because of their attraction to pumpkins. 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, as well as referencing the inspiration behind the latter.

When trapped, villagers will try to find the easiest exit, such as when trapped in a room with no roof and 2 high walls and a Bed next to a wall, it will jump on the Bed in an attempt to escape. In other instances, villagers will try to jump over obstacles, regardless of height, similarly to pigs.

Villagers also will not willingly fall off high cliffs.

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 "inside" 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. 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 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.

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 a vertical distance of 32 blocks 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 a single villager within the village boundary and forcing all other villagers outside the 5 block vertical range of the census. The villagers on the "outskirts" of the town will periodically enter mating mode in an attempt to mate with the villager that is still within the boundary. If two villagers on the outskirts 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 rose, the children will cautiously take the flower from its hands. Although children look smaller than adult villagers, their hitbox is the same size. Villager children can be infected by Zombies. Zombie children will not burn in daylight and run faster.

Professions
Each villager's profession can be identified by its clothing.

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

*Note: Generic villagers do not spawn naturally, nor with a Spawn Egg and Zombie Villagers have a 1 in 10 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 NPC villagers.

Right-clicking a villager will allow a player to trade with them. Villagers will make offers based on their profession, 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. Trading allows the acquisition of uncommon items that would otherwise be fairly difficult to obtain. It is also the only legitimate method of acquiring chain mail and Bottle o' Enchanting in Survival mode.

Zombie Villager

 * Zombie Villagers can be cured by throwing a Splash Potion of Weakness at it, feeding the Villager a Golden apple, and then wait for a certain period of time, until the Villager turns back into his normal state. A Villager who was infected and cured will not lose their profession.
 * When Villagers turn into Zombie Villagers, their arms are not wrapped up anymore. Instead, it's hands are going toward you, like a normal zombie. Some with swords.
 * Villagers have robes and aprons but when infected, they will change their attire to a regular zombie's clothing.

Bugs

 * Villagers will generally try to enter the south-west most house in a village at night, often leading to crowding of a single house and a lack of use of all the other houses.
 * Sometimes when there is a zombie outside, a villager might still open the door resulting in a "suicide"
 * If trading is opened with a villager and they die before it is closed, trades can still be made.
 * When a villager is cured after being infected by a Zombie,they change roles and trades.
 * In man-made villages, some villagers will not be able to get into houses if the village is an "apartment" style.
 * Villagers sometimes crowd an undersized house, like above. You may wind up with 50 villagers at the same door.
 * Baby Villagers are treated by the game to be the same height as an adult. Therefore, they can not fit in 1.5 tall spaces (half slab upside down above air).
 * Sometimes Villagers will fall through a block and will be in the ground. This is not just a visual glitch as an attempt to trade or hit the Villager with the cross hair where the head should be will not result in anything.
 * Sometimes in SMP, villagers will not have kids, but the particles will show.

Trivia



 * The villagers were inspired by the shop keepers in Dungeon Master 2.
 * Villager breeding results in random types, not depending on the couple.
 * Due to their peculiar look, villagers have been compared 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 to the side.
 * 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 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.
 * Green villagers only have two trade options: They will either buy 8 or 9 gold for one emerald.
 * Flaming villagers will ignore the fact that they are on fire and may even continue to stand in it. (tested and confirmed)
 * Swirls are emitted when a choice is going to be added.(Tested with 3-4 villagers)
 * As of 12w32a, Villagers have a chance to emit green stars when traded with, and emit lightning cloud particles when hit.
 * Villagers treat Zombie Pigmen as Zombies, running from them.
 * C418 is currently working on sounds for Villagers.
 * On superfflat, and there are slimes in the village, the villagers will sometimes follow medium slimes and watch them bounce, to a sometimes homourouse glitch whereas the heads are rapidly going up and down, but this is uncommon.
 * Villagers sometimes follow creepers, although this is rare
 * Villagers will commonly stare at random mobs, and certain blocks. Villagers will also rarely stare at zombies through doors or glass panes.