Namespaces

Variants

Share

Share
Views
Actions
In other languages

Map item format

From Minecraft Wiki
Jump to: navigation, search

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]

When used in The Nether or The End, maps render as a kind of static, making them unreadable.

Contents

[edit] Data folder structure

The file idcounts.dat contains the latest ID for current map. Each map's file name uses the format map_<#>.dat, where <#> is the map's unique number.

[edit] map_<#>.dat format

map_<#>.dat files are GZip'd NBT files.

[edit] NBT structure


  • The root tag.

    •  data: The map data.

      •  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.

      •  dimension: 0 = The Overworld, -1 = The Nether, 1 = The End

      •  height: Height of map. Default (and only possible value) 128

      •  width: Width of map. Default (and only possible value) 128

      •  xCenter: Center of map according to real world by X

      •  zCenter: Center of map 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.

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.

[edit] idcounts.dat format

This file keeps track of the latest map added. It is stored as a raw (uncompressed) NBT file.

[edit] NBT structure


  • The root tag.

    •  map: Latest map ID.

[edit] Color table

Maps use a color table to store the colors efficiently by ID.

[edit] 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.

Color Table
ID Color RGB Description
0 Transparent Glass, Powered Rail, Detector Rail, Torch, Fire, Redstone Wire, Ladders, Rails, Lever, Redstone Torch, Stone Button, Glowstone, Portal, Cake Block, Redstone Repeater, Glass Pane, End Portal, End Portal Frame, Air, unexplored areas
1 127,178,56 Grass Block, Mycelium
2 247,233,163 Sand, Gravel, Soul Sand
3 167,167,167 Sponge, Bed, Cobweb
4 255,0,0 Lava, TNT
5 160,160,255 Ice, Packed Ice
6 167,167,167 Block of Iron, Redstone Block, Iron Door, Iron Bars, Brewing Stand, Cauldron
7 0,124,0 Saplings, Leaves, Tall Grass, Dead Bush, Dandelion, Rose, Brown Mushroom, Red Mushroom, Seeds, Cactus, Sugar Cane, Pumpkin, Jack-O-Lantern, Melon, Pumpkin Stem, Melon Stem, Vines, Lily Pad, Nether Wart, Dragon Egg
8 255,255,255 Snow, Snow block, Block of Quartz
9 164,168,184 Clay Block, Monster Egg
10 183,106,47 Dirt, Farmland
11 112,112,112 Stone, Cobblestone, Bedrock, Gold Ore, Iron Ore, Coal Ore, Block of Coal, Lapis Lazuli Ore, Dispenser, Sandstone, Sticky Piston, Piston, Piston Extension, Block moved by Piston, Double Slabs, Slabs, Bricks, Moss Stone, Monster Spawner, Diamond Ore, Furnace, Cobblestone Stairs, Stone Pressure Plate, Redstone Ore, Stone Bricks, Brick Stairs, Stone Brick Stairs, Nether Brick, Nether Brick Fence, Nether Brick Stairs, Enchantment Table, End Stone
12 64,64,255 Water
13 104,83,50 Wood Planks, Wood, Note Block, Bookshelf, Wooden Stairs, Chest, Crafting Table, Sign Post, Wooden Door, Wall Sign, Wooden Pressure Plate, Jukebox, Fence, Locked Chest, Trapdoor, Huge Brown Mushroom, Huge Red Mushroom, Fence Gate
14 255,252,245 Wool (White), White Stained Clay
15 216,127,51 Orange Wool, Orange Stained Clay
16 178,76,216 Magenta Wool, Magenta Stained Clay
17 102,153,216 Light Blue Wool, Light Blue Stained Clay
18 229,229,51 Yellow Wool, Yellow Stained Clay
19 127,204,25 Lime Wool, Lime Stained Clay
20 242,127,165 Pink Wool, Pink Stained Clay
21 76,76,76 Gray Wool, Gray Stained Clay
22 153,153,153 Light Gray Wool, Light Gray Stained Clay
23 76,127,153 Cyan Wool, Cyan Stained Clay
24 127,63,178 Purple Wool, Purple Stained Clay
25 51,76,178 Blue Wool, Blue Stained Clay
26 102,76,51 Brown Wool, Brown Stained Clay
27 102,127,51 Green Wool, Green Stained Clay
28 153,51,51 Red Wool, Red Stained Clay
29 25,25,25 Black Wool, Black Stained Clay
30 250,238,77 Block of Gold
31 92,219,213 Block of Diamond
32 74,128,255 Lapis Lazuli Block
33 0,217,58 Block of Emerald
34 21,20,31 Obsidian
35 112,2,0 Netherrack

[edit] Map colors

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. As of weekly snapshot 13w42b, the fourth base color variant is now multiplied by 135, providing a darker set of colors rather than just a clone of the second base color variant.

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 135

Here is a map color table provided as an example:

Color Table
ID Color RGB Description
0 Transparent Not explored
1 Transparent Not explored
2 Transparent Not explored
3 Transparent Not explored
4 89,125,39 Grass
5 109,153,48 Grass
6 127,178,56 Grass
7 67,94,29 Grass
8 174,164,115 Sand/Gravel
9 213,201,140 Sand/Gravel
10 247,233,163 Sand/Gravel
11 130,123,86 Sand/Gravel
12 117,117,117 Other
13 144,144,144 Other
14 167,167,167 Other
15 88,88,88 Other
16 180,0,0 Lava/TNT
17 220,0,0 Lava/TNT
18 255,0,0 Lava/TNT
19 135,0,0 Lava/TNT
20 112,112,180 Ice/Packed Ice
21 138,138,220 Ice/Packed Ice
22 160,160,255 Ice/Packed Ice
23 84,84,135 Ice/Packed Ice
24 117,117,117 Metal
25 144,144,144 Metal
26 167,167,167 Metal
27 88,88,88 Metal
28 0,87,0 Plants
29 0,106,0 Plants
30 0,124,0 Plants
31 0,65,0 Plants
32 180,180,180 Snow
33 220,220,220 Snow
34 255,255,255 Snow
35 135,135,135 Snow
36 115,118,129 Clay
37 141,144,158 Clay
38 164,168,184 Clay
39 86,88,97 Clay
40 129,74,33 Dirt
41 157,91,40 Dirt
42 183,106,47 Dirt
43 96,56,24 Dirt
44 79,79,79 Stone/Cobblestone/Ore
45 96,96,96 Stone/Cobblestone/Ore
46 112,112,112 Stone/Cobblestone/Ore
47 59,59,59 Stone/Cobblestone/Ore
48 45,45,180 Water
49 55,55,220 Water
50 64,64,255 Water
51 33,33,135 Water
52 73,58,35 Log/Tree/Wood
53 89,71,43 Log/Tree/Wood
54 104,83,50 Log/Tree/Wood
55 55,43,26 Log/Tree/Wood
56 180,177,172
57 220,217,211
58 255,252,245
59 135,133,129
60 152,89,36
61 186,109,44
62 216,127,51
63 114,67,27
64 125,53,152
65 153,65,186
66 178,76,216
67 94,40,114
68 72,108,152
69 88,132,186
70 102,153,216
71 54,81,114
72 161,161,36
73 197,197,44
74 229,229,51
75 121,121,27
76 89,144,17
77 109,176,21
78 127,204,25
79 67,108,13
80 170,89,116
81 208,109,142
82 242,127,165
83 128,67,87
84 53,53,53
85 65,65,65
86 76,76,76
87 40,40,40
88 108,108,108
89 132,132,132
90 153,153,153
91 81,81,81
92 53,89,108
93 65,109,132
94 76,127,153
95 40,67,81
96 89,44,125
97 109,54,153
98 127,63,178
99 67,33,94
100 36,53,125
101 44,65,153
102 51,76,178
103 27,40,94
104 72,53,36
105 88,65,44
106 102,76,51
107 54,40,27
108 72,89,36
109 88,109,44
110 102,127,51
111 54,67,27
112 108,36,36
113 132,44,44
114 153,51,51
115 81,27,27
116 17,17,17
117 21,21,21
118 25,25,25
119 13,13,13
120 176,168,54
121 215,205,66
122 250,238,77
123 132,126,40
124 64,154,150
125 79,188,183
126 92,219,213
127 48,115,112
128 52,90,180
129 63,110,220
130 74,128,255
131 39,67,135
132 0,153,40
133 0,187,50
134 0,217,58
135 0,114,30
136 14,14,21
137 18,17,26
138 21,20,31
139 11,10,16
140 79,1,0
141 96,1,0
142 112,2,0
143 59,1,0

[edit] Code examples

Library name Language Link to Map-related code
MCModify Java Map.java

[edit] References