Various different constructions can confine different types of Mobs.

To date, no method has been found to prevent mobs from spawning inside a fenced-in area. However, proper placement of Turrets can help eliminate any that do appear. Also, mobs have not been found to spawn underground (except perhaps in Astronaut Lairs), so an arbitrarily large underground base can be built, with just a small entrance area which is surrounded by a suitable "fence".

To confine Astronauts, a wall 5 or more blocks high is needed. However the bottom three blocks can be mined out anywhere you want to create doorways. You can even mine out the bottom 3 blocks all the way along the wall (leaving a 2-block wall hovering 3 blocks above the ground). There is a lot more on astronauts in the user article Astronaut Wrangling.

The Brown Mob can jump 4 blocks, so a 5-block wall is needed to hold it in. However, it travels close to the ground most of the time, so it can get through a door built at ground level, like the astronaut wall just described. That means you can build a wall that holds in Astronauts and lets Brown Mobs through.

The Green Mob can jump a little higher than the brown mob, so an even higher fence is needed for it.

To confine a Space Giraffe, two blocks high is sufficient. It has been noted that Astronauts tend to move randomly and settle at the bottom of slopes. Giraffes, on the other hand, tend to pick a direction and try to move in that same direction for quite a while. Thus, giraffes can go uphill for a while (in steps of one block at a time), while astronauts will tend to move randomly and stumble towards the bottom end of the slope -- offering possibilities for ways to separate one from the other.

The Blue I is the rarest of the mobs. Like the giraffe, it can only jump one block high. However, it teleports just after stealing items from the player, and therefore is probably able to get past any wall during that teleport.

Turrets are non-moving Mobs, and like all mobs, you cannot occupy the same space as a turret. Most mobs move, so the fact that you can't stand on top of them is not particularly useful. However, since a turret is a non-moving mob it can be used to make a sort of fence. The effective "height" of a turret for these purposes is about 3 1/2 blocks high. Thus, if a turret is placed somewhere, and a block built above the turret, the player cannot walk onto the space on top of that block (or even another block higher). One can also create "trap zones" near turrets, where the player (and possibly mobs) get trapped inside a block. For details, see Turret#Exclusion_Zones.


Player cannot stand on any red or yellow block in this structure

Earlier Notes by User:SSgeek

This is what I mean:

Turret-fence-1 (original here: [1])

There seems to be a invisible force pushing you away:

Turret-fence-2 (original here: [2])

How to make it:

Turret-fence-3 (original here: [3])