Player.dat format

 .dat files are used by servers to store the state of individual players. The format is also used within level.dat files to store the state of the singleplayer player, which overrides any .dat files with the same name as the singleplayer player. These files are in NBT format.

NBT structure

 * The root tag. In level.dat files, this tag is called "Player".
 * All tags from Entities except the id, CustomName, and CustomNameVisible tags.
 * All tags from Mobs except HandItems, ArmorItems, DropChances, CanPickUpLoot, PersistenceRequired, Leashed, and Leash.
 * : Version of the player NBT structure. Is increased with every new snapshot and release.
 * : The dimension the player is in. -1 is the Nether, 0 is the Overworld, 1 is the End. Other values are interpreted as 0.
 * : The game mode of the player. 0 is Survival, 1 is Creative, 2 is Adventure and 3 is Spectator.
 * : The Score displayed upon death.
 * : The selected hotbar slot of the player.
 * : Data of the item currently being held by the player, excluding the Slot tag.
 * See Item Format.
 * : See below.
 * : May not exist. The coordinates of the player's bed. These tags are only removed if the player attempts to respawn with no valid bed to spawn at at these coordinates. They are unaffected by breaking beds at these coordinates, and are unaffected by the player's death.
 * : See above.
 * : 1 or 0 (true/false) - True if the player should spawn at the above coordinates even if no bed can be found.
 * : 1 or 0 (true/false) - true if the player was in a bed; has no effect on whether the player is in a bed when they log in.
 * : The number of ticks the player had been in bed. No effect.
 * : The value of the hunger bar; 20 is full. See Hunger.
 * : See Hunger.
 * : See Hunger.
 * : See Hunger.
 * : The level shown on the XP bar.
 * : The progress/percent across the XP bar to the next level.
 * : The total amount of XP the player has collected over time; used for the Score upon death.
 * : The seed used for the next enchantment in enchantment tables.
 * : Each compound tag in this list is an item in the player's inventory. (Note: when empty, list type may have unexpected value.)
 * An item in the inventory, includes the Slot tag.
 * See Item Structure below.
 * : Each compound tag in this list is an item in the player's 27-slot ender chest inventory. (Note: when empty, list type may have unexpected value.)
 * An item in the inventory, includes the Slot tag - slots are numbered 0 to 26, inclusive.
 * See Item Structure below.
 * : The abilities this player has.
 * : The walking speed, always 0.1.
 * : The flying speed, always 0.05.
 * : 1 or 0 (true/false) - true if the player can fly.
 * : 1 or 0 (true/false) - true if the player is currently flying.
 * : 1 or 0 (true/false) - true if the player is immune to all damage and harmful effects except for void damage. (damage caused by the command is void damage)
 * : 1 or 0 (true/false) - true if the player can place and destroy blocks.
 * : 1 or 0 (true/false) - true if the player can instantly destroy blocks.
 * : The root entity that the player is riding.
 * : The UUIDLeast of the entity the player is riding.
 * : The UUIDMost of the entity the player is riding.
 * : The NBT data of the root vehicle.
 * See Entity Format.
 * : The entity that is on the player's left shoulder. Will always display as a parrot.
 * See Entity Format.
 * : The entity that is on the player's right shoulder. Will always display as a parrot.
 * See Entity Format.
 * : 1 or 0 (true/false) - true if the player has traveled to the Overworld via an End portal.
 * : Contains a JSON object detailing recipes the player has unlocked.
 * See Recipe Book.

Item structure
Items are used both in the player's inventory and Ender inventory, and in chest tile entities, dropped item entities, furnace tile entities, brewing stand tile entities, and Villager trading recipes. Sometimes a Slot tag is used to specify the slot the item is in, such as with chests; other times there is no Slot tag, such as with dropped items.
 * The item's root tag. Some instances may give this tag a name, other times it is nameless because it is in a list.
 * : Number of items stacked in this inventory slot. Any item can be stacked, including tools, armor, and vehicles. Range is -128 to 127. Values of 1 are not displayed in-game. Values below 1 are displayed in red.
 * : May not exist. The inventory slot the item is in.
 * : The data value for this item. The name "Damage" comes from when only tools used this value, now many other items use this value for other purposes. For blocks, it is the 4-bit "block data" tag that determines a variant of the block. Defaults to 0.
 * : Item/Block ID (This is a Short tag prior to 1.8.) If not specified, Minecraft changes the item to stone (setting ID to 1 and Damage to 0, and ignoring any existing Damage value) when loading the chunk or summoning the item.
 * : Additional information about the item, discussed in the below sections. This tag is optional for most items.

General Tags
Items with durability can be made unbreakable and will never lose any durability. Additionally, items can have specifications for Adventure mode to describe which blocks may be broken with them.
 * : The tag tag.
 * : The damage value for this item. Defaults to 0.
 * : 1 or 0 (true/false) - if true, the item doesn't lose durability when used.
 * : The only blocks this item may break when used by a player in adventure mode.
 * : The block ID.

Block Tags
Blocks can be given tags to specify what blocks they may be placed against in Adventure mode, and to specify what Tile Entity NBT tags to apply to them when placed.
 * : The tag tag.
 * : Determines which blocks that blocks with this tag can be placed against in adventure mode.
 * : The block ID.
 * : Block entity NBT tags which are applied when this block is placed. Used to store data on banners and shields or on blocks obtained in creative by holding (or  on mac) and pressing  on a block containing a block entity.
 * See Tile Entity Format. Excludes x, y, z, and id tags.

Enchantments
There are two ways enchantments are associated with items; the first way is that the item is actually enchanted and the enchantment affects the behavior of the item, and the second way is that the item is an enchanted book which simply stores the enchantments without actually affecting the behavior of the item. There is also the RepairCost tag which tracks anvil usage for items, making them more costly with every use of the anvil. StoredEnchantments tooltips will not be displayed if edited onto an item other than an enchanted book. Enchantments stored in ench, however, will always be displayed in the tooltip and will cause the item to glow, even if they cannot have any effect.
 * : The tag tag.
 * : Contains enchantments on this item that affect the way the item works.
 * : A single enchantment.
 * : ID of the enchantment.
 * : Level of the enchantment, where 1 is level 1.
 * : Contains enchantments on this item that affect the way the item works.
 * : A single enchantment.
 * : The name of the enchantment.
 * : The level of the enchantment, where 1 is level 1.
 * : Contains enchantments for enchanted books.
 * : A stored enchantment, identical structure to each enchantment in ench (Enchantments).
 * : Number of enchantment levels to add to the base level cost when repairing, combining, or renaming this item with an Anvil.

Attribute Modifiers
All items can be given Modifiers which affect various Attributes of the player/mob which wears or holds them. Note that if an item has vanilla default AttributeModifiers, these will cease to exist if this tag is added (e.g. a Diamond Sword given an empty AttributeModifiers list will no longer provide a boost to damage). Also note that the default vanilla AttributeModifiers do not actually use this tag, and as such, it will not appear on a natural item.
 * : The tag tag.
 * : Contains Attribute Modifiers on this item which modify Attributes of the wearer or holder (if the item is not in the hand or armor slots, it will have no effect).
 * : A single Attribute Modifier.
 * : The name of the Attribute this Modifier is to act upon.
 * : Name of the Modifier
 * : Slot the item must be in for the modifier to take effect. "mainhand", "offhand", "feet", "legs", "chest", or "head".
 * : Modifier Operation. See Attribute Modifiers for info.
 * : Amount of change from the modifier.
 * : Uppermost bits of the modifier's UUID.
 * : Lowermost bits of the modifier's UUID.

Potion Effects
Potions, splash potions, lingering potions and tipped arrows can have multiple, customized effects via the CustomPotionEffects tag. These effects are added to the default effect under the Potion tag if present. In addition the color can be overridden with the CustomPotionColor tag.
 * : The tag tag.
 * : The custom Potion effects this potion has.
 * One of these for each effect.
 * : The ID of the effect.
 * : The amplifier of the effect, with 0 being level 1.
 * : The duration of the effect in ticks.
 * : 1 or 0 (true/false) - whether or not this is an effect provided by a beacon and therefore should be less intrusive on the screen. This tag is optional and defaults to 0. Due to a bug, it has no effect on splash potions.
 * : 1 or 0 (true/false) - whether or not this effect produces particles. This tag is optional and defaults to 1. Due to a bug, it has no effect on splash potions.
 * : The name of the default potion effect. This name differs from the potion effect name. For example, the value for an "Instant Health II" potion is "minecraft:strong_healing".
 * : The overrides the color of the potion, to be the prescribed color (same format as leather armor colors below).

Display Properties
Leather armor can be colored, and all items can have custom display names and lore. Various tooltips can also be hidden.
 * : The tag tag.
 * : Display properties.
 * : The color of the leather armor. The tooltip will display "Dyed" if advanced tooltips are disabled or will otherwise display the hexadecimal color value. Color codes are calculated from the Red, Green and Blue components using this formula:  Red <<16 + Green <<8 + Blue 
 * : The name to display for an item, or the JSON text component to use to display the item.
 * : A localization string to translate (e.g. ).
 * : List of strings to display as lore for the item.
 * A line of text for the lore of an item.
 * : Bit field determining which parts of the tooltip to hide on an item. 1 for "ench", 2 for "AttributeModifiers", 4 for "Unbreakable", 8 for "CanDestroy", 16 for "CanPlaceOn", and 32 for various other information (including potion effects, "StoredEnchantments", written book "generation" and "author", "Explosion", "Fireworks", and map tooltips). For example, setting to 3 would hide both "ench" and "AttributeModifiers" tags, and setting to 63 would hide everything.

Written Books
Both book and quill and written book use the tag tag to store information about the book. Only written books store the title, author, and generation of the book; pages is stored in both varieties.

Player Heads
Heads of the player variety can be associated with a specific username to take on the skin of that player when placed. The hand-held item is also updated with the new skin. Within this section, the "owner" of a head means the player whose head it is a copy of, and a player whose inventory contains a head is called the "holder".
 * : The tag tag.
 * (deprecated since 1.8): The username of the player this is a skull of for pre-1.8. Note that  is for the item in inventories, whereas   is for skull blocks placed on the ground.
 * : definition for the skull's owner. Note that  is used for skulls placed on the ground.
 * : UUID of owner. Optional. Used to update the other tags when the chunk loads or the holder logs in, in case the owner's name has changed.
 * : Username of owner. If missing or empty, the head will appear as a Steve head. Otherwise, used to store or retrieve the downloaded skin in the cache. Need not be a valid player name, but must not be all spaces.
 * : An individual texture.
 * : Optional.
 * : A Base64-encoded JSON object.
 * : Optional: Unix time in milliseconds.
 * : Optional: Player UUID without hyphens.
 * : Optional: Player name.
 * : Optional.
 * : URL of a player skin on textures.minecraft.net.
 * : Optional.
 * : URL of a player cape (64x32 PNG).
 * : URL of a player skin on textures.minecraft.net.
 * : Optional.
 * : URL of a player cape (64x32 PNG).
 * : URL of a player cape (64x32 PNG).

Fireworks
Fireworks use the tag tag to store information about their effects.
 * : The tag tag.
 * : One of these may appear on a firework star.
 * : 1 or 0 (true/false) - true if this explosion will have the Twinkle effect (glowstone dust). May be absent.
 * : 1 or 0 (true/false) - true if this explosion will have the Trail effect (diamond). May be absent.
 * : The shape of this firework's explosion. 0 = Small Ball, 1 = Large Ball, 2 = Star-shaped, 3 = Creeper-shaped, 4 = Burst. Other values will be named "Unknown Shape" and render as Small Ball.
 * : Array of integer values corresponding to the primary colors of this firework's explosion. If custom color codes are used, the game will render it as "Custom" in the tooltip, but the proper color will be used in the explosion. Custom colors are integers in the same format as the color tag from Display Properties.
 * : Array of integer values corresponding to the fading colors of this firework's explosion. Same handling of custom colors as Colors. May be absent.
 * : One of these may appear on a firework rocket.
 * : Indicates the flight duration of the firework (equals the amount of gunpowder used in crafting the rocket). While this value can be anything from -128 to 127, values of -2 and under almost never detonate at all.
 * : List of compounds representing each explosion this firework will cause.
 * Same format as 'Explosion' compound on a firework star, as described above.

Armor stands and spawn eggs
Armor stands and spawn eggs may contain potential entity data.
 * : The tag tag.
 * : Stores entity data that is applied to the armor stand when placed or entity when spawned.
 * See Entity Format.

Maps
Maps may be scaled.
 * : The tag tag.
 * : The map number.
 * : Only internally used when scaling a map, after that directly removed: The amount to increase the current map scale by when crafting. Always 1.
 * : Only internally used when scaling a map, after that directly removed: 1 or 0 (true/false) - whether or not player markers should be added and updated. Currently unused.
 * : A list of optional icons to display on the map. Decorations that are removed or modified will not update until the world is reloaded.
 * An individual decoration.
 * : An arbitrary unique string identifying the decoration.
 * : The ID of the map icon to display.
 * : The world X position of the decoration.
 * : The world Z position of the decoration.
 * : The rotation of the symbol, ranging from 0.0 to 360.0, measured clockwise. A rotation of 0 displays the icon upside-down compared to its appearance in the icon texture.
 * : The display tag.
 * : The color of the markings on the item's texture.