Village



NPC Villages are groups of buildings inhabited by non-player characters (NPCs)—Villager mobs that spawn naturally in the world. They only occur in the plains or desert biomes. Villages in Desert biomes have the buildings made of Sandstone, Smooth Sandstone, Chiseled Sandstone, Sandstone Slabs and Sandstone stairs instead of wooden or cobblestone features.

Structures
The buildings and structures that make up a village are:

The number of buildings composing 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). There may be fewer buildings of a given type than the maximum allowed. The number of lamp posts has no restriction, as they are generated where no other buildings can be placed. Gravel roads are found between the buildings of the village and often extend beyond them.

Blacksmith Chest Loot Chart
One or more slots in the chest that spawns in a Blacksmith Shop may be populated with items from the following list. There may be more than one slot containing the same type of item, but the numbers per slot do not exceed these limits:

Finding NPC Villages
One method is to find the possible places that villages can spawn by using a superflat world, where a lack of terrain makes villages spawn more often. This method will not always work: The above does not always work because NPC villages only spawn in flat biomes (plains and desert), so the above produces many false positives where the location in the original map is not suitable. One possibility is to retry the steps above but for step 2 select default world type (as opposed to superflat). This makes it harder to see NPC villages, but each NPC village found is much more likely to exist in the original world. There are also programs like AMIDST (by Skidoodle) to map worlds that will display all villages of the world/seed.
 * 1) Find your seed number. This can be done by pressing "/" and typing "seed".
 * 2) Create a creative, superflat world, using that seed.
 * 3) If the computer being used is sufficiently powerful, set the render distance to "far".
 * 4) Fly around and search for an NPC village.
 * 5) When you find one, press F3 and find the coordinates.
 * 6) Go to these coordinates on your other (first) world.
 * 7) An NPC village (not the same design but still an NPC village) will have spawned there.

Defending and Rescuing NPC Villages
If a player stays in or near an NPC Village overnight, they are likely to encounter a Zombie Siege. Zombies will spawn within the village, regardless of light level, and attack the villagers. If no villagers are outdoors (likely), they will bang on the doors of occupied houses. While the villagers will attempt to hide in their houses, some may not make it to safety from any given siege. If playing on Hard difficulty, the zombies will also break down the village doors, which can kill off the village within a couple of nights. Sufficiently large villages may have Iron Golems to help defend them, but even so, without aid from the player, the village is likely to be depopulated within a few sieges. (If there are fewer than two villagers remaining at any time, they will be unable to respawn, and even if they can respawn, this process will be too slow to recover from the zombie attacks.) There is also the matter that Villager AI is woefully insufficient for their survival -- even without zombies, they are prone to falling into nearby caves or pits, dancing on cactus, and otherwise getting themselves killed.

Accordingly, player assistance will be needed to help the village survive, consisting of the following steps:


 * 1) Until the village is fenced (see below), players should not spend the night within 128 blocks (their mob despawning radius) of the village borders.
 * 2)  As quickly as possible, they should light the entire area (including inside buildings), and build a fence completely enclosing the village, taking the usual care to make sure that nearby blocks do not allow mobs to jump over the fence from outside.  While this will not protect against the siege itself, it will prevent other monsters (especially creepers) from spawning or entering during the night, which they will do if a player is nearby.  Left to themselves, mobs besides zombies will not attack villagers... but they will attack the player, and creepers will blow up parts of the village. Alternatively, wait till nightfall, and then place a block in front of every door in the village that is holding villagers. The villagers won't be able to wander, and the zombies won't be able to attack them.
 * 3) The player should go out at night and fight zombies.
 * 4) When morning comes, the player should replace any doors that have been broken.  Do not try replacing the doors with iron doors -- sure, the zombies can't break them, but neither will the villagers recognize an iron door as a "village door", for spawning purposes.
 * 5) As of version 1.4, zombies will not merely kill villagers, but will convert them to Zombie Villagers.  If a player has been to a Nether Fortress, they may be able to cure these unfortunates as follows:  (a) Splash them with a Potion of Weakness, then (b) Feed them a Golden Apple (nugget version), and (c) wait several minutes.
 * 6) As of version 1.4, even a depopulated village will occasionally spawn Zombie Villagers, who can then be cured to repopulate the village.

Expanding NPC Villages


The player can add more doors to a village to cause more villagers to spawn there.For every valid door in the village it will produce 0.35 of a villager. The requirements for a valid village door are that more spaces must be "outside" on one side of the door than the other. A space is considered "outside" if the sun hits it directly during the day, i.e., there is nothing above it except for transparent blocks like glass. Any space that is not transparent, or is shaded from above, is considered "inside". It will look at the 5 blocks in a straight line on each side of the door, and count the number of "outside" spaces. If the number of "outside" spaces on one side of the door is different than the number of outside spaces on the other side, it will be a valid door.


 * Buildings may be constructed out of most kinds of blocks provided that they are not transparent.
 * To properly register each door, a villager must be within a radius of 16 blocks horizontally and 3 to 4 blocks vertically of it. Doors may unregister if there are no villagers within range for a period of time.
 * Each door successfully registered as a house counts as 0.35 of a villager, meaning that every 3 registered doors produces a villager and every 20 registered doors is an additional 7 villagers.

Perhaps the easiest way to increase villager population is to make a kind of building some players call, "love shacks." These shacks are simply a building three blocks tall with large dimensions that for walls simply have alternating column and door. These are extremely efficient and easy to make.

For a slightly more natural way to make expanding easier, given the choice, villagers prefer areas where numerous doors back onto an area - like a communal square; this is almost always occupied as the chance of there being an active door within 16 blocks or so of the square is very high relatively speaking.

Criteria for an acceptable house
General criteria tested:
 * With door - villagers enter acceptable structure upon downfall (rain/snow) (does not enter without door of course, as a door determines a house)
 * No lighting (the existence of a light source is irrelevant in determining house eligibility)
 * Grass floor (floor surface does not seem to be relevant, also experimented: Jack-o-Lanterns, ice, bookshelves, gold ore as floors - all acceptable, although ice was interesting to watch)
 * Interestingly, whether the door was placed inside the frame, or on the bordering block outside the frame in any fashion, the villager entered in all cases (diagrams below)
 * Floor does not have to be at door level (inside floor can have a 1 block drop immediately after door without stairs, or 1 block up as long as door frame accommodates head space)
 * Acceptable structure does not require a roof cover (top can be completely open to rain and villager will attempt to escape from it inside the open top structure)
 * In fact, an acceptable "house" can be as minimal as a door, and then any single building block at the same height and within 30 blocks
 * Villagers cannot directly find a house unless there are no more than 15 blocks between them and the door only, regardless of any of the structure (also without random wandering in the right direction)
 * Villagers will attempt to squeeze as many of themselves as possible into 1 structure if it is the nearest house
 * A lone door will not be seen as a structure to a newly spawned villager, although destroying all of the structural blocks will not cause previous residents to forget about the house, and they will often congregate within 3 blocks of the "inside" of the door where the structure used to be


 * Note that regardless of structure size, villagers will stay within 3 blocks of the door while "actively" occupying the house
 * The final definition of a "house" seems to be: any door that has at least 1 building block at the same height, and within 30 blocks of the door.

Door placement:

Village Behavior
A village is composed of at least one acceptable house and one villager. Upon creation, a village center is defined as the barycenter of the houses location. From this center extend the boundaries of the village, through which no villager nor iron golem may leave the village.

The size of the boundary is independent from the number of villagers, and is rather defined by the villagers' location relative to the village center. In other words, the boundaries of a village composed of at least two villagers will widen with the distance separating the villagers.

Any contact between villages' boundaries will prevent the centers of each village to travel towards the center of the other.

Creating NPC Villages
The player is capable of founding a new village by "transplanting" villagers from an existing village, as long as the following conditions are met:


 * Must be at least 32 blocks from the "center" of the existing village, or else villagers will simply return to the village.
 * There must be homes at the new village, or else the villagers will simply wander.

As a villager cannot be manually pushed far past the boundary of the village, a common method for transplanting villagers from an older town to a newer one is placing tracks, and pushing the villagers into minecarts - they will simply sit in the minecart and not react to the village border as they pass it, until they are removed from the cart. Villagers may disappear when traveling in minecarts only to reappear when the minecart is broken. It is often helpful, but not required, to place the doors of the homes after the arrival of the villagers to speed detection. You can also simply destroy all the doors in the villages which will remove the boundary.

With the addition of zombies having a chance to spawn as zombie villagers and the ability to cure zombie villagers back to villagers, it is feasible to create a village anywhere a house can be made and zombies can be spawned, given the materials to cure the zombie villager. If the player has access to a zombie spawner (found in naturally-occuring dungeons), a "village" can easily be created by curing the zombie villagers spawned from it and corralling them (like cows or pigs) into nearby enclosed area. However, they will continue to attempt to wander and will not multiply unless a legitimate village is created following the villager housing criteria. This will also prevent zombie sieges as technically a village is not present.

History
Notch originally worked on NPC Villages by himself, but eventually gave the task to Jeb, so that he could work on other things.

Jeb has said that during early tests of villages, the lava in a smithy often set the village on fire.

NPC villages were added in Beta 1.8. Originally, NPC Villages were intended to be populated with Pigmen, but in Beta 1.9 Pre-release, Villager mobs were added to spawn in NPC Villages.

A picture of NPC villages was released by Notch before 1.8 was released. In the early screenshots, villages were partly made of Moss Stone. Even though the picture only showed the exterior of the buildings, videos recorded later during PAX revealed the interior of the structures. NPC Villages are most often spawned in desert or plains biomes. This is probably due to the fact that while villagers wander, they are prone to falling off of cliffs and other tall structures, much as a wolf will. It is implied that villages will have their own biome in order to solve many of the problems that were hindering their development.

As of 12w07a, Villagers will automatically repopulate according to the number of available houses in the Village. This is useful, because Zombie sieges have also been implemented, which hordes of zombies will have a chance to spawn near villages at night and attack Villagers. The player may supplement the amount of available houses by creating structures that consist of an area with a roof and wooden door.

As of 12w08a, Iron Golems will spawn near villages in order to protect the Villagers against any mobs in its sight, except passive mobs, wolves, and certain hostile mobs, such as the creeper, due to its potentially destructive nature when aggravated.

Since Minecraft snapshot 12w21a the player can trade with Villagers using emeralds.

As of 12w21a, NPC Villages change style according to their biome (e.g., the structures are made of sand/sandstone when any NPC villages are spawned in a desert).

As of 12w32a, villages now keep track of the 'popularity' of players by username. 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. In addition, the popularity is stored per village, a player may be popular in one and notorious in another. When a player's acts directly on a villager, particles around that villager will indicate the change in popularity.

Presently, popularity has one effect: 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. The only limit to this aggression is a distance of approximately 13 quinquagintillion (10^153) blocks, which is many times larger than the size of the Minecraft world: therefore, if an iron golem is in a loaded chunk, it may become aggressive to a player at any possible distance in-game.

This snapshot encourages players to protect villagers: 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.

PAX
NPC Villages were shown to the public during the PAX 2011 demo. For demo purposes, Notch made them appear near the spawn so people could see them. On a live stream from his Android phone during PAX, Notch stated that NPCs were not added to the villages but that they were coming eventually. (According to Jeb, NPCs for the village was delayed until Beta 1.9. ) The majority of the NPC structures are made from wood based resources, with frames of cobblestone, and the footpaths are 3 blocks wide and made of gravel. The gravel appears to replace the top layer of dirt (or sand) upon generation of the village.

Old interview of Notch
Notch once answered some questions about an idea he had, NPC Villages, where he revealed some thoughts about them :
 * If you treat the Villagers well (giving them items), they'll give you items back. (This has been fulfilled with the addition of trading.)
 * If you treat the Villagers badly (attacking/killing them), they'll try to do the same to you. (This has been partially fulfilled with the addition of Iron Golems, and in the 1.4 snapshots.)
 * Raiding chests will anger the owners of the town/chest and they will attack.

Eventually these villages will have more player looking NPC's. Also, trading has been Jeb's main focus on villages.

Bugs

 * It is possible for mushrooms to spawn inside the buildings.
 * NPC villages may occasionally spawn in shallow water (however, it is usually not too far away from shore). As seen Here
 * Occasionally, if a lamp post is generated one block away from a building, one of the torches may be spawned on the wall of that building.
 * It is possible for village buildings as well as farms to be cut off seemingly randomly, as result of chunk errors, making the buildings be only partially spawned.
 * If an NPC village is in the desert, there is a small chance there will be a cactus on the paths, and that they will have gravel on top of them.
 * It is possible for structures built by NPCs to continue down a ravine, if spawned on/next to one.
 * Zombies may spawn in houses on hardcore mode, even if lit. (Unknown if this a bug or not)
 * In desert villages, stone half slabs spawn on top of blacksmith's. It would make more sense for sandstone half slabs to spawn on top of them to match the rest of the village. (Unknown if a bug or not)
 * At rare occasions, villages are created so small that no villagers will spawn.
 * There is a rare glitch where a house will spawn upon another, thus creating a doorless 2 story house with a gap where the second "door" should be.
 * In 12w21a (and possibly 12w22a), villagers occasionally will all spawn with the original farmer skin. (This does not affect the items they buy/sell, just their appearance, but can be confusing for the player)
 * In some desert houses, there may be some extra blocks inside made of sand.
 * In many desert villages, houses generate with doorways too high to reach due to a lack of stairs. This can happen in other biomes as well.
 * Rarely, NPC villages can spawn even when "generate structures" is off, but no villagers spawn.
 * Villages can be depopulated over time if there's any sort of "trap cave" or similar structure nearby, where they get stranded and perhaps killed.
 * It is possible for a village to be completely devoid of villagers, especially if the player spawns near a village at the beginning of the game.
 * In the Xbox edition if a village is at the end of the map it is cut in half with some buildings half there and the rest half gone.

Trivia

 * NPC villages are optional as part of the setting for generated structures.
 * If gravel paths go through a tall grass area, upon generation tall grass will be removed and it may drop seeds.
 * 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 that at first glance almost looks like a chunk error.
 * Occasionally, surface ravines will be generated through NPC villages, causing missing pathways or even entire buildings sunken into the ravine. This also applies to cave entrances and other surface oddities.
 * The well acts as the "center" of the village in reference to Minecraft's code. For example, in 12w21a and above, if a well generates in a desert, all buildings and paths will be made of sandstone, even if all other buildings are in an adjacent plains biome. The well also appears to be the point where village-locating tools will point to. This explains why there is always exactly one well in each village.
 * The wells in NPC villages do not work as infinite water sources, as they are more than one block deep. (They do become infinite water sources once drained to their lowest level, or if the bottom is filled in with sand/gravel.)
 * Sometimes buildings can generate so that their entrances are buried. You have to uncover the entrance, or dig in through the walls. An example of this can be found on the seed, troll, with the church in the NPC village you spawn near, half buried.
 * Alternatively to the above, entire villages can be rarely found 2 or more blocks higher than the gravel path with no stairways going up to the houses.
 * Outside the tutorial area in the Xbox 360 Edition, there is a village similar to the ones in the PC edition but without Villagers. This was not made as part of chunk generation.