The Gamepedia and Fandom account systems have now been merged. If your username is incorrect, you have accounts on both platforms that weren't merged, or you have trouble signing in, please submit a support ticket.

Tutorials/Command NBT tags

From Minecraft Wiki
Jump to: navigation, search
Clock JE2 BE1.gif
This article's factual accuracy may be compromised due to out-of-date information.
Please update this article to reflect recent updates or newly available information.
Information icon.svg
This feature is exclusive to Java Edition.

NBT tags can be specified for items and entities created with the /give and /summon commands. Each tag has the format <tagname>:<value>; where <tagname> describes what it does and <value> is how much it applies. Multiple tags are separated by commas. (e.g.: {Enchantments:[{}],display:{}}). The contents of List tags are enclosed in square brackets [], while the contents of Compound tags are enclosed in curly brackets {} – note that the entire data tag is itself a Compound tag (All within a set of {}). Tag names are case-sensitive, and white space is ignored. additionally, some tags are either true or false (Example: {NoAI:1})

The player can quickly find data tags (NBT) without the use of external editors by using /data to figure out the data for each entity or block entity. See more about this in the article Commands/data.

See Entity format for the various NBT Tags that are saved for each entity. This page also contains basic information for each NBT Tag.

When None is used in a tag name that means that this tag can be put directly into the start of the dataTag.

Items[edit]

These can be used in /give and /replaceitem commands as well as /clear. For such commands as /summon and /setblock, place them inside of a tag.

Example:

{id:"stone",Count:3 ... tag:{Name:"your name" ...}}

These tags can be used on any item.

NBT Tag Description Allowed tagnames Required tagnames Syntax
Item The name of the item as visible on the ground and in the inventory, how many and tag data / damage value. The item cannot be picked up if it has no Count tag. id, Damage, Count, tag id, Count {Item:{id:"",Damage:#,Count:#,tag:{Item NBT data here}}}
Enchantments Allows the addition of enchantments to items. Contains information on the id of the enchantment and the level of the enchantment. Can specify one enchantment or multiple enchantments. It is possible specify no enchantment, which just gives the item Protection 0. id, lvl All {Enchantments:[{id:"",lvl:#},{id:"",lvl:#}]}
display Used to add custom names, colors (leather armor), and lore to items. Lore may have multiple lines.

Color is a hexadecimal color value, except in decimal. An RGB to hexadecimal converter can be found here and a hexadecimal to decimal converter can be found here.

Name, color, Lore, LocName At least one {display:{Name:'{"text":"Name here"}', color:#, Lore:['"Lore here."']}}
AttributeModifiers Can be used to add attributes to mobs or items. For more information, see Attribute. AttributeName, Name (Attribute), Amount, Operation, UUIDLeast, UUIDMost All AttributeModifiers:[0:{AttributeName,Name,Amount,Operation}, 1:{AttributeName,Name,Amount,Operation,UUIDLeast,UUIDMost}]
Unbreakable Used to make items with durability that never degrades. Unbreakable All {Unbreakable:1b/0b} (1b = true, 0b = false)
SkullOwner Used for getting player heads. SkullOwner All {SkullOwner:"player name"}
HideFlags Used to hide flags (the info in the tool tip) such as enchantments, CanDestroy, CanPlaceOn, etc.

To hide multiple tags, you need to add the value of the tags you want to hide. For example, if you want to hide the "Enchantments" and the "Attributes modifiers" tags, the value you need to put is 3 (1+2).

HideFlags All {HideFlags:VALUE}

VALUE ranges from 1 to 63, representing 63 combinations.

When adding to create a unique VALUE:[1]

Adding 1 hides Enchantments

Adding 2 hides Attributes modifiers

Adding 4 hides Unbreakable

Adding 8 hides CanDestroy

Adding 16 hides CanPlaceOn

Adding 32 hides Others, such as potion effects & shield pattern info

In binary form:

[+32] [+16] [+8] [+4] [+2] [+1]

For example: "000111" has a value of 7, and it hides Enchantments, Attribute Modifiers, and Unbreakable.

CanDestroy Similar to CanPlaceOn this tag is used when making adventure maps to allow a specific tool/item to break a block. Apply the tag to any item/tool. If the value is not a valid block or item it displays as "missingno". An array of strings, each one saying the id of a block. Uses # for block tags (groups). At least one {CanDestroy:["minecraft:stone","#minecraft:logs"]}
PickupDelay The number of ticks before an item entity can be picked up. Any number. Set to 32767 for items that can't be picked up All {PickupDelay:#}
Age The duration before an item disappears. Any number. Set to -32768 for items that don't disappear. If Age counts up to 6000 (5 minutes if Age started at default value 0), the item disappears. All {Age:#}
generation (Minecraft Java Edition 1.8) Defines whether a written book is labeled as an "Original", a "Copy of Original", a "Copy of a copy" or "Tattered". "Original", "Copy of Original", "Copy of a copy", "Tattered" At least one {generation:""}

The following table provides more details on previous sub-tags.

Tagname Description Used In Value Type Allowed Values
id Refers to the id of an enchantment. See Enchanting for details on which id correlates to which enchantment. Enchantments String Enchantment ID
lvl Determines the level of an enchantment. A level between one and ten displays properly on an item, however, any value above that displays enchantment.level.lvl. Enchantments Numerical -2147483648 to 2147483647
Name The name of an item displayed in game. For blocks such as Chests and Dispensers the name replaces the default 'Chest' or 'Dispenser' in the upper left hand corner of the GUI. When used on command blocks the name is displayed when executing commands. This can be seen by using the /say command. display String Any character that is available within the Minecraft language files (Most characters on your keyboard)
Lore The text under the name of the item. display String Any character that is available within the Minecraft language files (Most characters on your keyboard)

Blocks[edit]

These tags are put on blocks as items.

Tagname Description Value Type Syntax
CanPlaceOn This tag is used when making adventure maps to determine which block(s) the player can place a block on. Also used on hoes to make them till dirt and on spawn eggs to place them. If the value is not a valid block or item it displays as "missingno". An array of strings, each one saying the id of a block. Uses # for block tags (groups). {CanPlaceOn:["minecraft:stone","#minecraft:logs"]}
BlockEntityTag This is used for tile entities, and stores their data for when they are placed down Differs based on the block, see Blocks for details. Example: get a white shield by using a command: /give @p shield{BlockEntityTag:{Base:0 BlockEntityTag:{TagName:"tagdata"}

Entities[edit]

These tags are used when using the /summon command to spawn entities or when using the /data to edit the data of entities.

NBT Tag Description Allowed tagnames Required tagnames Syntax
TileEntityData Used to store all data kept within a block. Mainly used within blocks that can store items or contain various data values, e.g., Command blocks, Chests, Jukeboxes, Dispenser, Beacon, etc. CustomName, Items, Command, Levels, Primary, Secondary, Delay, MaxNearbyEntities, MaxSpawnDelay, MinSpawnDelay, RequiredPlayerRange, SpawnCount, SpawnRange, EntityID None TileEntityData:{}
Motion Determines the initial velocity of most entities (all other than Dragon Fireballs, Fireballs, Small Fireballs and Wither Skulls) upon being summoned. Must be entered as double precision floating point values (decimals). Example: {Motion:[0.0,1.0,0.0]} summons with an initial upward velocity of 1.0. X, Y, Z All Motion:[X,Y,Z]
direction Similar to Motion, determines the initial velocity of Dragon Fireballs, Fireballs, Small Fireballs, and Wither Skulls upon being summoned. This tag is required to summon said entities, otherwise the command fails. Example: {direction:[0.0,1.0,0.0]} summons with an initial upward velocity of 1.0.

This tag determines only the entity's velocity, not the direction that it's facing.

X, Y, Z All direction:[X,Y,Z]
power Similar to direction, but determines constant acceleration. Example: {power:[0.0,1.0,0.0]} gives the summoned entity a constant upward acceleration of 1.0. Entities are still affected by drag when power is nonzero and eventually reaches a terminal velocity. Affects only Dragon Fireballs, Fireballs, Small Fireballs, and Wither Skulls. X, Y, Z All power:[X,Y,Z]
ActiveEffects Sets the effects that apply to a mob after it is summoned. Id, Duration, Amplifier, Ambient, ShowParticles All ActiveEffects:[{Id:,Duration:,Amplifier:,Ambient:,ShowParticles:},{Id:,Duration:,Amplifier:,Ambient:,ShowParticles:}]
rewardExp Controls villagers giving xp for trading, set to true or false True/False {rewardExp:true/false}
Passengers Sets which entities are riding on top of the base entity. Allows multiple entities to ride one base entity. all (not checked) id Passengers:[{id:},{id:},etc.]
ArmorItems Defines what items are being worn by the mob. Items go in slots Feet, Legs, Chest, Head, in that order. Item None ArmorItems:[{Count:#,id:""},{Count:#,id:""},{Count:#,id:""},

{Count:#,id:}]

HandItems Defines what item is within the mainhand and offhand. First item is the mainhand, second is offhand. Item None HandItems:[{Count:#,id:""},{Count:,id:#}]
HandDropChances Determines how likely it is for an entity to drop held Items. The tag Count in the equipment tag must be 1 or greater for this to work. 2 separate float values, one for the main hand and one for the off-hand slot. 0.0-1.0 determines likelihood of dropping, but applies a random durability if it does. Anything greater than 1.0 makes it always drop with full durability. Since it is a float value, it must be phrased as "X.Y", with X and Y being values of your choice. {HandDropChances:[0.1,2.0]}
ArmorDropChances Determines how likely it is for an entity to drop worn Items. The tag Count in the equipment tag must be 1 or greater for this to work. 4 separate float values, one for each slot. 0.0-1.0 determines likelihood of dropping, but applies a random durability if it does. Anything greater than 1.0 makes it always drop with full durability. Since it is a float value, it must be phrased as "X.Y", with X and Y being values of your choice. {ArmorDropChances:[0.1,2.0,1.0,0.0]}
NoAI Makes mobs have no AI, resulting in mobs not moving on their own. {NoAI:0b} or {NoAI:1b}
NoGravity Makes mobs unaffected by gravity. Mobs do not fall. {NoGravity:0b} or {NoGravity:1b}
Silent Makes mobs silent. Does not work for certain sounds, see MC-64242. {Silent:0b} or {Silent:1b}
Fire Determines how many ticks a mob is on fire. When Fire reaches one, the fire stops, and the mob no longer takes damage. When a mob is not on fire, this value is 1. {Fire:1} to {Fire:32767}
Invulnerable Makes mobs invulnerable to everything except the Void and players in Creative Mode. Mobs do not attack or run away from invulnerable mobs. {Invulnerable:1}
Attributes Customizes the attributes of the entity. See Attribute for more details Name: see Attribute for a list. Base: the amount to apply. Modifiers: how much and how it should vary. Contains values Name, Amount, Operation, UUIDMost, UUIDLeast. Name and Base {Attributes:[{Name:"generic.maxHealth",Base:40,Modifiers:[{Name:generic.maxHealth, Amount:7,Operation:0,UUIDMost:4000,UUIDLeast:8000}].
Anger A pigman becomes aggressive toward any player nearby (as if you hit it). Number in ticks {Anger:#}

The following table provides information on each tagname that can be added in an NBT Tag. These tagnames are specific to the /summon command.

Tagname Description Used In Value Type Allowed Values
Type Used to change the type of mobs, like horses. Setting a horse's type to 4 makes it a skeleton horse. Summon Integer 1 - JavaOverflowLimit
Saddle Used to spawn horses or pigs that have saddles on. Summon Boolean Binary true / false or 1 / 0
Tame Used to spawn tamed horses. Summon Boolean Binary true / false or 1 / 0
Variant Changes the horse variant. Setting no variant or putting an incorrect variant spawns a normal white horse. See Horse Variants for the list of Variants. Summoning Horses Integer 1 - 1030
Size Changes the size of a slime, magma cube or phantom summoned into the game. Anything higher than 255 summons size 255. Anything lower than 0 summons size 0. More than 32 tends to cause extreme lag. Summoning

Slimes

Integer 0 - 255
BlockState Determines which block is being summoned when using /summon FallingSand. Use Data values to find out the ID of each block. You can also use F3+H in-game to show the ID's of items in-game. Summoning FallingSand Block ID {BlockState:{Name:"minecraft:redstone_block"}} All Strings
Time Whether or not the block despawns before hitting the ground. If set to 1 the block falls normally, if set to less than 1 it is set to 0. If set to 0 the block despawns immediately. Recommended to keep this value as 1. Summoning FallingSand Integer (Include Negatives) -1 - 127
DropItem Whether or not the block drops its item form if the block is unable to be placed. If set to 0 the block does not drop its respective item, if set to 1 the block drops its respective item. Summoning FallingSand Boolean Binary 0 or 1
id Determines the entity the other entity is riding on. Summon Namespaced ID {id:"minecraft:creeper"} Any namespaced ID of an Entity
Fuse Determines how long it takes for PrimedTnt or a Creeper to explode. Summon Short 0 - 32767
ExplosionPower Used when summoning fireballs, Withers, and Ghasts to set the power of the explosion Summon Integer 0-∞; there is no cap.
ExplosionRadius Used when summoning Creepers to set the radius of the explosion Summon Byte 0-127
powered Determines whether a Creeper is charged or not Summon Boolean Binary 0 or 1

Villager[edit]

These tags are used when summoning villagers.

Tagname Description Value type Syntax
Profession Determines the profession of the villager Numerical, 0 - 5 {Profession:#}
Offers Determines what the villager sells A string {Offers:{Recipes:[{buy:{id:"stone",Count:1},maxUses:9999999,

sell:{id:"stone",Count:1}}]}}

Potion[edit]

These tags are used to customize potions

Tagname Description Value type Syntax
Potion Determines which type of potion be receive in / give minecraft:(potion effect) {Potion:"minecraft:#"}
CustomPotionEffects Customize the effect of potions Numerical {CustomPotionEffects:[{Id:#,Amplifier:#,Duration:#}]}
CustomPotionColor Determines the Color of Potion Bottle (1.11+) Numerical color {CustomPotionColor:#}

Armor Stand[edit]

These tags are used when summoning armor stands.

NBT Tag Description Value type Syntax
NoGravity Toggles gravity 0b or 1b (0b for false, 1b for true) {NoGravity:#}
ShowArms Determines whether you can see the armor stand's arms or not. Byte, 0b or 1b (0b for false, 1b for true) {ShowArms:#}
NoBasePlate Determines whether the armor stand has a base plate or not. Byte, 0b or 1b {NoBasePlate:#}
Small Determines whether the armor stand is small or not. Byte, 0b or 1b {Small:#}
Rotation Changes the rotation of the armor stand Byte, 0b or 1b {Rotation:[#f,#f]}
Marker Small Hit box Byte, 0b or 1b {Marker:#}
Pose Changes the pose of the armor stand's body parts.

NOTE: You can ONLY use one of the Pose sub-tags (shown on Syntax in bold) for this to work.

Byte, 0b or 1b {Pose:{Head,Body,LeftArm,RightArm,LeftLeg,RightLeg:[#f,#f,#f]}}
Invisible Determines whether the armor stand is invisible or not. Byte, 0b or 1b {Invisible:#}

Note: The Equipment tag also works for armor stands.

Turtle[edit]

These tags are used when summoning turtles.

Tagname Description Value type Syntax
HomePosX Determines the X coordinate of a turtle's home beach. Numerical {HomePosX:#}
HomePosY Determines the Y coordinate of a turtle's home beach. Numerical {HomePosY:#}
HomePosZ Determines the Z coordinate of a turtle's home beach. Numerical {HomePosZ:#}
TravelPosX Determines the distance a turtle can lay eggs from its home coordinates, on the X axis. Numerical {TravelPosX:#}
TravelPosY Determines the distance a turtle can lay eggs from its home coordinates, on the Y axis. Numerical {TravelPosY:#}
TravelPosZ Determines the distance a turtle can lay eggs from its home coordinates, on the Z axis. Numerical {TravelPosZ:#}
HasEgg Determines if the turtle has an egg to lay 0 – 0b – false
1 – 1b – true
{HasEgg:#}

Blocks[edit]

Tags used in /setblock and /fill:

Tagname Description Value Type Syntax
Command Used with command blocks. Places command block with command. A string {Command:"desired command"}

Note: This is also used for Command Block Minecarts

Generic[edit]

These tags can be used on most tile entitied blocks

Tagname Description Value Type Syntax
CustomName Displayed in the top left corner of the inventory, instead of the regular name. Works only where such a regular name exists. A JSON text component {CustomName:"\"Custom Name\""}
Lock Says a name needed on a held item to open the inventory. A string {Lock:"Key's Name"}

Beacon[edit]

Tagname Description Value Type Syntax
Primary This determines the first status effect that the beacon creates. It defaults to level 1 of the effect. An ID of a status effect. {Primary:#}
Secondary This determines the second status effect. If its the same as Primary, then it increases the status effect to level 2. Otherwise it is level 1. Also an ID of a status effect. {Secondary:#}

Spawner[edit]

These tags are used when using /setblock or /summon (spawner minecarts) to create spawners. Add only those data tags you want to avoid a potential error.

Tagname Description Value Type Syntax
EntityId Specifies what entity the spawner spawns. A ID of a Mob {SpawnData:{id:}}
SpawnData Used for spawners that spawn entities with data tags. An entity NBT tag {SpawnData:{NBT tag}}
SpawnCount How many entities the spawner can spawn at one time. Integer {SpawnCount:#}
SpawnRange The range of which the entities can spawn. Integer {SpawnRange:#}
RequiredPlayerRange The range of which a player must be in for the spawner to start spawning entities. Integer {RequiredPlayerRange:#}
Delay The number of ticks before entities spawn when a player is first detected. Integer {Delay:#}
MinSpawnDelay After the first spawn, this is the minimum amount of ticks before more entities can spawn. Integer {MinSpawnDelay:#}
MaxSpawnDelay Similar to MinSpawnDelay. After the first spawn, this is the maximum amount of ticks before more entities can spawn. Integer {MaxSpawnDelay:#}
MaxNearbyEntities Checks the number of entities within the spawn range ('SpawnRange' tag). If the number of entities it detects is over the set MaxNearbyEntities number, it does not spawn more entities unless the amount of entities within the spawn range is decreased. Integer {MaxNearbyEntities:#}
SpawnPotentials Used when creating spawners that spawn multiple types of entities. A weighted list of entities to be spawned, including NBT tags. A List {SpawnPotentials:[{Type:"EntityName",Weight:#,Properties:{NBT tag}}]}
Weight Used if spawning multiple entities using SpawnPotentials. If the same as another SpawnPotentials entity, both have an even chance of spawning. A number {Weight:#}

Sub-tags used in the SpawnPotentials data tag.

Tagname Description Value Type Syntax
Type Determines the other entity that spawns with the entity specified in the EntityId data tag. MUST be used with SpawnPotentials. A string {SpawnPotentials:[{Type:"EntityName"}]}
Weight Determines the chance of spawning the entity specified in the 'Type' sub-tag. If set to the same as another other entity's weight, they have the same chance of spawning. A number {SpawnPotentials:[{Weight:#}]}
Properties Determines the entity data tag(s) that the entity (specified in the 'Type' sub-tag) is spawned with. An entity NBT tag {SpawnPotentials:[{Properties:{NBT tag}}]}

See also[edit]

References[edit]

  1. There can be more or even wrong values, make sure you test them first! This tag may need major editing!