Map item format

Since Beta 1.6 craftable maps were added. They are placed in the "data" directory within the world's save directory. Each map has its own file associated with its ID and one file that keeps track of the highest (= most recently created) ID. This is limited to the size of a short(65,536). When Notch was adding them the first time he did not use NBT.

The structure tells that there will probably be an additional feature of maps with different zoom, size and probably maps for Nether.

Data folder structure
Each map starts with map_, have one unique number and ends with .dat. The file idcounts.dat contains the latest id for current map.

map_.dat Format
This file has an incremental number in it. The name for the map is in the name of the file, as the name is not in the file.

NBT Structure
The structure of the file is as follows:


 * TAG_Compound("data")
 * TAG_Byte("scale"): How zoomed in the map is (it is in 2scale blocks square per pixel, even for 0, where the map will be 1:1). Default 3, minimum 0 and maximum 4.
 * TAG_Byte("dimension"): 0 = Overworld, -1 = Nether
 * TAG_Short("height"): Height of map. Default 128
 * TAG_Short("width"): Width of map. Default 128
 * TAG_Int("xCenter"): Center of map according to real world by X
 * TAG_Int("zCenter"): Center of map according to real world by Z
 * TAG_Byte_Array("colors"): Width * Height array of color values (16384 entries for a default 128x128 map). Color can be accessed via the following method: colorID = Colors[widthOffset + heightOffset * width], where (widthOffset==0, heightOffset==0) is left upper point.

When this structure is loaded, Colors array is transformed to standard dimension (if it's necessary) and then structure is saved with standard height and width.

idcounts.dat Format
This file keeps track of the latest map added. Despite containing NBT tags, it is not an NBT file due lack of GZIP compression.

NBT Structure
The structure of the file is as follows:


 * TAG_Short("map"): Current map id

Colour table
The block IDs are sectioned in groups of 4. Darker colour for water is deeper while other blocks is blending with each other.