Java Edition Indev level format

The .mclevel map format is an old map format, created by Notch. It is based on the NBT Format.

The map format is in use since indev version 0.31.

While Alpha (and Infdev) levels use NBT files, they have a very different file format.

For details on the infinite map format, see Alpha Level Format.

=NBT Structure= Calculating "Pos" tag of the tile entity:
 * : The root tag.
 * : Information about the level.
 * : The Unix time when the level was created.
 * : The name of the level, always "A Nice World".
 * : The name of the user who created the level.
 * : Information about the environment of the level, which varies based on the map generation settings.
 * : The time in ticks affecting daylight cycle. Range 0 - 24000.
 * : The sky light level, 0 to 15.
 * : The RGB color of the sky, 24 bits. Red is SkyColor >> 16 & 255, green is SkyColor >> 8 & 255, blue is SkyColor & 255.
 * : The RGB color of the fog, 24 bits. Red is FogColor >> 16 & 255, green is FogColor >> 8 & 255, blue is FogColor & 255.
 * : The RGB color of the clouds, 24 bits. Red is CloudColor >> 16 & 255, green is CloudColor >> 8 & 255, blue is CloudColor & 255.
 * : The height of the clouds (Y coordinate).
 * : The Block ID of the "surrounding ground".
 * : The height of the "surrounding ground".
 * : The Block ID of the "surrounding water".
 * : The height of the "surrounding water".
 * : The actual map data.
 * : The width of the level.
 * : The length of the level.
 * : The height of the level.
 * : List of 3 TAG_Shorts for the X, Y, and Z spawn coordinates.
 * : Width*Length*Height bytes of block IDs. (8 bits)
 * : Width*Length*Height bytes of block data (4 bit) and light value (next 4 bit).
 * : List of TAG_Compounds for the entities in the level.
 * An entity. The player has its own entity, shown below as an example.
 * : The entity ID. In this case, "LocalPlayer".
 * : List of 3 TAG_Floats for the X, Y, and Z position of the player.
 * : List of 2 TAG_Floats for the Yaw and Pitch of the player's view.
 * : List of 3 TAG_Floats for the X, Y, and Z motion in meters per tick.
 * : How far the player has fallen.
 * : The number of hit points the player has. 20 is 10 hearts.
 * : Number of ticks the player is immune to attacks.
 * : Number of ticks the player is red from being attacked.
 * : Number of ticks the player has been dead for - used for controlling the death animation.
 * : The number of ticks before the player starts to drown. Starts at 300.
 * : When negative, the number of ticks before the player can catch on fire. When positive, the number of ticks before the fire is extinguished.
 * : The player's score.
 * : List of TAG_Compounds representing items in the player's inventory.
 * An item stack.
 * : The Slot the item is in.
 * : The Item ID.
 * : The item's data value, or damage value for tools.
 * : The number of this item in the stack. Range -128 to 127. Values less than 2 are not displayed in-game.
 * : List of TAG_Compounds for the tile entities in the level.
 * A tile entity.
 * : Tile entity id. In this case, "Chest".
 * : Position of the tile entity, explained later.
 * : List of TAG_Compounds representing items in the chest.
 * An item stack.
 * : The Slot the item is in.
 * : The Item ID.
 * : The item's data value, or damage value for tools.
 * : The number of this item in the stack. Range -128 to 127. Values less than 2 are not displayed in-game.

pos = x + (y << 10) + (z << 20)

Calculating X, Y, and Z from "Pos" tag:

x = pos % 1024

y = (pos >> 10) % 1024

z = (pos >> 20) % 1024

Blocks
The block byte array is used to define the types of blocks that occupy a map. The number of bytes in the array may be calculated by multiplying the dimensions of the map. Y being the up direction rather than Z. For Hex values see Block IDs.

To access a specific block from either the block or data array from XYZ coordinates, use the following formula:

array index = (y * height + z) * width + x;

Data
The Data byte array is used for lighting and extra block data.

For extended information on block metadata, refer to Java edition data values.

Lighting


There are 16 levels of lighting for a block ranging from 0x0 (0, no light) to 0xF (15, full light).

Indev Level Format Format de carte mclevel (NBT) Формат файлов Minecraft (NBT)