Spawn chunk

Introduction
A Spawn Chunk is a chunk within the area surrounding the world spawn point. These chunks are special in that they will not be unloaded from memory, regardless of how far away a player moves, so long as there is at least one player in the Overworld.

Behavior
Normally only the chunks immediately surrounding a player are loaded into memory. As the player moves through the game world, new chunks that come into range are loaded into memory and older chunks that are out of range are unloaded and saved to the disk. When a chunk is unloaded, all processing in that chunk stops. This means, for instance, that redstone machines and iron golem farms will only work if a player is nearby. This can make effective farming difficult when the player spends a lot of time exploring or in another dimension. Since spawn chunks do not get unloaded, they continue to process events, even when no players are nearby. Be careful when resetting the worldspawn (with the command  ). Setting it to a place that gets bad lag (the Far Lands for example, or an area with a ton of redstone clocks) will cause that lag to be present no matter where you are.

Events processed in distant spawn chunks
The following events will occur without interruption in spawn chunks, regardless of player location in the Overworld.


 * Liquids and Fire: Fire, water and lava will spread normally. Lava can start fires on nearby flammable objects.


 * Entities: Dropped items will fall and can be moved by water or destroyed by lava and will despawn after 5 minutes if not picked up by a player or collected by a hopper.


 * Mechanisms: Minecarts, hoppers, dispensers and redstone mechanisms will all operate normally. Minecarts will travel around and trigger detector and activator rails. Pistons will extend and retract. Additionally, the normal 128 block vertical transmission limitation on redstone signals is ignored in spawn chunks. That is, a redstone signal can be transmitted from bedrock up to the full build height of y=256.


 * Villages: Villages can be created and deleted as villagers move about and doors are broken. Iron golems will spawn and villagers will breed if all other conditions are met.


 * Passive mobs: Baby animals and villagers will grow into adults. Sheep will eat grass and grow wool.


 * Falling blocks: Sand and gravel will fall if the block below is moved or destroyed.


 * TNT: Primed TNT will fall and explode. However, if the explosion reaches into an unloaded chunk, no blocks in the unloaded chunk will be affected. Additionally, if primed TNT is launched into an unloaded chunk, it will freeze and not explode until that chunk is loaded.

Events not processed in distant spawn chunks
Several game events require that a player be within the chunk update range, in addition to having the chunk loaded into memory. (The chunk update range varies with view range and memory settings in single player mode and is admin-configurable on multiplayer servers.) The following events will not occur in a spawn chunk unless the player is within the chunk update range.


 * Plant Growth and Decay: Plants (including crops, mushrooms, sugar cane, cacti, and saplings) do not grow and leaves will not decay unless a player is in range.


 * Hostile Mobs: Hostile mobs will instantly despawn if they spawn more than 128 blocks from any player. This includes zombie pigmen at Nether portals and witches in witch huts. Additionally, hostile mobs will stand still and not move if they are more than 32 blocks from any player.


 * Passive Mob Spawning: Passive mobs will not spawn naturally more than 240 blocks away from a player. However, the friendly mob spawn cap is limited by the number of friendly mobs loaded into memory. This means that any friendly mobs present in the spawn chunks count towards the mob cap and will usually prevent friendly mobs from naturally spawning anywhere else in the world. The only exception is when passive mobs spawn as part of a newly generated chunk.


 * Ice: ice does not form or melt unless the player is within range.


 * Block Spread: Grass and mycelium will not spread unless a player is in range.

Spawn chunks and other dimensions
All Overworld chunks (including the spawn chunks) are unloaded 60 seconds after the last player in the Overworld enters another dimension (the Nether or the End). This means that spawn chunks stop working if the player spends a lot of time away from the Overworld. However, if an item is tossed into a nether portal from the Overworld, this 60 second timer is reset, and the spawn chunks remain loaded and active.

One method of keeping spawn chunks loaded, even when all players are in other dimensions, is to create a redstone mechanism in a spawn chunk that causes a dispenser to throw an item into a nether portal every 45 seconds. Since the 60 second threshold is never reached, the spawn chunks are never unloaded.

Finding spawn chunks
The spawn chunks usually consist of an area of 16×16 chunks centered as close as possible to the world spawn point. Entities are only active if all chunks in an area of 5×5 chunks around them are loaded, limiting their activities to an area of 12×12 chunks. The exact rule includes chunks whose center is less than or equal to 128 blocks away from the world spawn along both axes. In the rare case where the world spawn is located at the exact center of a chunk, 17 chunks will be loaded along that axis, of which 13 activate entities.

There are several—sometimes elaborate—ways to determine the world spawn point:
 * A compass will point to the spawn point.
 * The following will only work for players not connected to a bed:
 * In Adventure mode, the northwest corner of the block players spawn on is the world spawn point.
 * In Creative, Spectator, and Survival mode, players spawn on a random block in a 20×20 box centered on the spawn point. The spawn point can be inferred by repeatedly respawning and keeping track of the smallest rectangle encompassing all blocks players have spawned on so far. If the rectangle spans between a < b on the x-axis, the spawn point can be on any integer x between b − 10 ≤ x ≤ a + 10 with equal probability. Likewise for the z-axis. Once the rectangle has grown to 20×20 blocks, the spawn point is its center exactly.
 * Entities other than players falling into the exit portal in the End will land on the spawn point exactly. Items thrown in will mark the spot in the Overworld. Players will spawn like they normally do, allowing this to be used to perform the above without dying.
 * A new spawn point can be set using /setworldspawn. If no coordinates are provided, the northwest corner of the block the player is currently standing on will become the spawn point. Note that this will not load the new spawn chunks; it merely prevents them from unloading. The chunks can be loaded by walking into range or restarting the server. They will then remain loaded until the spawn point is moved again.
 * A mod or external program such as NBTexplorer or MCEdit can also be used to find and set the world spawn point.