Difference between revisions of "Data tags"

From Mine Blocks Wiki
Jump to navigation Jump to search
If you find a typo, inconsistency, or error, please sign up and help out the wiki! We can't do it without your help! :D Thank you!

m
m
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Data tags are pieces of information that get stored on items and blocks. Tags are used to alter items in various ways, such as in appearance or in functionality.
 
Data tags are pieces of information that get stored on items and blocks. Tags are used to alter items in various ways, such as in appearance or in functionality.
  
== Uses ==
+
== Usage ==
 
Data tags can be applied to items by using the [[commands#give|give command]]. They are the fourth parameter.
 
Data tags can be applied to items by using the [[commands#give|give command]]. They are the fourth parameter.
  
Line 21: Line 21:
 
|''String''
 
|''String''
  
<code>mob_egg</code>: The mob spawned by the egg ("zombie", "ender dragon", "nethereye")
+
<code>spawn_egg</code>: The mob spawned by the egg ("zombie", "ender dragon", "nethereye")
  
 
<code>potion</code>: Specifies the type of potion ("empty", "water", "fire protection +")
 
<code>potion</code>: Specifies the type of potion ("empty", "water", "fire protection +")
Line 42: Line 42:
  
 
Applies to all items. Both "unbreaking1" and "Unbreaking I" will refer to the same enchantment. Duplicate enchantments are ignored.
 
Applies to all items. Both "unbreaking1" and "Unbreaking I" will refer to the same enchantment. Duplicate enchantments are ignored.
 +
 +
See [[Enchanting#Commands|enchanting]] for a list of enchantment identifiers.
 
|-
 
|-
 
|<code>anvilUses</code>
 
|<code>anvilUses</code>
Line 56: Line 58:
 
|-
 
|-
 
|<code>showParticles</code>
 
|<code>showParticles</code>
|When enabled, this will hide the particles of [[potion]] effects.
+
|When disabled, this will hide the particles of [[potion effects]] when a [[Potions|potion]] is drank.
 
|''Boolean''
 
|''Boolean''
  
Only applies to <code>potion</code>. Value is simply omitted when false.
+
Only applies to <code>potion</code>. Value is simply omitted when true.
 
|-
 
|-
 
|<code>command</code>
 
|<code>command</code>
Line 74: Line 76:
 
|}
 
|}
  
== Colors Tags ==
+
=== Colors Tags ===
{| class="wikitable" width="200px"
+
For colored items, the color is specified using the <code>type</code> data tag.
!Color value
+
{{Colors|rainbow=true}}
!Preview
+
 
|-
+
== History ==
|red
+
{|class="wikitable"
|<div style="width:100px;height:20px;background-color:#BE0000"></div>
+
! Version
|-
+
! Date
|green
+
! Changes
|<div style="width:100px;height:20px;background-color:#219000"></div>
 
|-
 
|blue
 
|<div style="width:100px;height:20px;background-color:#0000D2"></div>
 
|-
 
|brown
 
|<div style="width:100px;height:20px;background-color:#503314"></div>
 
|-
 
|cyan
 
|<div style="width:100px;height:20px;background-color:#2ED196"></div>
 
|-
 
|lightblue
 
|<div style="width:100px;height:20px;background-color:#00CCFF"></div>
 
|-
 
|lightgreen
 
|<div style="width:100px;height:20px;background-color:#6BC900"></div>
 
|-
 
|magenta
 
|<div style="width:100px;height:20px;background-color:#B60973"></div>
 
|-
 
|orange
 
|<div style="width:100px;height:20px;background-color:#FF6000"></div>
 
|-
 
|pink
 
|<div style="width:100px;height:20px;background-color:#FFAAAA"></div>
 
|-
 
|purple
 
|<div style="width:100px;height:20px;background-color:#8527A5"></div>
 
|-
 
|white
 
|<div style="width:100px;height:20px;background-color:#F7F7F7"></div>
 
|-
 
|yellow
 
|<div style="width:100px;height:20px;background-color:#E6CA00"></div>
 
 
|-
 
|-
|lightgray
+
! [[Version History#1.25|1.25]]
|<div style="width:100px;height:20px;background-color:#CDCDCD"></div>
+
! May 11, 2013
 +
|
 +
* Added data tags to store item properties
 
|-
 
|-
|gray
+
! [[Version History#1.28|1.28]]
|<div style="width:100px;height:20px;background-color:#666666"></div>
+
! Oct 8, 2016
|-
+
|
|black
+
* Data tags can be specified when using the <code>/give</code> command
|<div style="width:100px;height:20px;background-color:#333333"></div>
 
|-
 
|rainbow
 
|N/A
 
 
|}
 
|}
 
== History ==
 
*Although introduced as an official feature in 1.28, data tags were used to store item properties since 1.25.
 
  
 
== See also ==
 
== See also ==

Revision as of 17:25, 8 June 2019

Data tags are pieces of information that get stored on items and blocks. Tags are used to alter items in various ways, such as in appearance or in functionality.

Usage

Data tags can be applied to items by using the give command. They are the fourth parameter.

An example of a give command using data tags:

give leather_cap 1 0 {type:"purple", name:"Purple Hat", enchantments:["unbreaking2", "Fire Protection III"]}

Tags

Listed below are all the data tags that can be applied to items.

Tag Name Description Values and Applicable Items
type Specifies the type of the item. Oftentimes this is the color of the item, such as wool. If the value is invalid for the item, the value will be omitted. String

spawn_egg: The mob spawned by the egg ("zombie", "ender dragon", "nethereye")

potion: Specifies the type of potion ("empty", "water", "fire protection +")

dye, glass, glass_backdrop, leather_boots, leather_pants, leather_tunic, leather_cap: Color ("red", "purple", "light gray")

carpet, wool, wool_backdrop: Color, or "rainbow"

balloon: Color, or "ghast"

unbreakable If enabled, and the item is a tool, the item will never lose durability. Boolean

Applies to all tools. Value is simply omitted when false.

enchantments A list of enchantments applied to the item. Array of Strings

Applies to all items. Both "unbreaking1" and "Unbreaking I" will refer to the same enchantment. Duplicate enchantments are ignored.

See enchanting for a list of enchantment identifiers.

anvilUses Specifies the number of times the item has been used in an anvil. This only affects the cost of using an anvil on the item. Integer

Applies to all items.

name Overrides the default naming of the item (as if it was renamed by an anvil) String

Applies to all items.

showParticles When disabled, this will hide the particles of potion effects when a potion is drank. Boolean

Only applies to potion. Value is simply omitted when true.

command Specifies the command run by a command book. String

Only applies to command_book. Command will not be checked for errors upon creation.

uses Specifies how many times a command book can be used before it disappears. Integer

Only applies to command_book. Non-positive numbers are invalid.

Colors Tags

For colored items, the color is specified using the type data tag.

Type Preview
red
green
blue
brown
cyan
lightblue
lightgreen
magenta
orange
pink
purple
white
yellow
lightgray
gray
black
rainbow

History

Version Date Changes
1.25 May 11, 2013
  • Added data tags to store item properties
1.28 Oct 8, 2016
  • Data tags can be specified when using the /give command

See also