Skip to main content

Chunks

Chunks, What are they?

Chunks are 16x16 partitions of space on a Minecraft world that the game will load individually around a player or based on certain conditions. The reason why this is done is because the game is 30 million blocks by 30 million blocks big and loading all that at once would be take an extremely large amount of computation. There are a few differences in chunks that dictate what they can and cannot do, these differences are very important to memorize if you want to get into technical Minecraft.

Chunk States/Types

There is a variety of chunks which do certain things these include:

Subchunks

Subchunks are 16x16x16 subdivisions of a given chunk to improve load times and to help prevent the game from loading things that don't need to be. Subchunks divide the parent chunk along the vertical axis and inherits the load state of it. A given Subchunk may determine very small things and is mostly related to client side rendering. The reason why Subchunks exist is to try and avoid storing an entire chunk in a single giant array and prevent unneeded lag for the same reason chunks exist. 

Chunk Codes

Bedrock edition defines a given chunk by an internal assigned code system; these are used to keep track of what chunk state a given chunk is in.

Chunk State Byte Code
Unloaded 0x0000
Generating 0x0001
Generated 0x0002
PostProcessing 0x0003
PostProccessed 0x0004
CheckForReplacementData 0x0005
NeedLighting 0x0006
Lighting 0x0007
LightingFinished 0x0008
Loaded 0x0009
Invalid -1

World Generation

When a chunk is generated for the first time, it looks at the seed and generates terrain deterministically with a pseudo-random algorithm based on it. This terrain can be found again in a new world of the same seed because of it being deterministic. 

Structures generate based on chunks as well and their position in a chunk it loads is often predictable.

  • Buried Treasure: Southwest block of the chunk's center four blocks.
  • Pillager Outpost: Southeast corner of the chunk.
  • Stronghold Spiral Staircase (Stronghold start structure): Northwest corner of the chunk
  • Temple: Northeast corner of the chunk.
  • Ruins: Center of the chunk.
  • Mineshaft Starter: Northwest corner of the chunk.
  • Amethyst Geode: Northwest corner of the chunk.
  • Ruined Portal: Structure loading will start in northwest corner of a chunk but bleed into a random direction.
  • End Fountain: (0, 64, 0) or Northwest corner of the chunk.
  • End City: Southeast block of the chunk's center four blocks.
  • Ocean Monument: Center of the chunk.
  • Mansion Entrance: Southeast block of the chunk's center four blocks.
  • Fortress Starting Intersection: Southeast block of the chunk's center four blocks.
  • Igloo: Structure loading will start in northwest corner of a chunk but bleed into a random direction.
  • Witch Hut: Northwest corner.

Not all structures in Minecraft generate in a perfectly predictable way.

Per-Chunk Processing

Chunks may process some things separately from each other and knowing about these discrepancies can save you headaches when building a machine. Chunks will process all events it can within one chunk before starting on the events in another making it so that each chunk executes at different times. Ticking areas have priority in this and will always be executed before any other chunks allowing you to determine which cross-chunk event will happen first. (E.g, two pistons extending into the same tile) This order is predictable and changes every 20 ticks, so if you know what order the chunks are in for the 1st tick you will also know the order for the next 19 but not anything after. Chunks also have their own independent pending tick queue and will only process pending ticks within the borders of its own chunk.