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"): Probably how zoomed in the map is (if it is the zoom level, it is in 2^x blocks square per pixel, most likely). Default 3
 * 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) of (at the time of this writing) unknown encoding (likely a color table built into the game)

idcounts.dat Format
This file keeps track of the latest map added. As it contains NBT tags, it is not an NBT file because lack of GZIP compression.

NBT Structure
The structure of the file is as follows:


 * TAG_Short("map"): Current map id

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