Share

Share

Tutorials/Command NBT Tags

From Minecraft Wiki
Jump to: navigation, search
This article is a stub.
Please help us by expanding it.
This page is a work in progress.
Refrain from making major edits to it until this page is finished.

This page will be updated as soon as the formatting is complete and more progress has been made into the NBT Tags that can be attached to commands in 13w36a. For now see this Minecraft Forum Topic regarding the NBT Tags that can be added to the commands /give and /summon: [1]

As of snapshot 13w36a, NBT tags can be specified for items and entities created with the /give and /summon commands. Each tag has the format <tagname>:<value> ; multiple tags are separated by commas.(Ex: {ench:[],display:{}} ) The contents of List tags are enclosed in square brackets [], while the contents of Compound tags are enclosed in curly braces {} – 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.

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 Tagname that means that this tag can be put directly into the start of the dataTag

Items[edit]

These can be used in /give commands as well as /clear. For such commands as /summon and /setblock, place them inside of a tag tag, like so: {id:"stone",Count:3 ... tag:{Name:"your name" ...}} These tags can be used on any item

NBT Tag Description Allowed tagnames Required tagnames Syntax
ench Allows the addition of enchantments to items. Contains information on the id of the echantment and the level of the enchantment. Can specify one enchantment or multiple enchantments. id, lvl All {ench:[{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. Converters can be found here:

RGB to hexadecimal: http://www.yellowpipe.com/yis/tools/hex-to-rgb/color-converter.php

Hexadecimal to decimal: http://www.statman.info/conversions/hexadecimal.html

Name, color, Lore At least one {display:{Name:"",color:,Lore:["lore here", "lore here"]}}
AttributeModifiers Can be used to add attributes to mobs or items. 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 never degrade. Unbreakable All {Unbreakable:1/0} (1 = true, 0 = false)
SkullOwner Used for getting player heads. SkullOwner All {SkullOwner:"player name"} ("s needed)
HideFlags (Minecraft 1.8) Used to hide flags (the info in the tool tip) such as enchantments, CanDestroy, CanPlaceOn, etc. HideFlags All {HideFlags:1-32} (1 = Enchantments, 2 = Attributes modifiers, 4 = Unbreakable, 8 = CanDestroy, 16 = CanPlaceOn, 32 = Others, such as potion effects)[1]
CanDestroy (Minecraft 1.8) 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. An array of Strings, each one saying the id of a block at least one {CanDestroy:["minecraft:stone","minecraft:stonebrick"]}
PickupDelay (Minecraft 1.8) 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 (Minecraft 1.8) The length before an item will disappear. Any number. Set to -32768 for items that don't disappear All {Age:#}
generation (Minecraft 1.8) Defines whether a written book is an "Original" a "Copy of Original" or a "Copy of a copy" "Original", "Copy of Original", "Copy of a copy" 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. ench Numerical 0 - 62
lvl Determines the level of an enchantment. A level between one and ten will display properly on an item, however, any value above that will display enchantment.level.lvl. ench Numerical 0 - 32767
Name Is the name of an item that will be displayed in game. For blocks such as Chests and Dispensers the name will replace the default 'Chest' or 'Dispenser' in the upper left hand corner of the GUI. When used on command blocks the name will be 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)

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 an item on An array of Strings, each one saying the id of a block CanPlaceOn:["minecraft:stone","minecraft:stonebrick"]
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 BlockEntityTag:{TagName:"tagdata"}

Entities[edit]

These tags are used when using the /summon command to spawn 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:{}
direction Similar to motion, determines the direction that an entity will be moving upon being summoned. Must be entered as double precision floating point values (it has a decimal) Example: {direction:[0.0,1.0,0.0]} summons with an upwards velocity of 1.0. This tag only determines the force and direction of which the entity is moving, not the direction the entity is facing. X, Y, Z All direction:[X,Y,Z]
Motion Similar to direction, determines the direction that a FallingSand entity will be moving upon being summoned. Must be entered as double precision floating point values (it has a decimal) Example: {Motion:[0.0,1.0,0.0]} summons with an upwards velocity of 1.0. X, Y, Z All Motion:[X,Y,Z]
ActiveEffects Sets the effects that will apply to a mob after it's summoned. Id, Duration, Amplifier, Ambient All ActiveEffects:[{Id:,Duration:,Amplifier:,Ambient:},{Id:,Duration:,Amplifier:,Ambient:}]
rewardExp Controls villagers giving xp for trading, set to true or false True/False {rewardExp:true/false}
Riding Shows the information of the Entity that is stacked below another Entity. id, Riding, CustomName, ActiveEffects id Riding:{id:}
Equipment Adds armor & weapons to Skeletons or Zombies.

This tag is a JavaScript Array, with the consecutive values being: Held Item, Boots, Pants, Chestplate, Helmet. Any slot can be blank to indicate no item. The helmet can contain a block, which will display on the entities head.

Item Item Equipment:[{id:"",Count:,tag:{}...},{id:,Count:...},{id:...},{id:},{id:}]
DropChances Determines how likely it is for an entity to drop held or worn Items. The tag Count in the equipment tag must be 1 or greater for this to work. 5 separate float values(1 for each slot). 0.0f-1.0f determines likelihood of dropping, but will apply a random durability if it does. Anything greater than 1.0f will make it always drop with full durability. Since it is a float value, it must be phrased as "X.Yf", with X and Y being values of your choice. {DropChances:[0.1f,2.0f,1.0f,1.1f,0.0f]
NoAI Makes mobs have no AI. {NoAI:0} or {NoAI: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}]

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 will make it a skeleton horse. None Summon 1 - Infinity
Saddle Used to spawn horses or pigs that have saddles on. None Summon 1 - Infinity
Tame Used to spawn tamed horses. None Summon 1 - Infinity
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. None Summon 1 - 1030
TileID 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. None Block ID 1 - 173
Time Whether or not the block despawns before hitting the ground. If set to 1 the block will fall normally, if set to less than 1 will be set to 0. If set to 0 the block will despawn immediately. Recommended to keep this value as 1. None Numerical 0 - 127
DropItem Whether or not the block will drop its item form if the block is unable to be placed. If set to 0 the block will not drop its respective item, if set to 1 the block will drop its respective item. None Numerical 0 or 1
id Determines the entity the other entity will be riding on. None Savegame ID Any Savegame ID of an Entity
Fuse Determines how long it takes for PrimedTnt to explode. None Numerical 0 - 383
ExplosionPower Used when summoning fireballs to set the power of the explosion None Numeretical 0-? (Help us find the limit)

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"}

Generic[edit]

These tags can be used on most tile entitied blocks

Tagname Description Value Type Syntax
CustomName Displayed in the top corner of the inventory, instead of the regular name. Only works where such a regular name exists. A string. {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 will create. It defaults to level 1 of the effect. An ID of a status effect. {Primary:num}
Secondary This determines the second status effect. If its the same as Primary, then it will increase the status effect to level 2. Otherwise it will be level 1. Also an ID of a status effect. {Secondary:num}

Spawner[edit]

These tags are used when using /setblock or /summon (spawner minecarts) to create spawners.

Tagname Description Value Type Syntax
EntityId Specifies what entity the spawner spawns. A string {EntityId:"EntityName"}
SpawnData Used for spawners that spawn entities with data tags. An entity NBT tag {SpawnData:{NBT tag}}
SpawnCount How many entities the spawner will spawn at one time. A number {SpawnCount:#}
SpawnRange The range of which the entities can spawn. A number {SpawnRange:#}
RequiredPlayerRange The range of which a player must be in for the spawner to start spawning entities. A number {RequiredPlayerRange:#}
Delay The number of ticks before entities spawn when a player is first detected. A number {Delay:#}
MinSpawnDelay After the first spawn, this is the minimum amount of ticks before more entities can spawn. A number {MinSpawnDelay:#}
MaxSpawnDelay Similar to MinSpawnDelay. After the first spawn, this is the maximum amount of ticks before more entities can spawn. A number {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 will not spawn more entities unless the amount of entities within the spawn range is decreased. A number {MaxNearbyEntities:#}
SpawnPotentials Used when creating spawners that spawn multiple types of entities. A string {SpawnPotentials:[{Type:"EntityName",Weight:#,Properties:{NBT tag}}]}
Weight Used if spawning multiple entities using SpawnPotentials. If the same as the SpawnPotentials entity, they will 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 the other entity's weight, they will 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) will be spawned with. An entity NBT tag {SpawnPotentials:[{Properties:{NBT tag}}]}
  1. There can be more or even wrong values, make sure you test them first! This tag may need major editing!