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/McRegion

From SAS Gaming Wiki

Template:Outdated Template:Cleanup

Minecraft:Chunks store the terrain and entities within a 16x16x128 area. They also store precomputed lighting, heightmap data for Minecraft's performance and other meta information.

Chunks were first introduced in Minecraft Minecraft:Infdev. Before the addition of the Minecraft:region file format in Beta 1.3, chunks were stored as individual chunk files. The file names contained the chunk's position encoded in Base36 and the extension ".dat".

The Data, SkyLight, and BlockLight are arrays of 4-bit values. The low bits of the first byte of one of these corresponds to the first block in the Blocks array.

Prior to 1.2, chunk sizes changed to 16x16x256, for higher building.

NBT Structure

  • Template:Nbt Chunk data
    • Template:Nbt 32768 bytes of block IDs defining the terrain. 8 bits per block. See Block Format below for byte ordering.
    • Template:Nbt 16384 bytes of block data additionally defining parts of the terrain. 4 bits per block.
    • Template:Nbt 16384 bytes recording the amount of sun or moonlight hitting each block. 4 bits per block. Makes day/night transitions smoother compared to recomputing per level change.
    • Template:Nbt 16384 bytes recording the amount of block-emitted light in each block. 4 bits per block. Makes load times faster compared to recomputing at load time.
    • Template:Nbt 256 bytes of heightmap data. 16 x 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. Note: This array's indexes are ordered Z,X whereas the other array indexes are ordered X,Z,Y.
    • Template:Nbt Each TAG_Compound in this list defines an entity in the chunk. See Entity Format below.
    • Template:Nbt Each TAG_Compound in this list defines a tile entity in the chunk. See Tile Entity Format below.
    • Template:Nbt 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.
    • Template:Nbt Tick when the chunk was last saved.
    • Template:Nbt X position of the chunk. Should match the file name.
    • Template:Nbt Z position of the chunk. Should match the file name.
    • Template:Nbt 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 the chunk.

Block Format

Blocks are laid out in sets of vertical columns, with the rows going east-west through chunk, and columns going north-south. Blocks in each chunk are accessed via the following method:

unsigned char BlockID = Blocks[ y + z * ChunkSizeY(=128) + x * ChunkSizeY(=128) * ChunkSizeZ(=16) ];

The coordinate system is as follows:

  • X increases East, decreases West
  • Y increases upwards, decreases downwards
  • Z increases South, decreases North

The Data, BlockLight, and SkyLight arrays have four bits (a nibble) for each byte of the Blocks array. Note that these arrays use a kind of 'little endian' nibble order: e.g. the least significant four bits of the first byte of the Data, BlockLight, or SkyLight arrays correspond to the first byte of the Blocks array, and the most significant four bits correspond to the second byte, etc.

Tile Tick Format

(added in version RC2)

Entity Format

Every entity 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.

All entities share this base:

  • Template:Nbt Entity data
    • Template:Nbt Entity ID
    • Template:Nbt 3 TAG_Doubles describing the current X,Y,Z position of the entity.
    • Template:Nbt 3 TAG_Doubles describing the current dX,dY,dZ velocity of the entity. (Note: Falling into the Minecraft:Void appears to set this to ridiculously high speeds. 0,0,0 is no motion.)
    • Template:Nbt Two TAG_Floats representing rotation in degrees.
      • Template:Nbt The entity's rotation clockwise around the Y axis (called yaw). Due west is 0. Can have large values because it accumulates all of the entity's lateral rotation throughout the game.
      • Template:Nbt The entity's declination from the horizon (called pitch). Horizontal is 0. Positive values look downward. Does not exceed positive or negative 90 degrees.
    • Template:Nbt Distance the entity has fallen. Larger values cause more damage when the entity lands.
    • Template:Nbt Number of ticks until the fire is put out. Negative values reflect how long the entity can stand in fire before burning.
    • Template:Nbt How much air the entity has, in ticks. Fills to a maximum of 200 in air, giving 10 seconds submerged before the entity starts to drown, and a total of up to 20 seconds before the entity dies. Decreases while underwater. If 0 while underwater, the entity loses 1 health per second.
    • Template:Nbt 1 if the entity is touching the ground.

File:SkeletonFace.png Mobs

Known Mob Entity ids: Blaze, CaveSpider, Chicken, Cow, Creeper, EnderDragon, Enderman, Ghast, Giant, LavaSlime, Mob, Monster, MushroomCow, Ozelot, Pig, Sheep, Silverfish, Skeleton, Slime, SnowMan, Spider, Squid, Villager, Wolf, Zombie, and PigZombie

Additional fields for mobs:

  • Template:Nbt Number of ticks the entity's "invincibility shield" is lasting after the entity was last struck.
  • Template:Nbt Number of ticks the entity has been dead for. Controls death animations.
  • Template:Nbt Amount of health the entity has. Players and enemies normally have up to 20 health. Livestock has up to 10 health.
  • Template:Nbt Unknown, maybe time invincible after being hit

File:PigFace.png Pig has one additional field:

File:SheepFace.png Sheep has two additional fields:

File:CreeperFace.png Creeper has one additional/optional field:

  • Template:Nbt 1 or 0 (true/false) - true if the creeper was struck by lightning (doubles the explosive power). This tag is only written if value is 1 (true).

File:SlimeFace.png Slime has one additional field, and it can't be used as the Entity ID of a Monster Spawner:

File:WolfFace.png Wolf has three additional fields:

  • Template:Nbt Name of the player that owns this wolf. Empty string if no owner.
  • Template:Nbt 1 or 0 (true/false) - true if the wolf is sitting.
  • Template:Nbt 1 or 0 (true/false) - true if the wolf is angry.

File:ZombiePigmanFace.png PigZombie has one additional field:

  • Template:Nbt Anger level. Determines the aggressivity of the creature towards players.

File:EndermanFace.png Enderman has two additional fields:

File:Arrow.png Projectiles

Known Projectile Entity ids: Arrow, Snowball, Egg, Fireball, SmallFireball, ThrownEnderpearl

File:Arrow.png File:Snowball.png File:Egg.png File:Fire Charge JE2 BE2.png File:Ender Pearl.png Additional fields for Arrow, Snowball, Egg, Fireball (from Minecraft:Ghasts), SmallFireball (from Minecraft:Blazes), and ThrownEnderpearl:

File:Stone.png Items

Known Item Entity ids: Item, Painting, XPOrb

File:Cobblestone.png Additional fields for Item:

File:Painting.png Additional fields for Painting:

File:Experience Orb Value 3-6.png Additional fields for XPOrb:

  • Template:Nbt Starts at 5, and currently only decreases as the item takes fire damage. When health reaches 0, the item is destroyed.
  • Template:Nbt The amount of time an orb has been "untouched" on the ground. After a certain amount of ticks, the orb is destroyed.
  • Template:Nbt The amount of experience the orb gives when picked up.

File:Oak Boat.png Vehicles

Known Vehicle Entity ids: Minecart, Boat

File:Minecart.png Additional fields for Minecart:

  • Template:Nbt The type of the cart: 0 - empty, 1 - with a chest, 2 - with a furnace.

File:Minecart with Furnace.png For a minecart with a furnace there are three additional fields:

File:Minecart with Chest.png For a minecart with a chest there is one additional field:

  • Template:Nbt List of items in the slots, same as for a chest.

Dynamic Tiles

Known Dynamic Tile Entity ids: PrimedTnt, FallingSand

File:TNT.png Additional fields for PrimedTnt

File:Sand.png Additional fields for FallingSand:

Tile Entity Format

Known TileEntity ids: Furnace, Sign, MobSpawner, Chest, Minecraft:Music, Trap, RecordPlayer, Piston, Cauldron, EnchantTable, and End portal

All tile entities share this base:

Unique Tile Entity fields

File:Furnace.png Furnace

  • Template:Nbt Fuel time
  • Template:Nbt Cooking time
  • Template:Nbt List of items in the furnace slots. Each item is a TAG_Compound identical to the ones in the Inventory list. The first entry corresponds to the burning item, the second one is for the fuel and the last one for the result. The list may be empty.

File:Oak Sign.png Sign

File:Monster Spawner.png MobSpawner

File:Chest.png Chest

  • Template:Nbt List of items in the chest. Each item is a TAG_Compound identical to the ones in the Inventory list. Chest slots are numbered 0-26 with 0 in the top left corner.

File:Note Block.png Music

File:Dispenser.png Trap

File:Jukebox.png RecordPlayer

  • Template:Nbt Record currently playing. 0 is no record. Max value currently used is 2.

File:Piston.png Piston

This tile entity is that of Block 36, not any part of the piston itself.

File:Brewing Stand.png Cauldron

Note that despite being called "Cauldron", this Tile Entity only appears on Minecraft:Brewing Stands as of 1.9pre3.

  • Template:Nbt List of items in the brewing stand. Each item is a TAG_Compound identical to the ones in the Inventory list. The slots are numbered from 0-3.
  • Template:Nbt Time brewing in ticks.

File:Enchanting Table.png EnchantTable

The enchantment table has no extra tags besides the base ones. It is used for the rotation and opening/closing of the floating book.

File:End Portal JE2.png End Portal

This is the tile entity associated with the enterable Minecraft:End Portal (not the Minecraft:End Portal Frame). It has no extra tags.

References

Template:Reflist

Navigation

Template:Navbox Java Edition technical

Minecraft:fr:Format de carte Alpha/Format de fichier de tronçon