Chunk



Chunks are 16 x 16 x 256 segments of the Minecraft worlds.

Generation
Chunks are 16 blocks wide, 16 blocks long, and 256 blocks high, which is 65,536 blocks total. Chunks are generated around players when they first enter the world. As they wander around the world, new chunks are generated as needed. There are a possible fourteen trillion (14,062,500,000,000) real chunks that can be generated. There are 7.46*10244,700 possible chunks, excluding entities.

The exact number of generated chunks varies in single player mode, depending on view distance and movement. In multiplayer mode, a grid with a default inradius of 10 (for a total of 21x21 or 441) chunks is loaded around each player and sent to the player by default, although this can be configured to be between 3 and 15, usually only lowered with a poor connection home server. Chunks within the set range may have activity (mobs spawning, trees growing, water flowing, dropped items disappearing etc.), while chunks outside of this range are inactive, and are stored on the disk (this 'store until needed' memory management is commonly used with procedurally-generated terrain so that the players' computers don't have to track and update hundreds of plants and mobs simultaneously). Chunks will not save again if they were saved in the last 30 seconds.

Slimes can only spawn in specific chunks, determined by a calculation performed on the chunk coordinates. There are a number of utilities and mods which allow the player to tell which chunks they can spawn in; see here for details.

Minecraft's renderer divides a world chunk into sixteen 16x16x16 render chunks, which are compiled OpenGL display lists, to speed up rendering significantly. They need to be rebuilt each time when blocks within these chunks are changed.

Chunks are generated with the help of the map seed, which means that the chunks are always the same if you would use the same seed again, so long as the map generator and version number remains the same.

Spawn chunks
The chunks in the area immediately surrounding the world spawn point are special chunks that are never unloaded from memory as long as at least one player is in the Overworld. This means that things like redstone mechanisms and mob farms will continue to operate even when all players are very far away.

Finding chunk edges


The key can be used to display chunk boundaries.

Alternately, pressing the "F3" button opens the Debug screen which shows the player's X, Y, and Z coordinates, in addition to the "c" variable. These coordinates will change as the player moves around. The player can know which chunk they are in by the variable "c" that is next to both "x" and "z" variables. The number in the brackets specifies how far the player is from the north-western corner of the chunk, so if the "c" beside X was 3(5), and the "c" beside Z was 2(4), then the player is on chunk (3, 2), and is on block (5, 4) from the north-western corner.

X and Z coordinates that are divisible by 16 represent the boundaries between chunks. EG: (96, -32) is a corner where four chunks meet. One of those chunks is between X coordinates 80 to 96 and Z coordinates -48 to -32. Another one is between X coordinates 96 to 112 and Z coordinates -32 to -16, and so on. When either X or Z crosses a multiple of 16, the player is moving across chunks.

Essentially, the player is in the top-left corner (north-western) of a chunk when both x and z coordinates are divisible by 16.

Additionally, the player can know which chunk he is on by this formula: The X of chunk will be Floor( X coordinate / 16 ) The Z of chunk will be Floor( Z coordinate / 16 ) Where Floor is the largest previous integer. E.g. Floor( 27.9561 ) is 27 In other words if X was 27, Z was -15 the chunk will be chunk ( Floor( 27 / 16 ), Floor( -15 / 16 ) ) which means the player is on chunk (1, -1) Also, The player can know how far he is from the north-western corner by this formula: (X or Z coordinate) AND 15

In Pocket Edition, when toggling fancy graphics, the world will render again, loading only the chunk the player is in for a split second. This method is useful for finding chunk boundaries as there will be a clear line visible in that split second.