Map item format

From Minecraft Wiki
Jump to: navigation, search
Information icon.svg
This feature is exclusive to Java Edition.

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.

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

Data folder structure[edit]

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]

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

NBT structure[edit]

  • The root tag.
    •  data: The map data.
      •  scale: How zoomed in the map is (it is in 2scale wide blocks square per pixel, even for 0, where the map is 1:1). Default 3, minimum 0 and maximum 4.
      •  dimension: For <1.16 (byte): 0 = The Overworld, -1 = The Nether, 1 = The End, any other value = a static image with no player pin. In >=1.16 this is a string. [more information needed]
      •  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 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 makes the dot instead disappear when the player is farther than this distance. Defaults to 0 for maps created from an empty map and 1 for Explorer Maps.
      •  locked: 1 if the map has been locked in a cartography table.
      •  xCenter: Center of map according to real world by X.
      •  zCenter: Center of map according to real world by Z.
      •  banners: List of banner markers added to this map. May be empty.
        • A banner marker.
          •  Color: The color of the banner. Allowed values: white, orange, magenta, light_blue, yellow, lime, pink, gray, light_gray, cyan, purple, blue, brown, green, red, black.
          •  Name: The custom name of the banner, in JSON text. May not exist.
          •  Pos: The block position of the banner in the world.
            •  X: The x-position of the banner.
            •  Y: The y-position of the banner.
            •  Z: The z-position of the banner.
      •  frames: List map markers added to this map. May be empty.
        • A marker.
          •  EntityId: Arbitrary unique value for the marker.
          •  Rotation: The rotation of the marker, ranging from 0 to 360.
          •  Pos: The block position of the marker in the world.
            •  X: The x-position of the marker.
            •  Y: The y-position of the marker.
            •  Z: The z-position of the marker.
      •  colors: Width * Height array of color values (16384 entries for a default 128×128 map). Color can be accessed via the following method: colorID = Colors[widthOffset + heightOffset * width], where (widthOffset==0, heightOffset==0) is left upper point.
    •  DataVersion: The version the map was created. If not present, defaults to 1343 (1.12.2)

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]

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

NBT structure[edit]

  • The root tag.
    •  Data
      •  map: Latest map ID.
    •  DataVersion

Color table[edit]

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

Base colors[edit]

The data for Java release versions is current as of 1.16.2. (needs to be checked/updated to 1.16.3). 14:29, 11 August 2020 (UTC)
The data for Java snapshots is current as of 1.16.2 Release Candidate 2. (needs to be checked/updated to 1.16.4 Release Candidate 1). 14:29, 11 August 2020 (UTC)

Blocks are colored according to their material. Each material has a base color which is multiplied by 135, 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 Color RGB Blocks
0 NONE Transparent Air, Void Air, Cave Air, Barrier, Redstone Lamp, Cake, Powered Rail, Detector Rail, Torch, Redstone Wire, Ladder, Rail, Lever, Redstone Torch, Buttons, Repeater, Tripwire Hook, Tripwire, Flower Pot, Head, Comparator, Activator Rail, End Rod, Glass, Glass Pane, Nether Portal, Stained Glass Pane (all colors), Structure Void, Iron Bars, Soul Fire Torch, Chain
1 GRASS 127, 178, 56 Grass Block, Slime Block
2 SAND 247, 233, 163 Sand, Birch (Planks, Log (vertical), Stripped Log, Wood, Stripped Wood, Sign, Pressure Plate, Trapdoor, Stairs, Slab, Fence Gate, Fence, Door), Sandstone (All variants, all slabs, all stairs, all walls), Glowstone, End Stone, End Stone Bricks (slab, stairs, wall), Bone Block, Turtle Egg, Scaffolding
3 WOOL 199, 199, 199 Cobweb, Mushroom Stem, Bed (head)
4 FIRE 255, 0, 0 Lava, TNT, Fire, Redstone Block
5 ICE 160, 160, 255 Ice, Frosted Ice, Packed Ice, Blue Ice
6 METAL 167, 167, 167 Block of Iron, Iron Door, Brewing Stand, Heavy Weighted Pressure Plate, Iron Trapdoor, Lantern, Anvil, Grindstone, Soul Fire Lantern, Lodestone
7 PLANT 0, 124, 0 Sapling, Flowers, Wheat, Sugar Cane, Pumpkin Stem, Melon Stem, Lily Pad, Cocoa, Carrots, Potatoes, Beetroots, Sweet Berry Bush, Grass, Fern, Vines, Leaves, Cactus, Bamboo
8 SNOW 255, 255, 255 Snow, Snow Block, White (Bed (foot), Wool, Stained Glass, Carpet, Banner, Shulker Box, Glazed Terracotta, Concrete, Concrete Powder)
9 CLAY 164, 168, 184 Clay, Infested Block (Stone, Cobblestone, Stone Brick, Mossy Stone Brick, Cracked Stone Brick, Chiseled Stone Brick)
10 DIRT 151, 109, 77 Dirt, Coarse Dirt, Farmland, Grass Path, Granite (slab, stairs, wall), Polished Granite (slab, stairs), Jungle (Planks, Log (vertical), Stripped Log, Wood, Stripped Wood, Sign, Pressure Plate, Trapdoor, Stairs, Slab, Fence Gate, Fence, Door), Jukebox, Brown Mushroom Block
11 STONE 112, 112, 112 Stone (slab, stairs), Andesite (slab, stairs, wall), Polished Andesite (slab, stairs), Cobblestone (slab, stairs), Bedrock, Gold Ore, Iron Ore, Coal Ore, Lapis Lazuli Ore, Dispenser, Mossy Cobblestone (slab, stairs, wall), Spawner, Diamond Ore, Furnace, Stone Pressure Plate, Redstone Ore, Stone Bricks (all variants, all slabs, all stairs, all walls), Emerald Ore, Ender Chest, Dropper, Smooth Stone (slab, stairs), Observer, Smoker, Blast Furnace, Stonecutter, Sticky Piston, Piston, Piston Head, Gravel, Acacia Log (side), Cauldron, Hopper
12 WATER 64, 64, 255 Kelp, Seagrass, Water, Bubble Column
13 WOOD 143, 119, 72 Oak (Planks, Log (vertical), Stripped Log, Wood, Stripped Wood, Sign, Door, Pressure Plate, Fence, Trapdoor, Fence Gate, Slab, Stairs), Note Block, Bookshelf, Chest, Crafting Table, Trapped Chest, Daylight Detector, Loom, Barrel, Cartography Table, Fletching Table, Lectern, Smithing Table, Composter, Bamboo Sapling, Dead Bush, Petrified Oak Slab, Beehive
14 QUARTZ 255, 252, 245 Diorite, Polished Diorite, Birch Log (side), Quartz Block (all variants, all slabs, all stairs), Sea Lantern, Target
15 COLOR_ORANGE 216, 127, 51 Acacia (Planks, Log (vertical), Stripped Log, Stripped Wood, Sign, Trapdoor, Slab), Red Sand, Orange (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Pumpkin, Carved Pumpkin, Jack o'Lantern, Terracotta, Red Sandstone (all variants, all stairs, all slabs, all walls), Honey Block, Honeycomb Block
16 COLOR_MAGENTA 178, 76, 216 Magenta (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Purpur (all variants, slab, stairs)
17 COLOR_LIGHT_BLUE 102, 153, 216 Light Blue (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Soul Fire
18 COLOR_YELLOW 229, 229, 51 Sponge, Wet Sponge, Yellow (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Hay Bale, Horn Coral (Coral Block, Coral, Coral Fan), Bee Nest
19 COLOR_LIGHT_GREEN 127, 204, 25 Lime (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Melon
20 COLOR_PINK 242, 127, 165 Pink (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Brain Coral (Coral Block, Coral, Coral Fan)
21 COLOR_GRAY 76, 76, 76 Acacia Wood, Gray (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Dead Coral (Coral Block, Coral, Coral Fan)
22 COLOR_LIGHT_GRAY 153, 153, 153 Light Gray (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Structure Block, Jigsaw Block
23 COLOR_CYAN 76, 127, 153 Cyan (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Prismarine (slab, stairs, wall), Warped (Roots, Pressure Plate, Fence, Trapdoor, Fence Gate, Door, Sign, Fungus), Twisting Vines, Nether Sprouts
24 COLOR_PURPLE 127, 63, 178 Shulker Box, Purple (Wool, Carpet, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Mycelium, Chorus Plant, Chorus Flower, Repeating Command Block, Bubble Coral (Coral Block, Coral, Coral Fan)
25 COLOR_BLUE 51, 76, 178 Blue (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Tube Coral (Coral Block, Coral, Coral Fan)
26 COLOR_BROWN 102, 76, 51 Dark Oak (Planks, Log, Stripped Log, Wood, Stripped Wood, Sign, Pressure Plate, Trapdoor, Stairs, Slab, Fence Gate, Fence, Door), Spruce Log (side), Brown (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Soul Sand, Command Block, Brown Mushroom, Soul Soil
27 COLOR_GREEN 102, 127, 51 Green (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), End Portal Frame, Chain Command Block, Dried Kelp Block, Sea Pickle
28 COLOR_RED 153, 51, 51 Red (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Bricks (slab, stairs, wall), Red Mushroom Block, Nether Wart, Enchanting Table, Nether Wart Block, Fire Coral (Coral Block, Coral, Coral Fan), Red Mushroom, Shroomlight
29 COLOR_BLACK 25, 25, 25 Black (Wool, Carpet, Shulker Box, Bed (foot), Stained Glass, Banner, Glazed Terracotta, Concrete, Concrete Powder), Obsidian, End Portal, Dragon Egg, Coal Block, End Gateway, Basalt, Polished Basalt, Block of Netherite, Ancient Debris, Crying Obsidian, Respawn Anchor, Blackstone, Polished Blackstone, Polished Blackstone Bricks, Gilded Blackstone
30 GOLD 250, 238, 77 Block of Gold, Light Weighted Pressure Plate, Bell
31 DIAMOND 92, 219, 213 Block of Diamond, Beacon, Prismarine Bricks (slab, stairs), Dark Prismarine (slab, stairs), Conduit
32 LAPIS 74, 128, 255 Lapis Lazuli Block
33 EMERALD 0, 217, 58 Block of Emerald
34 PODZOL 129, 86, 49 Podzol, Spruce (Planks, Log (vertical), Stripped Log, Wood, Stripped Wood, Sign, Pressure Plate, Trapdoor, Stairs, Slab, Fence Gate, Fence, Door), Oak Log (side), Jungle Log (side), Campfire, Soul Campfire
35 NETHER 112, 2, 0 Netherrack, Nether Bricks (fence, slab, stairs, wall, chiseled, cracked), Nether Gold Ore, Nether Quartz Ore, Magma Block, Red Nether Bricks (slab, stairs, wall), Crimson (Roots, Pressure Plate, Fence, Trapdoor, Fence Gate, Door, Sign, Fungus), Weeping Vines
36 TERRACOTTA_WHITE 209, 177, 161 White Terracotta
37 TERRACOTTA_ORANGE 159, 82, 36 Orange Terracotta
38 TERRACOTTA_MAGENTA 149, 87, 108 Magenta Terracotta
39 TERRACOTTA_LIGHT_BLUE 112, 108, 138 Light Blue Terracotta
40 TERRACOTTA_YELLOW 186, 133, 36 Yellow Terracotta
41 TERRACOTTA_LIGHT_GREEN 103, 117, 53 Lime Terracotta
42 TERRACOTTA_PINK 160, 77, 78 Pink Terracotta
43 TERRACOTTA_GRAY 57, 41, 35 Gray Terracotta
44 TERRACOTTA_LIGHT_GRAY 135, 107, 98 Light Gray Terracotta
45 TERRACOTTA_CYAN 87, 92, 92 Cyan Terracotta
46 TERRACOTTA_PURPLE 122, 73, 88 Purple (Terracotta, Shulker Box)
47 TERRACOTTA_BLUE 76, 62, 92 Blue Terracotta
48 TERRACOTTA_BROWN 76, 50, 35 Brown Terracotta
49 TERRACOTTA_GREEN 76, 82, 42 Green Terracotta
50 TERRACOTTA_RED 142, 60, 46 Red Terracotta
51 TERRACOTTA_BLACK 37, 22, 16 Black Terracotta
52 CRIMSON_NYLIUM 189, 48, 49 Crimson Nylium
53 CRIMSON_STEM 148, 63, 97 Crimson (Stem, Stripped Stem, Planks, Stairs, Slab)
54 CRIMSON_HYPHAE 92, 25, 29 Crimson (Hyphae, Stripped Hyphae)
55 WARPED_NYLIUM 22, 126, 134 Warped Nylium
56 WARPED_STEM 58, 142, 140 Warped (Stem, Stripped Stem, Planks, Stairs, Slab)
57 WARPED_HYPHAE 86, 44, 62 Warped (Hyphae, Stripped Hyphae)
58 WARPED_WART_BLOCK 20, 180, 133 Warped Wart Block

Map colors[edit]

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 down to a whole number. As of 1.8.1-pre1, 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 = Multiplier
Base Color ID×4 + 0 180 0.71
Base Color ID×4 + 1 220 0.86
Base Color ID×4 + 2 255 (same color) 1
Base Color ID×4 + 3 135 0.53
All the different shades of each color, excluding water

Map Pixel Art[edit]

Redstonehelper uses the staircase method in survival

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

Two methods exist for creating map pixel art: flat and staircase. The flat method involves laying the pixel image across a flat surface, effectively creating a floor. The flat method is the easier of the two methods, but offers a smaller palette of only 58 colors. The staircase method offers 174 colors, but is much more complicated to use. In the staircase method, blocks are placed at different elevations to obtain specific color variations. A block's color is darker if placed at a lower elevation than the block north of it, or brighter if placed at a higher elevation than the block north of it. (This is a case of the mapping convention of top lighting.)

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

Full color tables[edit]

The content of this section is disputed.
The color IDs for 1.7.2, 1.8.1, and 1.12 appear incompatible with each other, which conflicts with third-party code samples.
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.

Code examples[edit]

Listed below are some libraries used for modifying and exporting map data.

Library name, color version Language Link to Map-related code
MCModify (1.8) Java Map.java
minecraftmap (1.7) Python __init__.py
mcmapimg (1.16) Python mcmapimg.py

History[edit]

Clock JE2 BE2.gif
This section needs to be updated.
The reason given is: Incomplete history. TODO: find versions where block colors were added for new blocks
Please update this section to reflect recent updates or newly available information.
Java Edition Beta
?When Notch was adding maps for the first time he did not use the NBT format.[1]
1.6Test Build 3Added maps.
Map IDs are limited to the size of a short (32,768).[2]
Java Edition
1.8.1pre1Added the color "NETHER" (35), increasing the number of base colors from 35 to 36.
The shading multiplier for the fourth color is changed from 220 (0.86) to 135 (0.53).
1.1217w17aAdded 16 map colors for every color of terracotta: "TERRACOTTA_WHITE" (36), "TERRACOTTA_ORANGE" (37), "TERRACOTTA_MAGENTA" (38), "TERRACOTTA_LIGHT_BLUE" (39), "TERRACOTTA_YELLOW" (40), "TERRACOTTA_LIGHT_GREEN" (41), "TERRACOTTA_PINK" (42), "TERRACOTTA_GRAY" (43), "TERRACOTTA_LIGHT_GRAY" (44), "TERRACOTTA_CYAN" (45), "TERRACOTTA_PURPLE" (46), "TERRACOTTA_BLUE" (47), "TERRACOTTA_BROWN" (48), "TERRACOTTA_GREEN" (49), "TERRACOTTA_RED" (50), and "TERRACOTTA_BLACK" (51), increasing the number of base colors from 36 to 52
1.1317w47aMaps ids are no longer shorts, but rather ints, as they are no longer based on damage values of the item.
idcounts.dat now uses an int instead of a short.
18w19aAdded DataVersion to saved map_<#>.dat. (idcounts.dat still doesn't have a DataVersion)
1.1419w02aAdded locked to saved map_<#>.dat.
1.16Pre-release 6Added 7 new colors: "CRIMSON_NYLIUM" (52), "CRIMSON_STEM" (53), "CRIMSON_HYPHAE" (54), "WARPED_NYLIUM" (55), "WARPED_STEM" (56), "WARPED_HYPHAE" (57), and "WARPED_WART_BLOCK" (58), increasing the number of base colors from 52 to 59

References[edit]