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, since water can break such things away. If you are unlucky, you can also be washed 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, it could collapse. Horror scenario: You collapse a sand column supporting a torch in your home, and when you come back, a creeper awaits you, which spawned in the darkness…

If you instead 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 next to it, it will remember 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 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.)

Creepers
The single most dangerous mob is the creeper, because of the 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 explode from one block away, even if there is a low wall or fence keeping them away, as long as they can see you through open air. An obvious way to avoid this is to build a wall at least two full blocks high (even if it is glass), or build your home underground.

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 stone.

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 of 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) Build a cactus fence. This just requires 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)
 * 3) Or be less creative and dump buckets of lava around your castle.

Skeletons
Skeletons are dangerous because they can fire arrows through gaps in your defenses. Wherever possible, fill open gaps with 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.