Player.dat format

 .dat files are used by Servers and Singleplayer 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" tag.
 * All tags from Mobs.
 * : 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 Mode, 1 is Creative Mode, and 2 is Adventure Mode.
 * : 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.
 * : 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 when this tag was saved; 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 when this tag was saved. 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.
 * : Each TAG_Compound in this list is an item in the player's inventory.
 * An item in the inventory, includes the Slot tag.
 * See Item Structure below.
 * : If there are no items in the player's Ender chest, this is a list of Byte tags with size 0. If there are items, this is a list of Compound tags.
 * An item in the chest, includes the Slot tag. Slots are numbered 0 to 26.
 * See Item Structure below.
 * : The abilities this player has.
 * : The walking speed, always 0.1. Can be used to move faster in singleplayer.
 * : The flying speed, always 0.05. Can be used to fly faster.
 * : 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 /kill 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.

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 was 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.
 * : May not exist. The inventory slot the item is in.
 * : Item or Block ID.
 * : 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.
 * : Number of items stacked in this inventory slot. Any item can be stacked, including tools, armor, and vehicles. Range is -128 to 127. Values below 2 are not displayed in-game.
 * : Additional information about the item.
 * : Contains enchantments for this item.
 * One of these for each enchantment.
 * : Id of the Enchantment.
 * : Level of the Enchantment
 * : Contains enchantments for enchanted books.
 * One of these for each enchantment. Contents have same format as ench tag.
 * : For Written Book, the title of the book.
 * : For Written Book, the author of the book.
 * : For Book and Quill and Written Book, the list of pages in the book.
 * A single page in the book.
 * : Display properties.
 * : The color of the item (used most commonly for leather armor). 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.
 * : List of strings to display as lore for the item.
 * A Line of text for the lore of an item.
 * : Contains custom potion effects for potions. If this is not included, default is used. The color is defined by its data value
 * One of these for each potion effect.
 * : The ID of the potion effect.
 * : The amplifier of the potion effect, starting at 0, meaning Strength I will be 0 and Strength II will be 1.
 * : The duration of the potion effect in ticks.
 * : 1 or 0 (true/false) - this corresponds to the Ambient potion effect variable for mobs, but seems to have no effect when added to an item. If this tag is included, the game expects it to be of type TAG_Byte, but it may safely be omitted.
 * : The owner of the player head. The skin will change to match the owner named.
 * : Number of enchantment levels to add to the base level cost when repairing, combining, or renaming this item with an Anvil.
 * : 1 or 0 (true/false) - unknown.
 * : 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.
 * : 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.
 * : Number from 1-3 indicating the flight duration of this firework (equals the amount of gunpowder used in crafting the rocket). This value can also be smaller to make the firework detonate sooner - however, 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.