Spawn

This article is about Spawn Location, 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 east.

It is possible to move the spawn location with the use of a Map Editor, if you do not want to use a map editing program there are limited ways to move the spawn through the use of game mechanics. For example, if the spawn point is occupied by a solid block the player will spawn at the closest 1x1x2 open space directly above the spawn point. This means a player can build a 1x1 tower in the spawn point to move the spawn upward as long as the tower still exists. The spawn location can also be moved horizontally if the player digs four spaces downward from it. However, this will only move the spawn point a few blocks away from the original position; it is not possible, using this method, to dramatically or controllably alter the location of the spawn point.

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

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 as with beds' initial function, all players must be in bed at once.

Mobs
Mobs spawn no closer than 24 blocks (spherical), but no further than a 272 x 272 area around the player's location (within a box of 17 x 17 chunks with the player's current chunk at the center). There is a cap of 200 hostile mobs spawned and 15 passive mobs at any one time. At one point there was a glitch that spawned much more mobs in the chunk between (0,0) and (16,16).

Passive mobs
Passive mobs will spawn in grassy areas with a light level of more than 9. Since Beta 1.6 passive mobs also spawn in darkness. Chickens also have a 1/8 chance of spawning from a thrown egg.

Enemy Mobs
Enemy mobs can spawn on any fully-opaque cube block with a light level of less than 7. They will not spawn if difficulty is set to 'Peaceful', and they never spawn on Glass, Ice, Stone Slabs, or other see-through or non-cube blocks. When half-block high slabs are used to prevent the spawning of hostile mobs in an area, single half slabs must be used. If two half height slabs are stacked one atop another to form a full size block, the surface created by these 'double half slabs' will not prevent the spawning of hostile mobs provided all the other spawn criteria are met. They require a 2 block head room to spawn, although making the room higher and bigger increases their likelihood of spawning. There are also Monster Spawners in dungeons that are a fixed spawn point for enemy mobs.

In The Nether, Ghast and Zombie Pigman spawning is independent of the light level.

Algorithm for spawns
Main Spawn Loop: Load the 289 chunks in a semi random order then go through the following loop until the list is empty or it is broken out of

1) take the first chunk remaining from the list

2) 9/10 chance to skip this chunk and restart the loop with the next chunk, 1/10 chance to continue to next step

3) Chose a mob class at random (for friendlies: pig, cow, chicken, sheep. For hostiles: spider, skeleton,zombie, creeper, slime).

4) Chose a completely random location L1 within the chunk.

5) If L1 is inside a rock or other solid area, bail out of the spawn function completely. Ignore the remaining chunks.

6) If L1 is legal it will be the location of a mob pack, pick 6 locations roughly normally distributed around L1, L(i)

Individual Spawn Loop:

1) Check that current L(i) is unoccupied, has spawnable ground below, and an empty space above.

2) If check fails, get next L(i) and go back to 1.

3) Check that L(i) is 24m+ from (any) player. Also check they are 24m+ from the spawn point. If not, get next L(i) and go back to 1.

4) Prepare mob for spawning (position, orientation, etc).

5) LGT(i) = light level of L(i)

6) (hostile mobs) Roll random R from 0 to 7. If LGT(i) ≤ R, spawn mob at L(i).

7) (friendly mob) If LGT(i) > 8, spawn mob at L(i).

8) If mob class was Spider, roll a random number. 1:100 chance also spawn a skeleton and have it mount the spider.

9) Get next L(i) and go back to 8).

10) When done with all L(i), go back to start of main loop.