Skip to content

Level Format

Byte Order

The level format is stored in Big Endian byte order.

NBT structure

  • MinecraftLevel: The root tag.
    • About: Information about the level.
      • CreatedOn: The Unix time when the level was created.
      • Name: The name of the level, Always A Nice World.
      • Author: The name of the user who created the level.
    • Environment: Information about the environment, varies based on map settings.
      • TimeOfDay: The time in ticks affecting the daylight cycle. Range: 0 - 24000.
      • SkyBrightness: The sky light level. Range: 0 - 15.
      • SkyColor: The RGB color of the sky, 24 bits. Red is SkyColor >> 16 & 255, Green is SkyColor >> 8 & 255, and Blue is SkyColor & 255.
      • FogColor: The RGB color of the sky, 24 bits. Red is FogColor >> 16 & 255, Green is FogColor >> 8 & 255, and Blue is FogColor & 255.
      • CloudColor: The RGB color of the sky, 24 bits. Red is CloudColor >> 16 & 255, Green is CloudColor >> 8 & 255, and Blue is CloudColor & 255.
      • CloudHeight: The height of the clouds.
      • SurroundingGroundType: The block ID of the "surrounding ground".
      • SurroundingGroundHeight: The height of the "surrounding ground".
      • SurroundingWaterType: The block ID of the "surrounding water".
      • SurroundingWaterHeight: The height of the "surrounding water".
    • Map: The map data.
      • Width: The width of the level. (X direction)
      • Length: The length of the level. (Z direction)
      • Height: The height of the level. (Y direction)
      • Spawn: ListTag of 3 ShortTags holding the X, Y, and Z spawn coordinates.
      • Blocks: Width×Length×Height bytes of block IDs (8 bits). XZY order (X increments first)[1]
      • Data: Width×Length×Height bytes of block data (4 bits) and light data (next 4 bits). XZY order (X increments first)
    • Entities: ListTag of CompoundTags holding all the entities in the level.
      • An entity.
        • id: The entity ID.
        • Pos: ListTag of 3 FloatTags holding the X, Y, and Z position of the entity.
        • Rotation: ListTag of 2 FloatTags holding the yaw and pitch of the entities view.
        • Motion: ListTag of 3 FloatTags holding the X, Y, and Z motion of the entity in meters per tick.
        • FallDistance: How far the entity has fallen.
        • Health: The number of hit points the entity has. 20 is 10 hearts.
        • AttackTime: Number of ticks the entity is immune to attacks for.
        • HurtTime: Number of ticks the entity is red from being attacked.
        • DeathTime: Number of ticks the entity has been dead for. (used for death animation)
        • Air: The number of ticks before the entity starts to drown. It starts at 300.
        • Fire: When negative, the number of ticks before the entity can catch on fire. When positive, the number of ticks before the fire is extinguished.
        • AdditionalEntityTags: See Additional Entity Tags
    • TileEntities: ListTag of CompoundTags holding all the tile entities in the level.
      • A tile entity.
        • id: The tile entity ID.
        • Pos: Position of the tile entity[2].
        • Items: ListTag of CompoundTags holding the items in the container.
          • An item stack.
            • Slot: The slot the item is in.
            • id: The item ID.
            • Damage: The item's data value, or damage value for tools.
            • Count: The number of this item in the stack. Range -128 to 127. Values less then 2 are not displayed in-game.
        • AdditionalTileEntityTags: See Additional Tile Entity Tags

Additional Entity Tags

Item (Entity)

NOTE: Item entity doesn't have the AttackTime, HurtTime, and DeathTime tags.

    • Age: The number of ticks the item has been "untouched". After 6000 ticks (5 minutes) the item is destroyed.
    • Item: The inventory item, without the Slot tag.
      • id: The item ID.
      • Damage: The item's data value, or damage value for tools.
      • Count: The number of this item in the stack. Range -128 to 127. Values less then 2 are not displayed in-game.

LocalPlayer

    • Inventory: ListTag of CompoundTags holding the items in the players inventory.
      • Slot: The slot the item is in.
      • id: The item ID.
      • Damage: The item's data value, or damage value for tools.
      • Count: The number of this item in the stack. Range -128 to 127. Values less then 2 are not displayed in-game.
    • Score: The player's score.

Sheep

    • Sheared: 1 or 0 (true/false) - true if the sheep has been shorn.

Additional Tile Entity Tags

Furnace

    • BurnTime: Number of ticks left before the current fuel runs out.
    • CookTime: Number of ticks the item has been smelting for. The item finishes when this value reaches 200 (10 seconds). Is reset to 0 if BurnTime reaches 0.

Notes

  1. The index can be calculated with (y × length + z) × width + x

  2. Calculate Pos tag from X, Y, and Z:
    Pos = x + (y << 10) + (z << 20)

    Calculate X, Y, Z from Pos tag:
    x = Pos % 1024
    y = (Pos >> 10) % 1024
    z = (Pos >> 20) % 1024

License & Credits

This file is licensed under CC BY-NC-SA 3.0.

The information here is from this Minecraft wiki page with some wording tweaked and/or simplify

Contributors

The avatar of contributor named as BJTMastermind BJTMastermind
The avatar of contributor named as Dexrn ZacAttack Dexrn ZacAttack

Changelog

Contributors



Documentation page was setup by DexrnZacAttack.


Documentation is licensed under Creative Commons CC-BY 4.0 unless otherwise noted. For more info, check the NOTICE file.