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

 * TAG_Compound(""): The root tag. In level.dat files, this tag is called "Player".
 * All tags from Entities except the "id" tag.
 * All tags from Mobs.
 * TAG_Int("Dimension"): The dimension the player is in. -1 is The Nether, 0 is The Overworld, 1 is The End. Other values are interpreted as 0.
 * TAG_Int("playerGameType"): The game mode of the player. 0 is Survival Mode, 1 is Creative Mode, and 2 is Adventure Mode.
 * TAG_Int("SpawnX"): See below.
 * TAG_Int("SpawnY"): 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.
 * TAG_Int("SpawnZ"): See above.
 * TAG_Byte("Sleeping"): 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.
 * TAG_Short("SleepTimer"): The number of ticks the player had been in bed when this tag was saved. No effect.
 * TAG_Int("foodLevel"): The value of the hunger bar; 20 is full. See Hunger.
 * TAG_Float("foodExhaustionLevel"): See Hunger.
 * TAG_Float("foodSaturationLevel"): See Hunger.
 * TAG_Int("foodTickTimer"): See Hunger.
 * TAG_Int("XpLevel"): The level shown on the XP bar.
 * TAG_Float("XpP"): The progress/percent across the XP bar to the next level.
 * TAG_Int("XpTotal"): The total amount of XP the player has collected over time; used for the Score upon death.
 * TAG_List("Inventory"): Each TAG_Compound in this list is an item in the player's inventory.
 * TAG_Compound: An item in the inventory, includes the Slot tag.
 * See Item Structure below.
 * TAG_List("EnderItems"): 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.
 * TAG_Compound: An item in the chest, includes the Slot tag. Slots are numbered 0 to 26.
 * See Item Structure below.
 * TAG_Compound("abilities"): The abilities this player has.
 * TAG_Float("walkSpeed"): The walking speed, always 0.1.
 * TAG_Float("flySpeed"): The flying speed, always 0.05.
 * TAG_Byte("mayfly"): 1 or 0 (true/false) - true if the player can fly.
 * TAG_Byte("flying"): 1 or 0 (true/false) - true if the player is currently flying.
 * TAG_Byte("invulnerable"): 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)
 * TAG_Byte("mayBuild"): 1 or 0 (true/false) - true if the player can place and destroy blocks.
 * TAG_Byte("instabuild"): 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. Note: Books may have enchantments; the enchantments are listed underneath the author of written books.
 * TAG_Compound: The item's root tag. Some instances may give this tag a name, other times it is nameless because it is in a list.
 * TAG_Byte("Slot"): May not exist. The inventory slot the item is in.
 * TAG_Short("id"): Item or Block ID.
 * TAG_Short("Damage"): 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.
 * TAG_Byte("Count"): 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.
 * TAG_Compound("tag")
 * TAG_List("ench"): Contains enchantments for this item.
 * TAG_Compound: One of these for each enchantment.
 * TAG_Short("id"): Id of the Enchantment.
 * TAG_Short("lvl"): Level of the Enchantment
 * TAG_String("title"): For Written Book, the title of the book.
 * TAG_String("author"): For Written Book, the author of the book.
 * TAG_List("pages"): For Book and Quill and Written Book, the list of pages in the book.
 * TAG_String: A single page in the book.