Chunk format


Info

Chunks Visualization of the ground portion of a single chunk. The entire chunk extends up to a height of 256. Chunks are 16 × 16 × 256 segments of the Minecraft worlds. Contents 1 Generation 1.1 minecraft store the terrain and entities within a 16ℂₗ256ℂₗ16 area. They also store precomputed lighting, heightmap data for Minecraft`s performance, and other meta information.

NBT structure

See also: Information from the Anvil format page

Chunks are stored in NBT See the NBT file format. For using NBT in commands, see Tutorials/Command NBT Tags. The Named Binary Tag format is used by Minecraft for the various files in which it saves data. minecraft format, with this structure (see Block Format below for the ordering of the blocks within each array):


  • The root tag.

    • DataVersion: Version of the chunk NBT structure.

    • Level: Chunk data.

      • xPos: X position of the chunk.

      • zPos: Z position of the chunk.

      • LastUpdate: Tick when the chunk was last saved.

      • LightPopulated: 1 or 0 (true/false) - If true, the server/client has already calculated lighting values for this chunk after generation.

      • TerrainPopulated: 1 or not present (true/false) indicate whether the terrain in this chunk was populated with special things. (Ores, special blocks, trees, dungeons, flowers, waterfalls, etc.) If set to zero then Minecraft will regenerate these featuresSpecial attraction in the blocks that already exist.

      • V: Currently always saved as 1 and not actually loaded by the game. Likely a chunk version tag.

      • InhabitedTime: The cumulative number of ticks players have been in this chunk. Note that this value increases faster when more players are in the chunk. Used for regional difficulty: increases the chances of mobs spawning with equipment, the chances of that equipment having enchantments, the chances of spiders having potion effects, the chances of mobs having the ability to pick up dropped items, and the chances of zombies having the ability to spawn other zombies when attacked. Note that at values 3600000 and above, regional difficulty is effectively maxed for this chunk. At values 0 and below, the difficulty is capped to a minimum (thus, if this is set to a negative number, it will behave identically to being set to 0, apart from taking time to build back up to the positives). See Regional Difficulty for more specifics.

      • Biomes: May not exist. 256 bytes of biome data, one byte for each vertical column in the chunk. See Data Values for biome IDs. If this tag does not exist it will be created and filled by Minecraft when the chunk is loaded and saved. If any values in this array are -1, Minecraft will also set them to the correct biome.

      • HeightMap: 1024 bytes(256 TAG_Int) of heightmap data. 16 ⃗ 16. Each byte records the lowest level in each column where the light from the sky is at full strength. Speeds computing of the SkyLight.

      • Sections: List of Compound tags, each tag is a sub-chunk of sorts.

        • An individual Section.

          • Y: The Y index (not coordinate) of this section. Range 0 to 15 (bottom to top), with no duplicates but some sections may be missing if empty.

          • Blocks: 4096 bytes of block IDs defining the terrain. 8 bits per block, plus the bits from the below Add tag.

          • Add: May not exist. 2048 bytes of additional block ID data. The value to add to (combine with) the above block ID to form the true block ID in the range 0 to 4095. 4 bits per block. Combining is done by shifting this value to the left 8 bits and then adding it to the block ID from above.

          • Data: 2048 bytes of block data additionally defining parts of the terrain. 4 bits per block.

          • BlockLight: 2048 bytes recording the amount of block-emitted light in each block. Makes load times faster compared to recomputing at load time. 4 bits per block.

          • SkyLight: 2048 bytes recording the amount of sunlight or moonlight hitting each block. 4 bits per block.

      • Entities: Each TAG_Compound in this list defines an entity in the chunk. See Entity Format below. If this list is empty it will be a list of End tags (before 1.10, list of Byte tags).

      • TileEntities: Each TAG_Compound in this list defines a block entity in the chunk. See Block Entity Format below. If this list is empty it will be a list of End tags (before 1.10, list of Byte tags).

      • TileTicks: May not exist. Each TAG_Compound in this list is an "active" block in this chunk waiting to be updated. These are used to save the state of redstone machines, falling sand or water, and other activity. See Tile Tick Format below. This tag may not exist.

Videos

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 upwards, decreases downwards
  • Z increases South, decreases North

This also happens to yield the most natural scan direction, because all indices in the least significant dimension (i.e. X in this case) appear for each index in the next most significant dimension; so one reads an array ordered YZX as one would a book lying with its top northward, all letters (or X-indices) on a single line (or Z-index) at a time, and all lines on a single page (or Y-index) at a time. For the 2D arrays (i.e. "Biomes" and "HeightMap") the inapplicable Y dimension is simply omitted, as though the book is only one page thick.

Each section in a chunk is a 16x16x16-block area, with up to 16 sections in a chunk. Section 0 is the bottom section of the chunk, and section 15 is the top section of the chunk. To save space, completely empty sections are not saved. Within each section is a byte tag "Y" for the Y index of the section, 0 to 15, and then byte arrays for the blocks. The "Block" byte array has 4096 partial block IDs at 8 bits per block. Another byte array "Add" is used for block with IDs over 255, and is 2048 bytes of the other part of the 4096 block IDs at 4 bits per block. When both the "Block" and "Add" byte arrays exist, the partial ID from the "Add" array is shifted left 8 bits and added to the partial ID from the "Blocks" array to form the true Block ID. The "Data" byte array is also 2048 bytes for 4096 block data values at 4 bits per block. The "BlockLight" and "SkyLight" byte arrays are the same as the "Data" byte array but they are used for block light levels and sky light levels respectively. The "SkyLight" values represent how much sunlight or moonlight can potentially reach the block, independent of the current light level of the sky.

The endianness of the 2048-byte arrays (i.e. "Add," "Data," "BlockLight," & "SkyLight"), which give only 4 bits per block, seems to stand as the one anomalous exception to the otherwise consistent, format-wide standard of big-endian data storage. It also runs counter to the presumably natural human-readable printing direction. If the blocks begin at 0, they are grouped with even numbers preceding odd numbers (i.e. 0 & 1 share a byte, 2 & 3 share the next, etc.); under these designations Minecraft stores even-numbered blocks in the least significant half-byte, and odd-numbered blocks in the most significant half-byte. Thus block0 is byte0 at 0x0F, block1 is byte0 at 0xF0, block2 is byte1 at 0x0F, block3 is byte1 at 0xF0, etc. ...

The pseudo-code below shows how to access individual block information from a single section. Hover over text to see additional information or comments.

 byte Nibble4(byte arr, int index){ return index%2 == 0 ? arrindex/2&0x0F : (arrindex/2>>4)&0x0F; } int BlockPos = y*16*16 + z*16 + x; byte BlockID_a = BlocksBlockPos; byte BlockID_b = Nibble4(Add, BlockPos); short BlockID = BlockID_a + (BlockID_b ; byte BlockData = Nibble4(Data, BlockPos); byte Blocklight = Nibble4(BlockLight, BlockPos); byte Skylight = Nibble4(SkyLight, BlockPos); 

Entity format

Every entity A player standing in front of a large group of entities The hitboxes of several entities. Note the blue line which points to the direction the entity is "facing." Entities encompass all dynamic, moving objects minecraft is an unnamed
TAG_Compound contained in the Entities list of a chunk file. The sole exception is the Player entity, stored in level.dat In Minecraft 1.0, each level is its own folder. A level folder is often identified by having a level.dat file, along with other subfolders to store the maps and regions of the level. Level folders , or in .dat .dat files are used by servers to store the state of individual players. The format is also used within level.dat files to store the state of the singleplayer player, which overrides any .dat files with minecraft files on servers. All entities share this base:

id Pos Motion Rotation FallDistance Fire Air OnGround Dimension Invulnerable PortalCooldown UUIDMost UUIDLeast UUID CustomName CustomNameVisible Silent Riding CommandStats SuccessCountObjective SuccessCountName AffectedBlocksObjective AffectedBlocksName AffectedEntitiesObjective AffectedEntitiesName AffectedItemsObjective AffectedItemsName QueryResultObjective QueryResultName


  • Entity data

Mobs

Mob Entities
Entity ID Name
bat Bat Bat Health points 6 () Size Height: 0.9 Blocks Width: 0.5 Blocks Spawn Below layer 63 Light level of 3 or less in neighboring blocks Oct. 20 – Nov. 3: light level of 6 or minecraft
blaze Blaze Blaze Health points 20 () Attack strength Fireball: 5 () Contact: Easy: 4 () Normal: 6 () Hard: 9 () Size Height: 1.8 Blocks Width: 0.6 Blocks Spawn Nether Fortresses, light level of 11 or minecraft
cave_spider Cave Spider Cave Spider Health points 12 () Attack strength Easy: 2 () Normal: 2 () Hard: 3 () Venom: 1 () per 1.25 sec Hard: for 15 sec () Normal: for 7 sec () Size Height: minecraft
chicken Chicken Chicken Health points 4 () Size Adult: Height: 0.7 Blocks Width: 0.4 Blocks Baby: Height: 0.35 Blocks Width: 0.2 Blocks Spawn Solid surfaced blocks with a minimum of two block spaces above them A 1/8 minecraft
cow Cow Cow Health points 10 () Size Adult: Height: 1.4 Blocks Width: 0.9 Blocks Baby: Height: 0.7 Blocks Width: 0.45 Blocks Spawn Opaque blocks with at least two blocks of space above them. After shearing a minecraft
creeper Creeper Creeper Health points 20 () Attack strength Varies by proximity and difficulty. Maximum damage: Normal: 49 ( × 24.5) Charged: 97 ( × 48.5) Size Height: 1.7 Blocks Width: 0.6 Blocks Spawn Light level of minecraft
donkey Donkey
elder_guardian Elder Guardian Elder Guardian Health points 80 ( × 40) Attack strength Easy: 5 () Normal: 8 () Hard: 12 () When attacked (with spikes extended): 2 () Size Height: 1.9975 Blocks Width: 1.9975 Blocks First appearances minecraft
ender_dragon Ender Dragon Ender Dragon Health points 200 ( × 100) Attack strength Peaceful: 0 () Easy: 6 () Normal: 10 () Hard: 15 () Breath attack: 6 () after a half-second Exploding fireball attack: 12 () after minecraft
enderman Enderman Enderman Health points 40 ( × 20) Attack strength Easy: 4 () Normal: 7 () Hard: 10 () Size Height: 2.9 Blocks Width: 0.6 Blocks Spawn In the Overworld, the Nether or the End in minecraft
endermite Endermite Endermite Health points 8 () Attack strength Easy: 2 () Normal: 2 () Hard: 3 () Size Height: 0.3 Blocks Width: 0.4 Blocks Spawn Occasionally when an ender pearl lands First appearances See history Drops minecraft
evocation_illager Evoker Evoker Health points 24 ( × 12) Attack strength 6 () Size Height: 1.95 Blocks Width: 0.6 Blocks Spawn Woodland Mansion Drops Totem of Undying Emerald (0–1) Experience 10 Internal ID PC: 34 PE: 104 minecraft
ghast Ghast Ghast Health points 10 () Attack strength Impact: 6 () Explosion: varies by proximity, maximum: Easy: 9 () Normal: 17 () Hard: 25 ( × 12.5) Size Height: 4.0 Blocks Width: 4.0 Blocks Spawn The minecraft
giant Giant Giant Health points 100 ( × 50) Attack strength Easy: 26 ( × 13) Normal: 50 ( × 25) Hard: 75 ( × 37.5) Size Height: 11.7 Blocks Width: 3.6 Blocks Spawn Light >11 AND minecraft
guardian Guardian Guardian Health points 30 ( × 15) Attack strength Easy: 4 () Normal: 6 () Hard: 9 () When attacked (if spikes are out): 2 () Size Height: 0.85 Blocks Width: 0.85 Blocks First appearances minecraft
horse Horse
husk Husk Zombie Health points 20 () Armor points 2 () Attack strength Easy: 2 () Normal: 3 () Hard: 4 () Size Adult: Height: 1.95 Blocks Width: 0.6 Blocks Baby: Height: 0.975 Blocks Width: 0.3 Blocks Spawn minecraft
llama Llama Llama Health points 15 () to 30 ( × 15) Attack strength 1 () Size Adult: Height: 1.87 Blocks Width: 0.9 Blocks Baby: Height: 0.935 Blocks Width: 0.45 Blocks Spawn Extreme Hills, Savanna Common drops minecraft
magma_cube Magma Cube Magma Cube Health points Big: 16 () Small: 4 () Tiny: 1 () Armor points Big: 12 () Small: 6 () Tiny: 3 () Attack strength Big: 6 () Small: 4 () Tiny: 3 () Size Big: Height: minecraft
mooshroom Mooshroom Mooshroom Health points 10 () Size Adult: Height: 1.4 Blocks Width: 0.9 Blocks Baby: Height: 0.7 Blocks Width: 0.45 Blocks Spawn Mushroom Island biomes First appearances See History Common drops See Drops Experience Kill Adult: minecraft
mule Mule
ocelot Ocelot Ocelot Health points 10 () Attack strength Chickens Only: 2 () Size Adult: Height: 0.7 Blocks Width: 0.6 Blocks Baby: Height: 0.35 Blocks Width: 0.3 Blocks Spawn Ocelot: In Jungle Biomes, on Grass or leaf minecraft
parrot Parrot Parrot Health points 6 () Size Height: 0.9 Blocks Width: 0.5 Blocks Spawn Jungle Drops Feather (1–2) Experience 1–3 Internal ID 105 Entity ID parrot Java Edition Only Parrots are flying tamable mobs. Contents 1 minecraft
pig Pig Pig Health points 10 () Size Adult: Height: 0.9 Blocks Width: 0.9 Blocks Baby: Height: 0.45 Blocks Width: 0.45 Blocks Spawn Opaque blocks with a (Minimum) two block space above them. First appearances See History minecraft
polar_bear Polar Bear Polar Bear Health points 30 ( × 15) Attack strength Adults only Peaceful: 0 (but still performs attack animation) Easy: 4 () Normal: 6 () Hard: 9 () Size Adult: Height: 1.4 Blocks Width: 1.3 minecraft
rabbit Rabbit Rabbit Health points 3 () Armor points Killer Bunny only: 8 () Attack strength Killer Bunny only: Easy: 5 () Normal: 8 () Hard: 12 () Size Adult: Height: 0.5 Blocks Width: 0.4 Blocks Baby: Height: minecraft
sheep Sheep Sheep Health points 8 () Size Adult: Height: 1.3 Blocks Width: 0.9 Blocks Baby: Height: 0.65 Blocks Width: 0.45 Blocks Spawn Opaque blocks with at least two block space above them. First appearances See History minecraft
shulker Shulker Shulker Health points 30 ( × 15) Armor points 20 ( × 10) when closed Attack strength 4 () Size Closed: Height: 1.0 Blocks Width: 1.0 Blocks Open: Height: 1.2069 Blocks Width: 1.0 Blocks Spawn End city minecraft
silverfish Silverfish Silverfish Health points 8 () Attack strength 1 () Size Height: 0.3 Blocks Width: 0.4 Blocks Spawn After mining monster eggs or from spawners in strongholds. First appearances See History Drops None Experience 5 Sounds minecraft
skeleton Skeleton Skeleton Health points 20 () Attack strength Bow: Easy: 1 () - 4 () Normal: 1 () - 4 () Hard: 1 () - 5 () Sword: Easy: 2 () Normal: 2 () Hard: 3 minecraft
skeleton_horse Skeleton Horse Horse Health points 15 () to 30 ( × 15) Armor points See horse armor Size Adult: Height: 1.6 Blocks Width: 1.3965 Blocks Baby: Height: 0.8 Blocks Width: 0.6982 Blocks Spawn Plains and savanna First minecraft
slime Slime Slime Health points Big: 16 () Small: 4 () Tiny: 1 () Attack strength Big: 4 () Small: 2 () Tiny: 0 () Size Big: Height: 2.04 Blocks Width: 2.04 Blocks Small: Height: 1.02 Blocks minecraft
snowman Snow Golem Snow Golem Health points 4 () Attack strength 0 () (only pushes mobs back) 3 () to Blaze Size Height: 1.9 Blocks Width: 0.7 Blocks Spawn Where created by the player First appearances See History minecraft
spider Spider Spider Health points 16 () Attack strength Easy: 2 () Normal: 2 () Hard: 3 () Size Height: 0.9 Blocks Width: 1.4 Blocks Spawn Light level of 7 or less, 3×3×2 space on solid blocks minecraft
squid Squid Squid Health points 10 () Size Height: 0.8 Blocks Width: 0.8 Blocks Spawn 1 or more blocks of water, any light level, spawning block must be between level 46 (inclusive) and sea level First appearances minecraft
stray Stray
vex Vex
villager Villager
villager_golem Iron Golem
vindication_illager Vindicator
witch Witch
wither Wither
wither_skeleton Wither Skeleton
wolf Wolf
zombie Zombie
zombie_horse Zombie Horse
zombie_pigman Zombie Pigman
zombie_villager Zombie Villager

Mobs are a subclass of Entity with additional tags to store their health, attacking/damaged state, potion effects, and more depending on the mob. Players are a subclass of Mob.