Spawn

''This article is about natural spawning of players and mobs. For Monster Spawners see: Monster Spawner.''

Spawning refers to players and mobs being created and placed in the game world. Players will respawn on their spawn point upon death.

Spawn Point
Every world created has a spawn point which is generally located somewhere near coordinates x=0.5, z=0.5 and the highest possible Y by default, although sometimes the spawn will glitch up and you can be spawned in a cave, as in the seed "3666440496532277820" (tested) where you spawn inside a spider dungeon. The player's first view of the map will be from the spawn point, facing north.

The spawn point can be moved by sleeping in a bed. If a player has slept in any beds, they will spawn next to the last one that they slept in.

Players can find their spawn point in game by using a compass, or simply by dying and seeing where they show up.

In Beta multiplayer, rather than spawning on top of a single spawn block, players will instead spawn on top in a spawn area of around 20x20 tiles. The spawn area along with a 13 tile border is classed as a protected area, this means non-operator players cannot place or destroy blocks in this protected area nor can they use doors or Redstone devices. Creepers can still destroy terrain in the protected area and TNT placed outside of the protected area will destroy surrounding blocks as usual. The protected area is 46x46 tiles and the spawn area(20x20 tiles) is in the center of this area. It is possible to spawn on top of a tree, in water, or very rarely in lava.

In Beta 1.4, sleeping in a bed will reset your spawn point to that bed when you awake from them naturally at dawn. If the bed at which you have set your spawn point last is removed, your spawn point reverts to its original location (somewhere near x=0,z=0). The same applies to multiplayer, but clicking "Leave Bed" still resets the spawn point.

Mob Packs
Mobs spawn in packs of up to 4, all of the same type. Wolves can spawn in packs of 8 and Ghasts always spawn alone. Ghasts and Zombie Pigman packs spawn only in the Nether. All other mob packs spawn only in the Overworld. Wolf packs spawn only in forest and taiga Biomes.

There is a cap of 79 hostile mobs, 16 passive mobs, and 5 water mobs (Squid) alive at any one time. While one of these caps is exceeded, no mob packs in the respective category will spawn.





Every game tick (1/20th of a second), the spawning algorithm tries to spawn a pack of mobs in each chunk of the 17x17 chunk (272x272 block) area centered on the player. In each chunk, a random location is chosen to be the center point of the pack. All mobs in the pack will spawn within a 11x1x11 block area centered at that location (that's a 11x11 square that is one block high). Mobs will spawn with the lowest part of their body inside this area.

For a pack to spawn at all, the center block must be the same "material" as the mob -- water for water mobs and air for all other mobs. Note that in the latter case, it must literally be an air block. Any other block, even a non-colliding one, will prevent the entire pack from spawning.

Further conditions must be met to spawn each individual mob in a pack. Though a pack can contain no more than 4 mobs, up to 12 attempts are made to find suitable locations for them to spawn. For each attempt, a random block is chosen within the 11x1x11 area. Blocks close to the center have a higher chance of being chosen. The spawn attempt succeeds if and only if all of the following conditions are met:


 * There must be no players within a 24 block distance (spherical) of the spawning block


 * If it's a water mob, then...
 * the spawning block must contain liquid (water or lava)
 * the spawning mob must not be obstructed by other mobs


 * If it's not a water mob, then...
 * the spawning block itself must be non-opaque and non-liquid
 * the block directly below it must be opaque
 * the block directly above it must be non-opaque
 * unless it's a Slime, the spawning mob must not be obstructed by blocks, other mobs, or water


 * If it's a passive mob other than Squid, then...
 * the block directly below the spawning block must be grass
 * the light level of the spawning block must be 9 or brighter


 * If it's a hostile mob other than a Slime, Zombie Pigman, or Ghast, then...
 * the light level of the spawning block must be 7 or darker and more light increases the chance that the spawn will fail
 * sunlight falling on the spawning block further increases the chance that the spawn will fail, by up to 50%


 * If it's a Slime, then...
 * the spawning block must be in a chunk eligible to spawn slimes (see the Slime page for details)
 * the spawning block must be below level 16
 * for medium and large slimes, the difficulty must not be set to peaceful
 * there is an additional 90% chance the spawn will fail, thus slimes only spawn 1/10th as often as other mobs, all other things being equal


 * If it's a Ghast, then there is a 95% chance the spawn will fail, thus ghasts only spawn 1/20th as often as other mobs

If all of these conditions are met then the mob is spawned. The pack is complete when its maximum size is reached or 12 attempts have been made, whichever comes first.

Detailed Pack Spawning Algorithm
This pseudo-code is derived straight from the decompiled source of Minecraft Beta 1.7.3

for each mob category (hostile, passive, water) { if the mob cap has been reached for this category, skip to the next category

for each of the 289 chunks in the 17x17 area centered on the player, in random order { get the biome type for this chunk get the weighted list of mob types that can spawn in that biome use those weights to choose a random mob type from the list

choose a random block location in this chunk, as the "base" block of a pack if the block at that location is opaque, skip to the next chunk if the current mob category and the block do not have the same "material" then, skip to the next chunk

make 12 attempts to spawn mobs in the pack { start with the spawn block at the same location as the base block add random numbers from 0 to 5 to both x and z     subtract random numbers from 0 to 5 from both x and z (this skews towards the center)

if the current mob category is water then { if the spawn block is not liquid or the block above it is opaque, the spawn attempt fails } otherwise { if the spawn block is opaque or liquid or          the block above it is opaque or           the block below it is not opaque, the spawn attempt fails }

if any player is within 24 block lengths of the center of the spawn block, the spawn attempt fails

choose a random direction that the spawned mob will face if any conditions specific to the mob type are not met, the spawn attempt fails { chicken, cow, pig, sheep, wolf: block below spawning block is grass spawning block has light level 9 or higher

creeper, zombie, skeleton, spider: sunlight level of spawning block is less or equal to a random number from 0 to 31 light level of block is less or equal to a random number from 0 to 7

slime: difficulty is not set to peaceful or slime size is small spawn block y coordinate is less than 16 the chunk containing the spawn block is a slime chunk (1 in 10 chance) pass a 1 in 10 random test ghast: pass a 1 in 20 random test squid: must not collide with any other entities

all except squid: must not collide with any other entities must not collide with any blocks must not collide with water }

spawn the mob

if the mob is a spider and a 1 in 100 random test passes, turn it into a spider jockey

if the mob is a sheep, give it a random color if the mob pack is full (1 ghast, 8 wolves, or 4 of any other mob), skip to the next chunk } } }

Other Types of Spawning
A Monster Spawner causes hostile mobs to spawn constantly in any nearby darkness.

A thrown egg has a 1 in 8 chance of spawning a chicken.