Map item format

From Minecraft Wiki
Jump to: navigation, search
This article may need cleanup to comply with the style guide.
Please help improve this if you can. The talk page may contain suggestions.

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 (32,768).[1] When Notch was adding them the first time he did not use the NBT format.[2]

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

Data folder structure[edit | edit source]

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.

map_<#>.dat format[edit | edit source]

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

NBT structure[edit | edit source]

  • 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, any other value = map is a static image with no player pin.

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

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

      •  trackingPosition: 1 (default) indicates that a positional arrow should be shown when the map is near its center coords. 0 indicates that the position arrow should never be shown.

      •  unlimitedTracking: 1 (default) allows the player position indicator to show as a smaller dot on the map's edge when the player is farther than 320 * (scale+1) blocks from the map's center. 0 will make the dot instead disappear when the player is farther than this distance.

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

idcounts.dat format[edit | edit source]

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

NBT structure[edit | edit source]

  • The root tag.

    •  map: Latest map ID.

Color table[edit | edit source]

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

Base colors[edit | edit source]

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, Redstone Wire, Ladders, Rails, Lever, Redstone Torch, Buttons, Tripwire Hook, Nether Portal (block), Cake, Redstone Repeater, Redstone Comparator, Glass Pane, Flower Pot, Redstone Lamp, Barrier, Mob heads, End Rod, Structure Void, Shulker Boxes (all colors), Air, unexplored areas
1 127, 178, 56 Grass Block, Slime Block
2 247, 233, 163 Sand, Sandstone, Sandstone Stairs, Sandstone Slab, Chiseled Sandstone, Smooth Sandstone, Glowstone, End Stone, Birch Wood (top side), Birch Wood Planks, Birch Fence, Birch Fence Gate, Birch Wood Stairs, Birch Wood Slab, Stem and all-sided-inside-textured huge mushroom blocks, Bone Block, End Stone Bricks
3 199, 199, 199 Bed, Cobweb, All-sided-stem huge mushroom blocks
4 255, 0, 0 Lava, TNT, Fire, Block of Redstone
5 160, 160, 255 Ice, Frosted Ice, Packed Ice
6 167, 167, 167 Block of Iron, Iron Door, Iron Trapdoor, Iron Bars, Brewing Stand, Anvil, Weighted Pressure Plate (Heavy)
7 0, 124, 0 Saplings, Leaves, Tall Grass, Dead Bush, Flowers, Mushrooms, Seeds, Cactus, Sugar Cane, Pumpkin Stem, Melon Stem, Vines, Lily Pad
8 255, 255, 255 White Wool, White Carpet, White Terracotta, Snow, Snow block
9 164, 168, 184 Clay Block, Monster Eggs
10 151, 109, 77 Dirt, Granite, Polished Granite, Farmland, Red Sand, Red Sandstone, Red Sandstone Stairs, Red Sandstone Slab, Chiseled Red Sandstone, Smooth Red Sandstone, Jungle Wood, Jungle Wood Planks, Jungle Fence, Jungle Fence Gate, Jungle Wood Stairs, Jungle Wood Slab
11 112, 112, 112 Stone, Stone Slab, Cobblestone, Cobblestone Stairs, Cobblestone Slab, Cobblestone Wall, Moss Stone, Mossy Cobblestone Wall, Andesite, Polished Andesite, Bedrock, Gold Ore, Iron Ore, Coal Ore, Lapis Lazuli Ore, Dispenser, Dropper, Sticky Piston, Piston, Piston Head, Block moved by Piston, Monster Spawner, Diamond Ore, Furnace, Cobblestone Stairs, Stone Pressure Plate, Redstone Ore, Stone Bricks, Stone Brick Stairs, Stone Bricks Slab, Mossy Stone Bricks, Cracked Stone Bricks, Chiseled Stone Bricks, Ender Chest, Hopper, Gravel, Observer
12 64, 64, 255 Water
13 143, 119, 72 Oak Wood, Oak Wood Planks, Oak Fence, Oak Fence Gate, Oak Wood Stairs, Oak Wood Slab, Note Block, Bookshelf, Chest, Trapped Chest, Crafting Table, Wooden Doors, Sign, Wooden Pressure Plate, Jukebox, Wooden Trapdoor, Huge Brown Mushroom, Banners, Daylight Sensor
14 255, 252, 245 Block of Quartz, Quartz Slab, Quartz Stairs, Chiseled Quartz Block, Pillar Quartz Block, Diorite, Polished Diorite, Sea Lantern, Birch Wood (bark sides)
15 216, 127, 51 Orange Wool, Orange Carpet, Orange Terracotta, Pumpkin, Jack-O-Lantern, Hardened Clay, Acacia Wood, Acacia Wood Planks, Acacia Fence, Acacia Fence Gate, Acacia Wood Stairs, Acacia Wood Slab
16 178, 76, 216 Magenta Wool, Magenta Carpet, Magenta Terracotta, Purpur Blocks
17 102, 153, 216 Light Blue Wool, Light Blue Carpet, Light Blue Terracotta
18 229, 229, 51 Yellow Wool, Yellow Carpet, Yellow Terracotta, Hay Bale, Sponge, Wet Sponge
19 127, 204, 25 Lime Wool, Lime Carpet, Lime Terracotta, Melon
20 242, 127, 165 Pink Wool, Pink Carpet, Pink Terracotta
21 76, 76, 76 Gray Wool, Gray Carpet, Gray Terracotta, Cauldron
22 153, 153, 153 Light Gray Wool, Light Gray Carpet, Light Gray Terracotta, Structure Block
23 76, 127, 153 Cyan Wool, Cyan Carpet, Cyan Terracotta, Prismarine
24 127, 63, 178 Purple Wool, Purple Carpet, Purple Terracotta, Mycelium, Repeating Command Block, Chorus Plant, Chorus Flower
25 51, 76, 178 Blue Wool, Blue Carpet, Blue Terracotta
26 102, 76, 51 Brown Wool, Brown Carpet, Brown Terracotta, Soul Sand, Dark Oak Wood, Dark Oak Wood Planks, Dark Oak Fence, Dark Oak Fence Gate, Dark Oak Wood Stairs, Dark Oak Wood Slab, Impulse Command Block
27 102, 127, 51 Green Wool, Green Carpet, Green Terracotta, End Portal Frame, Chained Command Block
28 153, 51, 51 Red Wool, Red Carpet, Red Terracotta, Huge Red Mushroom, Bricks, Brick Stairs, Bricks Slab, Enchanting Table, Nether Wart, Nether Wart Block
29 25, 25, 25 Black Wool, Black Carpet, Black Terracotta, Dragon Egg, Block of Coal, Obsidian, End Portal (block)
30 250, 238, 77 Block of Gold, Weighted Pressure Plate (Light)
31 92, 219, 213 Block of Diamond, Prismarine Bricks, Dark Prismarine, Beacon
32 74, 128, 255 Lapis Lazuli Block
33 0, 217, 58 Block of Emerald
34 129, 86, 49 Podzol, Spruce Wood, Spruce Wood Planks, Spruce Fence, Spruce Fence Gate, Spruce Wood Stairs, Spruce Wood Slab
35 112, 2, 0 Netherrack, Nether Quartz Ore, Nether Brick, Nether Brick Fence, Nether Brick Stairs, Red Nether Brick, Magma Block
36 209, 177, 161 White Terracotta
37 159, 82, 36 Orange Terracotta
38 149, 87, 108 Magenta Terracotta
39 112, 108, 138 Light Blue Terracotta
40 186, 133, 36 Yellow Terracotta
41 103, 117, 53 Lime Terracotta
42 160, 77, 78 Pink Terracotta
43 57, 41, 35 Grey Terracotta
44 135, 107, 98 Light Grey Terracotta
45 87, 92, 92 Cyan Terracotta
46 122, 73, 88 Purple Terracotta
47 76, 62, 92 Blue Terracotta
48 76, 50, 35 Brown Terracotta
49 76, 82, 42 Green Terracotta
50 142, 60, 46 Red Terracotta
51 37, 22, 16 Black Terracotta

Map colors[edit | edit source]

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

Map Pixel Art[edit | edit source]

Redstonehelper uses the staircase method in survival

People have used the map to create pixel art. The default map has an image size of 128x128 and will read each block as a specific color. By placing blocks in a specific arrangement, it is possible to create pixel art images.

Methods for creating map pixel art is either flat, or staircase. With the flat method, you have 36 colors to work with and is a lot easier to create an image. With the staircase, you have 108 colors and is a lot more difficult to work with. For the staircase method, blocks are placed at different elevations to obtain the extra 2/3 of the colors. By placing a block higher or lower then the block north of it, or topside of the map, you can create a brighter or darker shade then the normal flat color.

With the flat method, the colors used is the 2nd shade of each color group can be used on the lists below. For the staircase method, the first 3 shades of the colors groups below. The 4th shade can not be obtained in traditional gameplay, but with the use of an external tool.

1.12 Color Table[edit | edit source]

Note: The terracotta values were measured with a screenshot. Values may differ slightly from the values in the Minecraft source code.

  1. a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt Stained glass has the same color as wool, if there is a non-transparent block underneath. Otherwise it is transparent.

Half slabs and stairs are displayed like full blocks.

1.8.1 Color Table[edit | edit source]

Note: The description may not list every possible block. Example: In 1.8.1, any block that uses colored wool can also use colored carpet or colored pane glass.

1.7.2 Color Table[edit | edit source]

Original Color Table[edit | edit source]

Code examples[edit | edit source]

This section is a stub. Please help us by expanding it.
Library name Language Link to Map-related code
MCModify Java
minecraftmap Python

References[edit | edit source]