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
 
(3 intermediate revisions by the same user not shown)
Line 12: Line 12:
**{{nbt|int|zPos}}: Z position of the chunk (in absolute chunks from world {{cd|x|z|d=,}} origin, '''not''' relative to the region).
**{{nbt|int|zPos}}: Z position of the chunk (in absolute chunks from world {{cd|x|z|d=,}} origin, '''not''' relative to the region).
**{{nbt|int|yPos}}: Lowest Y section position in the chunk (e.g. {{cd|-4}} in 1.18).
**{{nbt|int|yPos}}: Lowest Y section position in the chunk (e.g. {{cd|-4}} in 1.18).
**{{nbt|string|Status}}: Defines the world generation status of this chunk. It is always one of the following: {{code|minecraft:empty}}, {{code|minecraft:structure_starts}}, {{code|minecraft:structure_references}}, {{code|minecraft:biomes}}, {{code|minecraft:noise}}, {{code|minecraft:surface}}, {{code|minecraft:carvers}}/{{Code|minecraft:liquid_carvers}}, {{code|minecraft:features}}, {{code|minecraft:light}}/{{Code|minecraft:initialize_light}}, {{code|minecraft:spawn}}, or {{code|minecraft:full}}. All status except {{code|minecraft:full}} are used for chunks called ''proto-chunks'', in other words, for chunks with incomplete generation.
**{{nbt|string|Status}}{{until|je 26.4}}/{{nbt|string|status}}{{upcoming|je 26.4}}: The chunk's world generation status. The possible statuses, in generation order, are {{code|minecraft:empty}}, {{code|minecraft:structure_starts}}, {{code|minecraft:structure_references}}, {{code|minecraft:biomes}}, {{code|minecraft:terrain}}, {{code|minecraft:features}}, {{code|minecraft:initialize_light}}, {{code|minecraft:light}}, {{code|minecraft:spawn}}, and {{code|minecraft:full}}. All status except {{code|minecraft:full}} are used for chunks called ''proto-chunks'', in other words, for chunks with incomplete generation.
**{{nbt|long|LastUpdate}}: Tick when the chunk was last saved.
**{{nbt|long|LastUpdate}}: Tick when the chunk was last saved.
**{{nbt|list|sections}}: List of {{nbt|compound|Compounds}}, each tag is a section (also known as sub-chunk). All sections in the world's height are present in this list, even those who are empty (filled with air).
**{{nbt|list|sections}}: List of {{nbt|compound|Compounds}}, each tag is a section (also known as sub-chunk). All sections in the world's height are present in this list, even those who are empty (filled with air).
Line 18: Line 18:
****{{nbt|byte|Y}}: The Y position of this section.
****{{nbt|byte|Y}}: The Y position of this section.
****{{nbt|compound|block_states}}
****{{nbt|compound|block_states}}
*****{{nbt|list|palette}}: Set of different block states used in this particular section. The vanilla implementation never includes any unused entries upon writing, so this array will never contain more than 4096 entries, and the indices in the data array will be at most 12 bits long. However the vanilla implementation is also able to handle larger palettes when reading.
*****{{nbt|list|palette}}: Set of different block states used in this particular section. The vanilla implementation never includes any unused entries upon writing, so this array will never contain more than 4096 entries, and the indices in the data array will be at most 12 bits long. However the vanilla implementation is also able to handle larger palettes when reading. This may be a list of compounds, or a list of strings if every block represents the default block state.
******{{nbt|compound}} A block
******{{nbt|compound}} A block
*******{{nbt|string|Name}}: Block [[Minecraft:resource location]]
*******{{nbt|string|id}}: Block [[Minecraft:resource location]]
*******{{nbt|compound|Properties}}: List of [[Minecraft:block state]] properties, with {{cd|name}} being the name of the block state property
*******{{nbt|compound|properties}}: List of [[Minecraft:block state]] properties, with {{cd|name}} being the name of the block state property
********{{nbt|string|''Name''}}: The block state's name and its value.
********{{nbt|string|''Name''}}: The block state's name and its value.
*******{{nbt|string}} Block [[Minecraft:resource location]]. This entry may be used instead of the above if it represents the default block state of a block. (The name of this entry is an empty string.)
******{{nbt|string}} Block [[Minecraft:resource location]]
*****{{nbt|long-array|data}}: A packed array of 4096 indices pointing to the palette, stored in an array of 64-bit integers ({{nbt|long|Longs}}).
*****{{nbt|long-array|data}}: A packed array of 4096 indices pointing to the palette, stored in an array of 64-bit integers ({{nbt|long|Longs}}).
******If only one block state is present in the palette, this field is not required and the block fills the whole section.
******If only one block state is present in the palette, this field is not required and the block fills the whole section.
Line 29: Line 31:
*****{{nbt|list|palette}}: Set of different biomes used in this particular section. The vanilla implementation never includes any unused entries upon writing, so this array will never contain more than 64 entries, and the indices in the data array will be at most 6 bits long. However the vanilla implementation is also able to handle larger palettes when reading.
*****{{nbt|list|palette}}: Set of different biomes used in this particular section. The vanilla implementation never includes any unused entries upon writing, so this array will never contain more than 64 entries, and the indices in the data array will be at most 6 bits long. However the vanilla implementation is also able to handle larger palettes when reading.
******{{nbt|string|Name}}: Biome [[Minecraft:resource location]]
******{{nbt|string|Name}}: Biome [[Minecraft:resource location]]
*****{{nbt|long-array|data}}: A packed array of 64 indices pointing to the palette, stored in an array of 64-bit integers ({{nbt|long|Longs}}).
*****{{nbt|long-array|data}}: A packed array of 64{{until|je 26.4}}/4096{{upcoming|je 26.4}} indices pointing to the palette, stored in an array of 64-bit integers ({{nbt|long|Longs}}).
******Biomes in a world are stored in cells of 4×4×4 blocks, and only store 64 individual entries. Biomes at the block level are smoothed based on the cells.{{Info needed}}
******Biomes in a world are stored in cells of 4×4×4 blocks, and only store 64 individual entries. Biomes at the block level are smoothed based on the cells.{{Info needed}}{{until|je 26.4}}
******If only one biome is present in the palette, this field is not required and the biome fills the whole section.
******If only one biome is present in the palette, this field is not required and the biome fills the whole section.
******All indices are the same length: the minimum amount of bits required to represent the largest index in the palette. These indices do not have a minimum size. As with block states, the indices are not packed across multiple elements of the array. Different sections of a chunk can have different lengths for the indices.
******All indices are the same length: the minimum amount of bits required to represent the largest index in the palette. These indices do not have a minimum size. As with block states, the indices are not packed across multiple elements of the array. Different sections of a chunk can have different lengths for the indices.
Line 425: Line 427:
|Added <code>below_zero_retrogen</code> containing data to support below zero generation.
|Added <code>below_zero_retrogen</code> containing data to support below zero generation.
|Added <code>blending_data</code> containing data to support blending new world generation with existing chunks.}}
|Added <code>blending_data</code> containing data to support blending new world generation with existing chunks.}}
|{{HistoryLine||1.20|dev=23w16a|Removed the chunk generation statuses {{code|minecraft:liquid_carvers}} and {{code|minecraft:heightmaps}}. Added {{code|minecraft:initialize_light}}.<ref>Compare the ChunkStatus fields in Fabric's mappings documentation for [https://maven.fabricmc.net/docs/yarn-23w14a%2Bbuild.1/net/minecraft/world/chunk/ChunkStatus.html 23w14a] and [https://maven.fabricmc.net/docs/yarn-23w16a%2Bbuild.6/net/minecraft/world/chunk/ChunkStatus.html 23w16a].</ref>}}
|{{HistoryLine||1.20.2|dev=23w32a|Game no longer uses numeric values when storing mob effects to world. For example, <code>4</code> becomes <code>minecraft:mining_fatigue</code>.|Changed following fields in mob effect instances:
|{{HistoryLine||1.20.2|dev=23w32a|Game no longer uses numeric values when storing mob effects to world. For example, <code>4</code> becomes <code>minecraft:mining_fatigue</code>.|Changed following fields in mob effect instances:
* <code>Id</code> (integer) -> <code>id</code> (string, resource identifier)
* <code>Id</code> (integer) -> <code>id</code> (string, resource identifier)
Line 449: Line 452:
|{{HistoryLine||1.21.5|dev=25w07a|The {{cd|CustomName}} field will no longer be preserved when removed.|The {{cd|LootTable}} field will no longer be preserved when removed.|{{cd|end_gateway}}: The {{cd|exit_portal}} field will no longer be preserved when removed.|{{cd|furnace}}, {{cd|smoker}}, {{cd|blast_furnace}}: The {{cd|RecipesUsed}} field will no longer be preserved when removed.|{{cd|skull}}: The {{cd|note_block_sound}} field will no longer be preserved when removed.}}
|{{HistoryLine||1.21.5|dev=25w07a|The {{cd|CustomName}} field will no longer be preserved when removed.|The {{cd|LootTable}} field will no longer be preserved when removed.|{{cd|end_gateway}}: The {{cd|exit_portal}} field will no longer be preserved when removed.|{{cd|furnace}}, {{cd|smoker}}, {{cd|blast_furnace}}: The {{cd|RecipesUsed}} field will no longer be preserved when removed.|{{cd|skull}}: The {{cd|note_block_sound}} field will no longer be preserved when removed.}}
|{{HistoryLine|||dev=25w09a|{{cd|campfire}}: The {{cd|CookingTimes}} and {{cd|CookingTotalTimes}} fields will no longer be preserved when removed.|{{cd|chiseled_bookshelf}}: The {{cd|last_interacted_slot}} field now defaults to {{cd|-1}} if not specified.|{{cd|hopper}}: The {{cd|TransferCooldown}} field now default to {{cd|-1}} if not specified.|{{cd|jigsaw}}: The {{cd|name}}, {{cd|target}}, and {{cd|pool}} fields now default to {{cd|minecraft:empty}} if not specified, the {{cd|final_state}} field now defaults to {{cd|minecraft:air}} if not specified.|{{cd|sculk_shrieker}}: The {{cd|warning_level}} field now defaults to {{cd|0}} if not specified.|{{cd|structure_block}}: The {{cd|ignoreEntities}} and showboundingbox fields now default to {{cd|true}} if not specified, the {{cd|posY}} field now defaults to 1 if not specified.}}
|{{HistoryLine|||dev=25w09a|{{cd|campfire}}: The {{cd|CookingTimes}} and {{cd|CookingTotalTimes}} fields will no longer be preserved when removed.|{{cd|chiseled_bookshelf}}: The {{cd|last_interacted_slot}} field now defaults to {{cd|-1}} if not specified.|{{cd|hopper}}: The {{cd|TransferCooldown}} field now default to {{cd|-1}} if not specified.|{{cd|jigsaw}}: The {{cd|name}}, {{cd|target}}, and {{cd|pool}} fields now default to {{cd|minecraft:empty}} if not specified, the {{cd|final_state}} field now defaults to {{cd|minecraft:air}} if not specified.|{{cd|sculk_shrieker}}: The {{cd|warning_level}} field now defaults to {{cd|0}} if not specified.|{{cd|structure_block}}: The {{cd|ignoreEntities}} and showboundingbox fields now default to {{cd|true}} if not specified, the {{cd|posY}} field now defaults to 1 if not specified.}}
|{{HistoryLine||26.3|dev=snap7|Block palette fields <code>Name</code> and <code>Properties</code> renamed to <code>id</code> and <code>properties</code>, respectively. The block properties may be elided if it is the default block state. A palette may also be a list of strings, instead of compounds. When the palette is a list of compounds, an entry may contain only an empty key and the block resource location.}}
|{{HistoryLine|||dev=snap10|The chunk generation statuses {{code|minecraft:noise}}, {{code|minecraft:surface}}, and {{code|minecraft:carvers}} have been replaced by {{code|minecraft:terrain}}.<ref>The change is not documented in the changelog, but does appear in the code. https://mcsrc.dev/2/diff/26.3-snapshot-10/26.3-snapshot-9/net/minecraft/world/level/chunk/status/ChunkStatus.</ref>}}
|{{HistoryLine|java upcoming}}
|{{HistoryLine||26.4|dev=snap1
|Biomes are now stored for each block space instead of in cells of 4x4x4 blocks.
|Renamed {{cd|Status}} field in chunks to {{cd|status}}.
}}
}}
}}



Latest revision as of 11:04, 5 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:区块存储格式