Minecraft Beta 1.6 added craftable map items. Unlike books, maps do not store their information in the item - instead, their data value corresponds to the map number (ID) of a saved file. Their information is placed in the "data" directory within the world's save directory. Each map has its own file associated with its ID, and there is one file that keeps track of the highest (= most recently created) map ID. This is limited to the size of a short (65,536).[1] When Notch was adding them the first time he did not use the NBT format.[2]
There is support for The Nether, but it is obscured by the top blocks of the Nether and therefore unreadable. The End is supported without problems.
资料目录结构
idcounts.dat 包含最新的ID在当前的地图。 Each map's file name uses the format map<#>.dat, where <#> is the map's unique number.
map_<#>.dat 格式
map_<#>.dat files are GZip'd NBT files.
NBT 结构
- 根标签.
- data: 地图资訊.
- scale: 地图缩放 (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.
- dimension: 0 = The Overworld, -1 = The Nether, 1 = The End
- height: 地图的高度. 默认 (and only possible value) 128
- width: 地图的寬度. 默认 (and only possible value) 128
- xCenter: 地?的中心 according to real world by X
- zCenter: 地?的中心 according to real world by Z
- 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.
- data: 地图资訊.
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 格式
This file keeps track of the latest map added. It is stored as a raw (uncompressed) NBT file.
NBT 结构
- The root tag.
- map: Latest map ID.
Color table
Maps use a color table to store the colors efficiently by ID.
Base colors
Blocks are colored according to their material. Each material has a base color which is multiplied by 180, 220 or 255, and then divided by 255 to make the map color. Each base color below is associated with four map colors - to get the first map color ID for a base color, multiply the base color ID by 4.
| ID | 颜色 | RGB | 对应方块
|
|---|---|---|---|
| 0 | 透明 | ||
| 1 | 127,178,56 | ||
| 2 | 247,233,163 | ||
| 3 | 167,167,167 | ||
| 4 | 255,0,0 | ||
| 5 | 160,160,255 | ||
| 6 | 167,167,167 | ||
| 7 | 0,124,0 | ||
| 8 | 255,255,255 | ||
| 9 | 164,168,184 | ||
| 10 | 183,106,47 | ||
| 11 | 112,112,112 | ||
| 12 | 64,64,255 | ||
| 13 | 104,83,50 |
地图的颜色
Each base color above has 4 associated map colors below. The conversion works by multiplying each of the red, green, and blue values by a value and then dividing by 255, finally rounding to the nearest whole.
| Map Color ID | Multiply R,G,B By |
|---|---|
| Base Color ID*4 + 0 | 180 |
| Base Color ID*4 + 1 | 220 |
| Base Color ID*4 + 2 | 255 (same color) |
| Base Color ID*4 + 3 | 220 |
Here is a map color table provided as an example:
| ID | 颜色 | RGB | 对应方块
|
|---|---|---|---|
| 0 | 透明 | ||
| 1 | 透明 | ||
| 2 | 透明 | ||
| 3 | 透明 | ||
| 4 | 89,125,39 | ||
| 5 | 109,153,48 | ||
| 6 | 127,178,56 | ||
| 7 | 109,153,48 | ||
| 8 | 174,164,115 | ||
| 9 | 213,201,140 | ||
| 10 | 247,233,163 | ||
| 11 | 213,201,140 | ||
| 12 | 117,117,117 | ||
| 13 | 144,144,144 | ||
| 14 | 167,167,167 | ||
| 15 | 144,144,144 | ||
| 16 | 180,0,0 | ||
| 17 | 220,0,0 | ||
| 18 | 255,0,0 | ||
| 19 | 220,0,0 | ||
| 20 | 112,112,180 | ||
| 21 | 138,138,220 | ||
| 22 | 160,160,255 | ||
| 23 | 138,138,220 | ||
| 24 | 117,117,117 | ||
| 25 | 144,144,144 | ||
| 26 | 167,167,167 | ||
| 27 | 144,144,144 | ||
| 28 | 0,87,0 | ||
| 29 | 0,106,0 | ||
| 30 | 0,124,0 | ||
| 31 | 0,106,0 | ||
| 32 | 180,180,180 | ||
| 33 | 220,220,220 | ||
| 34 | 255,255,255 | ||
| 35 | 220,220,220 | ||
| 36 | 115,118,129 | ||
| 37 | 141,144,158 | ||
| 38 | 164,168,184 | ||
| 39 | 141,144,158 | ||
| 40 | 129,74,33 | ||
| 41 | 157,91,40 | ||
| 42 | 183,106,47 | ||
| 43 | 157,91,40 | ||
| 44 | 79,79,79 | ||
| 45 | 96,96,96 | ||
| 46 | 112,112,112 | ||
| 47 | 96,96,96 | ||
| 48 | 45,45,180 | ||
| 49 | 55,55,220 | ||
| 50 | 64,64,255 | ||
| 51 | 55,55,220 | ||
| 52 | 73,58,35 | ||
| 53 | 89,71,43 | ||
| 54 | 104,83,50 | ||
| 55 | 89,71,43 |