Player.dat format

From Minecraft Wiki
Jump to: navigation, search

<player>.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 <player>.dat files with the same name as the Singleplayer player. These files are in NBT format.

Contents

[edit] NBT structure

  • Nbtsheet.png The root tag. In level.dat files, this tag is called "Player".
    • All tags from Entities except the "id" tag.
    • All tags from Mobs.
    • Nbtsheet.png 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.
    • Nbtsheet.png playerGameType: The game mode of the player. 0 is Survival Mode, 1 is Creative Mode, and 2 is Adventure Mode.
    • Nbtsheet.png Score: The Score displayed upon death.
    • Nbtsheet.png SelectedItemSlot: The selected hotbar slot of the player.
    • Nbtsheet.png SpawnX: See below.
    • Nbtsheet.png 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.
    • Nbtsheet.png SpawnZ: See above.
    • Nbtsheet.png SpawnForced: 1 or 0 (true/false) - True if the player should spawn at the above coordinates even if no bed can be found.
    • Nbtsheet.png 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.
    • Nbtsheet.png SleepTimer: The number of ticks the player had been in bed when this tag was saved. No effect.
    • Nbtsheet.png foodLevel: The value of the hunger bar; 20 is full. See Hunger.
    • Nbtsheet.png foodExhaustionLevel: See Hunger.
    • Nbtsheet.png foodSaturationLevel: See Hunger.
    • Nbtsheet.png foodTickTimer: See Hunger.
    • Nbtsheet.png XpLevel: The level shown on the XP bar.
    • Nbtsheet.png XpP: The progress/percent across the XP bar to the next level.
    • Nbtsheet.png XpTotal: The total amount of XP the player has collected over time; used for the Score upon death.
    • Nbtsheet.png Inventory: Each compound tag in this list is an item in the player's inventory.
    • Nbtsheet.png 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.
      • Nbtsheet.png An item in the chest, includes the Slot tag. Slots are numbered 0 to 26.
    • Nbtsheet.png abilities: The abilities this player has.
      • Nbtsheet.png walkSpeed: The walking speed, always 0.1.
      • Nbtsheet.png flySpeed: The flying speed, always 0.05.
      • Nbtsheet.png mayfly: 1 or 0 (true/false) - true if the player can fly.
      • Nbtsheet.png flying: 1 or 0 (true/false) - true if the player is currently flying.
      • Nbtsheet.png 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)
      • Nbtsheet.png mayBuild: 1 or 0 (true/false) - true if the player can place and destroy blocks.
      • Nbtsheet.png instabuild: 1 or 0 (true/false) - true if the player can instantly destroy blocks.

[edit] 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.

  • Nbtsheet.png The item's root tag. Some instances may give this tag a name, other times it is nameless because it is in a list.
    • Nbtsheet.png Slot: May not exist. The inventory slot the item is in.
    • Nbtsheet.png id: Item or Block ID.
    • Nbtsheet.png 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.
    • Nbtsheet.png 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.
    • Nbtsheet.png tag: Additional information about the item, discussed in the below sections. This tag is optional for most items.

[edit] 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.

  • Nbtsheet.png tag: The tag tag.
    • Nbtsheet.png ench: Contains enchantments on this item that affect the way the item works.
      • Nbtsheet.png: A single enchantment.
        • Nbtsheet.png id: ID of the enchantment.
        • Nbtsheet.png lvl: Level of the enchantment, where 0 is level 1.
    • Nbtsheet.png StoredEnchantments: Contains enchantments for enchanted books.
      • Nbtsheet.png: A stored enchantment, identical structure to each enchantment in ench.
    • Nbtsheet.png RepairCost: Number of enchantment levels to add to the base level cost when repairing, combining, or renaming this item with an Anvil.

[edit] 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 and author of the book, and pages is stored in both varieties.

  • Nbtsheet.png tag: The tag tag.
    • Nbtsheet.png title: The title of the written book.
    • Nbtsheet.png author: The author of the written book.
    • Nbtsheet.png pages: The list of pages in the book.
      • Nbtsheet.png A single page in the book.

[edit] Display Properties

Leather Armor can be colored, and all items can have custom display names and lore.

  • Nbtsheet.png tag: The tag tag.
    • Nbtsheet.png display: Display properties.
      • Nbtsheet.png color: The color of the leather armor. Color codes are calculated from the Red, Green and Blue components using this formula:
        Red<<16 + Green<<8 + Blue
        (Note that because of Java byte-ordering, this calculation is in reverse from almost all other popular languages and libraries which use R+256*G+65536*B)
      • Nbtsheet.png Name: The name to display for an item.
      • Nbtsheet.png Lore: List of strings to display as lore for the item.[1]
        • Nbtsheet.png A line of text for the lore of an item.

[edit] Potion Effects

Potions and Splash Potions can have multiple, customized effects via the tag tag, bypassing using the data value of the item. The data value is used only for the way the potion looks if these tags are present.

  • Nbtsheet.png tag: The tag tag.
    • Nbtsheet.png CustomPotionEffects: The custom Potion effects this potion has.
      • Nbtsheet.png One of these for each effect.
        • Nbtsheet.png Id: The ID of the effect.
        • Nbtsheet.png Amplifier: The amplifier of the effect, with 0 being level 1.
        • Nbtsheet.png Duration: The duration of the effect in ticks.
        • Nbtsheet.png Ambient: 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 currently has no effect.

[edit] Player Skulls

Skulls of the player variety can be associated with a specific username to take on the skin of that player when placed. There is currently no visible change for the hand-held item.

  • Nbtsheet.png tag: The tag tag.
    • Nbtsheet.png SkullOwner: The username of the player this is a skull of. [2]

[edit] Fireworks

Fireworks use the tag tag to store information about their effects.

  • Nbtsheet.png tag: The tag tag.
    • Nbtsheet.png Explosion: One of these may appear on a firework star.
      • Nbtsheet.png Flicker: 1 or 0 (true/false) - true if this explosion will have the Twinkle effect (glowstone dust). May be absent.
      • Nbtsheet.png Trail: 1 or 0 (true/false) - true if this explosion will have the Trail effect (diamond). May be absent.
      • Nbtsheet.png Type: 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.
      • Nbtsheet.png Colors: 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.
      • Nbtsheet.png FadeColors: Array of integer values corresponding to the fading colors of this firework's explosion. Same handling of custom colors as Colors. May be absent.
    • Nbtsheet.png Fireworks: One of these may appear on a Firework Rocket.
      • Nbtsheet.png Flight: 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.
      • Nbtsheet.png Explosions: List of compounds representing each explosion this firework will cause.
        • Nbtsheet.png Same format as 'Explosion' compound on a firework star, as described above.

[edit] Other

  • Nbtsheet.png tag: The tag tag.
    • Nbtsheet.png map_is_scaling: 1 or 0 (true/false) - unknown, most likely used to fix a bug with crafting.

[edit] Inventory Slot Numbers

This shows the numbers used to specify the slot in the inventory while editing with an NBT editor.

[edit] References

Personal tools
Namespaces
Variants
Actions
Minecraft Wiki
Minecraft
Useful pages
Toolbox
In other languages

Recent Community Articles

Mojang Tweets

    Getting your tweets...
Become a Premium Member!