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, HandDropChances, ArmorDropChances, CanPickUpLoot, PersistenceRequired, and Leash.
 * : Version of the player NBT structure. Is increased with every new snapshot and release.
 * : The game mode of the player. 0 is Survival, 1 is Creative, 2 is Adventure and 3 is Spectator.
 * : The Score displayed upon death.
 * : A namespaced ID of the dimension the player is in. Used to store the players last known location along with Pos.
 * : The selected hotbar slot of the player.
 * : Data of the item currently being held by the player, excluding the Slot tag.
 * See Item Format.
 * : May not exist. The dimension of the player's bed or respawn anchor. These tags are only removed if the player attempts to respawn with no valid bed or respawn anchor to spawn at at these coordinates. They are unaffected by breaking a bed or respawn anchor at these coordinates, and are unaffected by the player's death.
 * : See below.
 * : May not exist. The coordinates of the player's bed or respawn anchor. These tags are only removed if the player attempts to respawn with no valid bed or respawn anchor to spawn at at these coordinates. They are unaffected by breaking a bed or respawn anchor at these coordinates, and are unaffected by the player's death.
 * : See above.
 * : 1 or 0 (true/false) - May not exist. True if the player should spawn at the above coordinates even if no bed can be found.
 * : 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.
 * : Optional. The Overworld position from which the player entered the Nether, for use with the  advancement trigger. The tag is set every time the player passes through a portal from the Overworld to the Nether. Passing through a portal back to the Overworld does not remove or update the tag. Entering the Nether without using a portal does not update the tag. If a portal is hacked into the End, using it to enter the Nether removes this tag.
 * : The X coordinate.
 * : The Y coordinate.
 * : The Z coordinate.
 * : The root entity that the player is riding. Optional.
 * : The UUID of the entity the player is riding, stored as four ints.
 * : The NBT data of the root vehicle.
 * See Entity Format.
 * : The entity that is on the player's left shoulder. Always displays as a parrot.
 * See Entity Format.
 * : The entity that is on the player's right shoulder. Always displays 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.

General Tags
Items with durability can be made unbreakable and never lose any durability. Additionally, items can have specifications for Adventure mode to describe which blocks may be broken with them.
 * : Parent tag.

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.
 * : Parent tag

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.
 * : Parent tag.

StoredEnchantments tooltips are not displayed if edited onto an item other than an enchanted book. Enchantments stored in Enchantments, however, are always displayed in the tooltip and cause the item to glow, even if they cannot have any effect.

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 cease to exist if this tag is added (e.g. a Diamond Sword given an empty AttributeModifiers list no longer provides a boost to damage). Also note that the default vanilla AttributeModifiers do not actually use this tag, and as such, it does not appear on a natural item.
 * : Parent tag.

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.
 * : Parent tag.

Crossbows
Crossbows use NBT data to save what item is charged in the crossbow
 * : Parent tag.

Display Properties
Leather armor can be colored, and all items can have custom display names and lore. Various tooltips can also be hidden.
 * : Parent tag.

Written Books
Written books use NBT data to save their contents as well as miscellaneous extra information.
 * : Parent tag.

Book and Quills
Book and Quills use NBT data to save their contents.
 * : Parent tag.

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".
 * : Parent tag.

Fireworks
Fireworks use the tag tag to store information about their effects.
 * : Parent tag.

Armor Stands and Spawn Eggs
Armor stands and spawn eggs may contain potential entity data.
 * : Parent tag.

Buckets of Fish
Buckets of Fish may contain potential entity data.
 * : Parent tag.

Maps
Maps may be scaled.
 * : Parent tag.

Suspicious Stew
Suspicious stews store their potion effects.
 * : Parent tag.

Debug Sticks
Debug sticks use the NBT to save the block state to edit for each block.
 * : Parent tag.

Compasses

 * : Parent tag.