Tutorials/Zombie siege defense

Staying in a village overnight may result in a Zombie siege: Zombies will spawn near the outskirts of the village, regardless of light level, and attack the villagers.

Mechanics
While the villagers will try to hide in their houses, some may fail to get to safety, and on the Hard difficulty level zombies can break down doors. These sieges can kill off all the villagers within a couple of nights. (On Normal or Hard difficulties, most or all of the villagers would become zombies themselves, which would eventually despawn or burn.) Sufficiently large villages may have iron golems to help defend them, but almost any village is likely to become depopulated within a few sieges unless the player provides help. Even when two villagers survive, villager breeding is much too slow to recover from the regular deaths.

There is also the matter that Villager AI is woefully insufficient for their survival − even without sieges, they are prone to falling into nearby caves or pits and becoming lost, dancing on cactus, inviting zombies in, and otherwise committing suicide. Furthermore, even the naturally spawned zombies still hunt villagers, and have become much more dangerous: besides summoning aid and powering up when the player attacks, they can now see the player and sense villagers for a large distance. Note that if there are less than two villagers remaining at any time, they will be unable to breed their numbers back up, and the village will not be viable. Even with two villagers, there also need to be at least nine doors within range before they will breed.

If there are no valid spawning locations within the "siege zone" at Y values between 3 below and 2 above the village's center, sieges cannot start in that village. This can also be used to force any sieges to start at a particular location.

If all players in the Overworld sleep before midnight, sieges will not be able to start. Similarly, if all players remain outside the bounds of villages between midnight and dawn, there will be no candidate villages.

Tactics
Accordingly, player assistance is needed to help a village survive. Some suggestions:
 * 1) While it won't help with sieges, light up the entire village to avoid randomly-spawned zombies attacking the villagers and other randomly-spawned mobs attacking the player. Note several of the naturally-generated village buildings lack sufficient lighting to prevent spawns, and all buildings with flat roofs or other ledges will need those roofs and ledges lit.
 * 2) Sieges begin at midnight. If all players sleep before midnight or wait outside of any village until dawn, sieges cannot start. Until the village is protected from random spawns, sleeping at dusk will also avoid attacks by randomly-spawned zombies.
 * 3) Sieges only occur in villages with at least 10 doors and 20 villagers, so keeping the door count or population below this number can prevent sieges. Randomly-spawned zombies will still attack, however, and could wipe out a small village.
 * 4) * With a population over 20, it can be advantageous to add many more doors to the village to increase the population, increasing the chances that enough villagers will survive an attack to repopulate.
 * 5) Siege zombies are spawned near the outskirts of the village. A wall or fence around the village inside this boundary will keep them out.
 * 6) * For a compact village with a 32-block radius, the wall must be within a circle with radius 20.
 * 7) * A small guardhouse with doors just under 65 blocks from the village center and one villager can expand the village radius. Be sure to protect that villager from siege zombies!
 * 8) While siege zombies cannot spawn on bottom-half slabs, glass, farmland and other transparent blocks, unlike random spawns they can spawn on the solid block underneath so slabbing the area will not work as a defense.
 * 9) * Several layers of transparent blocks can serve to trap the spawned zombies, such that they'll despawn or suffocate without being able to reach the villagers. It may also result in the solid blocks being below the vertical range for the spawning zone.
 * 10) * Siege zombies won't spawn in water, so surrounding a village with bottom-half slabs over a pool of water will prevent spawning.
 * 11) On hard difficulty, zombies can break doors. But they will only do so if they can stand directly in front of the door. Thus, hanging doors flush with the outside wall and one block up will allow villagers and players to open the door and jump into the doorway while preventing zombies from breaking in. The knocking sound as they jump and momentarily start to break the door will also announce their presence.
 * 12) * Remember, though, that villagers will open the door at dawn, before any nearby zombies finish burning. And baby zombies and helmeted zombies won't burn.
 * 13) Iron golems will attempt to kill any zombies. Snow golems may serve as a distraction, as their snowballs may cause the zombies to attack them rather than the villagers. Similarly, villagers trapped in a ring of fences may distract zombies from more vulnerable villagers.
 * 14) If the only goal is to keep the villagers safe (or as a temporary measure until walls are built), wait until the villagers have gone indoors, then place blocks or fence gates outside doors to barricade all the villagers inside their houses.  The villagers won't be able to wander, and the zombies won't be able to attack them.

After an attack, whether from a siege or from randomly-spawned zombies:
 * 1) Each morning, the player should quickly replace any doors that have been broken. However do not put a door on the blacksmith as it will kill villagers off (they will consider the outside to be the inside). Don't try replacing the doors with iron doors – the zombies can't break them, but neither will the villagers recognize an iron door as a "village door" for spawning purposes.
 * 2) Zombies will not merely kill villagers, but can convert them to zombie villagers (50% chance on Normal difficulty, 100% on Hard). Also, random zombie spawns have a small chance of being Zombie Villagers. If a player has been to a Nether fortress, they may be able to cure these unfortunates as follows:
 * 3) * Splash them with a Potion of Weakness
 * 4) * Feed them a golden apple (ingot version)
 * 5) * Wait. The cure takes several minutes, so the player must prevent them from burning or otherwise dying (or despawning) before they recover. Luring them inside an empty house and then barricading them in can work well. If the zombie is damaged, splash potions of harming can be used to heal it a little, increasing its chances of surviving.
 * 6) Curing naturally-spawned Zombie Villagers can repopulate a desolate village or allow a player to build a village from scratch. Once two villagers are in the village (and the village has enough doors), a player can cause them to start breeding by trading with them or giving them appropriate food.