Tutorials/Safe home

Since there are various sources of danger to your buildings and yourself, here are the most common techniques to counter them.

Lava and water
When you extend your base, be sure that nothing fragile like torches or redstone circuits are on the floor in the area. If you strike a water source, it can wash such things away. If you are unlucky, you yourself can also be swept away (maybe into an abyss) or drown.

Lava flows slower, but is much more hazardous, as it sets you and your wooden items on fire.

Sand and gravel
“Built on sand” is a real life saying which means “This won’t last long”. This is true in Minecraft, too.

If you have a floor of sand or gravel, be careful when mining &mdash; digging near sand that isn't supported from below may cause it to collapse. Be wary of placing torches on sand columns which may fall. If such a torch is destroyed, you may find a creeper or other mob which spawned in the darkness.

If you discover a natural cave with a roof of sand or gravel, be extra careful. Even if you don’t choose it to become your new home, as soon as you place or remove a block near it, the loose sand or gravel will suddenly be affected by gravity and fall down, suffocating you, flooding the cave with lava or water and/or allowing mobs to come in from the dark cave/night above.

General

 * Use a fence or a wall to keep all mobs except spiders and spider jockeys off your lawn.
 * Use a cactus fence built from two rows of cacti (like this: ▞▞▞▞) or an alternating row of cacti and flames from netherrack to keep mobs from passing through it.
 * Build a ditch deep enough that the mobs who fall in can’t get out anymore, which is either filled with lava or streaming water leading to a Mob Farm.
 * Keep your home area well lit. Mobs only spawn if the light level is below 7; remember that a torch provides level 14 light and this decreases by one for every block away from the torch.
 * Mobs don't spawn on water. If one or two sides of your home base are open to the sea, you don't need to wall these off. Extend your surrounding wall a few blocks into the sea, and this should be enough to keep the mobs out. (Remember to put a lip on the top of the outer wall, as detailed below, to prevent Spiders.)


 * Another way to keep mobs out of your house is a staircase that has an overhang.

You see when mobs try to enter your house they try to walk to get closer to the ladder, jump but can't climb the ladder so they fall. But you can run and jump and then climb up the ladder and the climb up another ladder into your base. I wish I could get a picture of it but my computer is being dumb.

Creepers
The single most dangerous mob is the creeper, because of the destructive damage it causes to buildings (they can effectively blow large holes in your structures). However, you are safe within your base if there are creepers outside, as they can't get close enough to you to explode. You might even be able to open your door and kill the creeper with a bow and arrows, as long as you keep your distance!

Also, be aware that creepers can detect you and start their fuse from one block away, even if there is a low wall or fence keeping them away. Ways to avoid this are: build a wall at least two full blocks wide (even if it is made of certain translucent blocks such as slabs, fence or glass); or build your home with all spawning surfaces on all traversable paths sufficiently lit.

Different blocks have different resistances to explosions. Dirt walls will be easily destroyed by creepers, while cobblestone will resist most creeper explosions. Obsidian is explosion-proof, so you can laugh in the face of creepers trying to destroy walls built of this block.

Spiders
Spiders are two blocks wide, which means they cannot move through 1-block wide spaces. Since Beta 1.2, spiders can also climb walls and fences, so you won’t be safe in your walled garden anymore.

To effectively spider-proof your buildings, you’ll have to do one these things:
 * 1) Build a lipped wall (a wall with overhang, mostly at the top. ▛ and▐▞ are common wall-top profiles).  This lip can have 1-block wide gaps in it, since spiders require a 2 block wide space to climb.
 * 2) Or be less creative and either completely cover it with a roof or dump buckets of lava around your castle.

Spiders can climb cactus fences, but they will suffer some hit damage doing so. Therefore cactus fences only reduce the chances and speed of a spider climbing walls. Either make multiple fences or one fence tall enough to kill any spider that climbs all of them. Each fence only needs to be one row of cacti, because while cacti can’t be placed next to each other, spiders are two blocks wide. Use the method in the section for a version which works on other mobs too. (If you prefer a wall for keeping off all other mobs, you can use this cactus fence)

Skeletons
Skeletons are dangerous because they can fire arrows through gaps in your defenses. Wherever possible, fill open gaps with any of certain translucent blocks such as slabs, fence or glass to make windows.

Additionally, build low walls or fences in places where you may be in range of a skeleton, since they will only fire arrows at you if they can see you.

Thanks to a bug, skeletons can get in a completely enclosed house when the player is sleeping. The only way to prevent this is to stay up all night, but then other hostile mobs might target you.

Spider Jockeys
Spider jockeys are dangerous because of their Skeleton mount. They can climb any block and shoot through glass, so beware of them. You must combine your defensive strategies for both skeletons and spiders. They're pretty rare, so anyone would be surprised if anyone saw  more then one Spider Jockey on the same night!

Zombies
Zombies are the simplest mob to defend against. With limited mobility and no ranged attacks, walls or pits will be enough to keep them at bay.