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) - May not exist. 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.
 * : Optional. The Overworld position from which the player entered the Nether. Used for the minecraft:nether_travel 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 will remove this tag.
 * : The X coordinate.
 * : The Y coordinate.
 * : The Z coordinate.
 * : 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.

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.

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.

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

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.

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.

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.

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.

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

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

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

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

Maps
Maps may be scaled.
 * : The tag tag.

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

Debug Sticks
Debug sticks use the NBT to save the block state to edit for each block.
 * : The tag tag.
 * : A list of blocks and the state this debug stick will edit.
 * : The state name of the block to edit, for example.