Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Chunk format: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
Line 39: Line 39:
**{{nbt|list|block_entities}}: Each {{nbt|compound|Compound}} in this list defines a block entity in the chunk.
**{{nbt|list|block_entities}}: Each {{nbt|compound|Compound}} in this list defines a block entity in the chunk.
***See [[Minecraft:Block entity format]].
***See [[Minecraft:Block entity format]].
**{{nbt|compound|CarvingMasks}}: Only for ''proto-chunks'' '''(not confirmed for 1.18 format)'''.
***{{nbt|byte-array|AIR}}: A series of bits indicating whether a cave has been dug at a specific position, stored in a byte array.
***{{nbt|byte-array|LIQUID}}: A series of bits indicating whether an underwater cave has been dug at a specific position, stored in a byte array.
**{{nbt|compound|Heightmaps}}: Several different [[Minecraft:heightmap]]s corresponding to 256 values compacted at 9 bits per value (lowest being 0, highest being 384, both values inclusive). The 9-bit values are stored in an array of 37 {{nbt|long|Longs}}, each containing 7 values ({{nbt|long|A Long}} = 64 bits, 7×9 = 63; the last bit is unused). In versions prior to 1.16 the heightmaps were stored in 36 {{nbt|long|Long}} values, where the bits were arranged in an uninterrupted "stream" across all values, resulting in all 2304 bits being used. The 9-bit values are unsigned, and indicate the amount of blocks above the bottom of the world. This means that converting a world to 1.18 adds 64 to every value.
**{{nbt|compound|Heightmaps}}: Several different [[Minecraft:heightmap]]s corresponding to 256 values compacted at 9 bits per value (lowest being 0, highest being 384, both values inclusive). The 9-bit values are stored in an array of 37 {{nbt|long|Longs}}, each containing 7 values ({{nbt|long|A Long}} = 64 bits, 7×9 = 63; the last bit is unused). In versions prior to 1.16 the heightmaps were stored in 36 {{nbt|long|Long}} values, where the bits were arranged in an uninterrupted "stream" across all values, resulting in all 2304 bits being used. The 9-bit values are unsigned, and indicate the amount of blocks above the bottom of the world. This means that converting a world to 1.18 adds 64 to every value.
***{{nbt|long-array|MOTION_BLOCKING}}
***{{nbt|long-array|MOTION_BLOCKING}}
Line 49: Line 46:
***{{nbt|long-array|WORLD_SURFACE}}
***{{nbt|long-array|WORLD_SURFACE}}
***{{nbt|long-array|WORLD_SURFACE_WG}}
***{{nbt|long-array|WORLD_SURFACE_WG}}
**{{nbt|list|Lights}}: A List of 16 lists that store positions of light sources per chunk section as shorts, only for ''proto-chunks'' '''(not confirmed for 1.18 format)'''.
**{{nbt|list|entities}}: A list of entities in the ''proto-chunks'', used when generating. This list is not present for fully generated chunks and entities are moved to a separated region files once the chunk is generated; see [[Minecraft:Entity format#Entity Format|Entity format]] for more details. Before [[Minecraft:20w45a]], it contained all the entities in the chunk. In [[Minecraft:21w43a]] this was renamed from "Entities".
**{{nbt|list|entities}}: A list of entities in the ''proto-chunks'', used when generating. This list is not present for fully generated chunks and entities are moved to a separated region files once the chunk is generated; see [[Minecraft:Entity format#Entity Format|Entity format]] for more details. Before [[Minecraft:20w45a]], it contained all the entities in the chunk. In [[Minecraft:21w43a]] this was renamed from "Entities".
***{{nbt|compound}}: An entity.
***{{nbt|compound}}: An entity.

Latest revision as of 11:07, 25 October 2026

Template:Update Minecraft:Chunks store the terrain and entities within a 16×384×16 area in the Minecraft:Overworld, and 16×256×16 in Minecraft:the Nether and Minecraft:the End by default. They also store precomputed lighting, heightmap data for Minecraft's performance, and other meta information.

NBT structure

Template:See also

Chunks are stored as tags in regional Minecraft Anvil files, which are named in the form Template:Code. They are stored in Minecraft:NBT format, with the following structure (updated for 1.18):

Block format

In the Anvil format, block positions are ordered YZX for compression purposes.

The coordinate system is as follows:

  • X increases East, decreases West
  • Y increases upward, decreases downward
  • Z increases South, decreases North

This means indices are ordered like in a book, with its top to the North, read from beneath and with words written backward: each letter is a different X-index, each line a Z-index, and each page a Y-index. In case of a flat 2D array, the Y-index is omitted, and the array reads like a single page.


Each section is a 16×16×16-block area, with up to 16 sections in a chunk : from 0 at the bottom, to 15 on top. Empty sections are not saved. Each section has a "Y" byte for its Y-index (0 to 15), a "Palette" list linking IDs to block states, and a "BlockStates" long array storing the IDs per block location, compressed by fitting multiple IDs inside each entry (see NBT_structure above for details on the compression). There might be an additional section at the top and or bottom of the world used to store light, so that light travels properly over and under the world limits.

The pseudo-code below shows how to access individual block information from a single section.

byte Nibble4(byte[] arr, int index){
	return index%2 == 0 ? arr[index/2]&0x0F : (arr[index/2]>>4)&0x0F;
}
int BlockPos = y*16*16 + z*16 + x; 
compound Block = Palette[change_array_element_size(BlockStates,Log2(length(Palette)))[BlockPos]];
string BlockName = Block.Name; 
compound BlockState = Block.Properties; 
byte Blocklight = Nibble4(BlockLight, BlockPos); 
byte Skylight = Nibble4(SkyLight, BlockPos);

Tile tick format

Tile Ticks represent block updates that need to happen because they could not happen before the chunk was saved. Examples reasons for tile ticks include redstone circuits needing to continue updating, water and lava that should continue flowing, recently placed sand or gravel that should fall, etc. Tile ticks are not used for purposes such as leaf decay, where the decay information is stored in the leaf block data values and handled by Minecraft when the chunk loads. For map makers, tile ticks can be used to update blocks after a period of time has passed with the chunk loaded into memory.

  • Template:Nbt A Tile Tick <section begin="tile tick format" />
    • Template:Nbt: The ID of the block; used to activate the correct block update procedure.
    • Template:Nbt: If multiple tile ticks are scheduled for the same tick, tile ticks with lower p are processed first. If they also have the same p, the order is unknown.
    • Template:Nbt: The number of ticks until processing should occur. May be negative when processing is overdue.
    • Template:Nbt: X position
    • Template:Nbt: Y position
    • Template:Nbt: Z position <section end="tile tick format" />

ToBeTicked format

This Template:Nbt is always present, and contains 16 Template:Nbt, each representing one of the "sections" of the chunk. Those inside lists may contain Template:Nbt, each representing a packed coordinate relative to the section : The 4 most significant bits are always 0, then each group of 4 bits (or nibble) represents a section-relative coordinate, from 0 to 15. The order of sections in the list appear to be ordered from bottom to top, and the packing order of the coordinates is Template:Cd, where Template:Cd refers to the chunk section. When converting proto-chunks to full chunks, only coordinates that are stored in PostProcessing appear to receive a tick update, tick updates stored in Template:Cd are ignored. Template:Verify

History

Template:Needs update Template:See also

Template:HistoryTable

Navigation

Template:Navbox Java Edition technical

Minecraft:de:Chunkdaten Minecraft:fr:Format de chunk Minecraft:ja:Chunkフォーマット Minecraft:ko:청크 형식 Minecraft:nl:Segment formaat Minecraft:pt:Formato de chunk Minecraft:ru:Формат чанка Minecraft:uk:Формат чанку Minecraft:zh:区块存储格式