Tutorials/Zombie siege defense

Visiting or staying in a village at night can result in a Zombie siege: Zombies will spawn near the outskirts of the village, regardless of light level, and attack the villagers. Alongside Raids, Zombie Sieges are the biggest threat to a Village.
== Mechanics ==
While the villagers will try to hide in their houses, some may fail to get to safety. In addition, 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 zombified, eventually dying in the sun without player intervention) All villages have at least one iron golem to help defend them, but even with this assistance almost any village is likely to become depopulated within a few sieges unless the player provides help. Even if two villagers were to survive, villager breeding is much too slow to recover from the nightly losses. Even with two villagers, they would need to become willing and also need to be at least one unclaimed bed within range before they will breed. 
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.
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:
# Hiding 2 villagers (2 villagers are needed for breeding) in a well-lit 3x2x3 hole under (or above) the village, allows for safe villagers to repopulate the village. While this method will not prevent a siege or protect any other villagers, a player will not lose the village. The player must put 2 beds in there as well and give each of the villagers 3 loaves of bread, 12 carrots, 12 beetroot, or 12 potatoes.
# While it will not help with sieges as they ignore light levels, light up the entire village to avoid randomly-spawned zombies attacking the villagers and other randomly-spawned mobs attacking the player. Note several parts 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, especially in a desert biome village. 
# 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.
# Sieges only occur if the player is inside a village. The territory of a village consists of a central sub-chunk containing a claimed bell, a claimed bed or a claimed work site (such as a lectern), surrounded by the 26 sub-chunks within a 3x3x3 cube (or a 48x48x48 blocks cube).
# Siege zombies are spawned at a randomly-selected point 32 blocks away from the player in any direction. This could mean that zombie sieges might spawn well within the boundaries of a larger village.
#* Bringing all beds and work sites close to the village's bell might make defense easier, as zombies will be more likely to appear outside of the village or on its periphery. 
# 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.
#* Several layers of transparent blocks can serve to trap the spawned zombies, such that they will 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.
#* Siege zombies won't spawn in water, so surrounding a village with bottom-half slabs over a pool of water will prevent spawning.
# 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.
#* Remember, though, that villagers will open the door at dawn, before any nearby zombies finish burning. Helmeted zombies won't burn.
# 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.
# 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 (in centrally-located buildings), 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.
# The player can also build a mini-version of a skyscraper. Although this requires resources, it will be worth it. Build a small hollow tower with stairs in sides of it. Leave one stair place empty. Put a sticky piston and some redstone with lever (which leads to the outside the building) inside the tower. Fill the empty stair slot with stairs. Build an upside house where villagers can hide. You're ready! Although the villagers may not get down to the ground, this method is the most efficient method to build a sky village. Use the lever and piston to retract the stairs, so zombies can't get up there.
# If the player has the ability to make potions, a Splash Potion of Healing is an excellent weapon. This will damage zombies within a certain area, and will not damage the villagers.
# If houses are only two blocks high, zombies can only spawn outside, as they must have a transparent block above them.
# One way you can keep zombies out of houses is by placing slabs in front of the doors. You can simply sneak on java edition to get into the houses. However, there is a downside, as the villagers can’t get out.
# As with Illager Raids, the bell in the village center is key to villager safety. While the bell won't inflict all participating undead with the Glowing effect, it will make sure that all the villagers prioritize returning home.
#* You can even enhance the bell's usage by hooking it up to a redstone contraption using either a daylight sensor or pressure plates next to a claimed bed so that the bell will ring whenever either the sun rises or a villager wakes up to minimize daytime casualties.
After an attack, whether from a siege or from randomly-spawned zombies:
# Each morning, the player should quickly replace any doors that have been broken. Don't try replacing the doors with iron doors – the zombies can't break them, but villagers can't open or close iron doors either.
# 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:
#* Splash them with a Potion of Weakness
#* Feed them a golden apple
#* 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, a Splash Potion of Harming can be used to heal it a little, increasing its chances of surviving.
# 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 unclaimed beds), a player can cause them to start breeding by giving them appropriate food.
es:Tutoriales/Defensa ante hordas de zombis
ja:チュートリアル/ゾンビ襲撃の阻止
lzh:教章/屍襲禦
zh:教程/防卫僵尸围城