0

When using command blocks some commands ask for [Data value] and [Data tag]. I know what Data values are. But what are Data tags? How do translate the Data specifications that I need into "command block language"? And is there a rubric or reference page where I can find all of them so I won't have to bug you all with every specific thing I'm trying to do.

  • Well, a link is kind of necessary. I don't expect someone to just post every block ID and Data tag. And an in depth explanation is nice too. – Prodias Feb 25 '14 at 22:32
  • Well, we wouldn't need to post every block ID (those weren't mentioned in the question). And as for data tags, that's not really just a list of values... it's more complicated... – James Of Da Peach Feb 25 '14 at 22:47
  • You can see my in-dev Google site on this sort of stuff. – James Of Da Peach Feb 25 '14 at 22:48
  • "Data value" is right there in the title. So just in case someone clicked on it for [Data Values] (minecraft.gamepedia.com/Data_value) – Prodias Feb 26 '14 at 15:40
3

Data tags give you access to the (formerly) internal data for each entity or block. You can pretty much do anything (that is possible in the game engine) by modifying the data tags. For example, if you want a white horse:

/summon EntityHorse ~ ~ ~ {Variant:0}

If you want the horse to be tame and have a saddle:

/summon EntityHorse ~ ~ ~ {Variant:0,Tame:1,Saddle:true}

If you want to give the player a named shovel with Fortune X enchantment:

/give @p iron_pickaxe 1 0 {ench:[{id:35,lvl:10}],display:{Name:Lucky}}

The list of all possible tags is here: http://minecraft.gamepedia.com/Chunk_format.


The format is the following:

DataTag is { NamedTag , NamedTag,... }
NamedTag is TagName : TagValue
TagName is the tag name as seen in the above link (case sensitive)
TagValue is number or string or DataTag or ValueList
ValueList is [ TagValue , TagValue ,...]


Using this 'grammar' we can break down the example {ench:[{id:35,lvl:10}],display:{Name:Lucky}} into its parts: It is a DataTag that has two NamedTag-s: ench:[{id:35,lvl:10}] and display:{Name:Lucky}

The first NamedTag's name is ench and its value is [{id:35,lvl:10}]. This value is a list with one item (we have one enchantment). The item is {id:35,lvl:10} and it is itself a DataTag. It has its own two NamedTag-s: id:35 and lvl:10 which show the enchantment id is 35 - Fortune and enchantment level is 10. If we want to add another enchantment to the shovel, we need to build a DataTag for it: e.g. for knockback {id:19,lvl:5}. Then we need to put the second enchantment in the list: [{id:35,lvl:10},{id:19,lvl:5}]

The second NamedTag of the root tag has name display and value {Name:Lucky}. This value is itself a DataTag that contains only one NamedTag - Name:Lucky. This NamedTag has name Name and value Lucky.

  • Mention something about "NamedTag:{}" and "NamedTag:[{},{}]" or something, and I'll love this answer. :) – James Of Da Peach Feb 26 '14 at 12:29
  • @JamesOfDaPeach well, if you follow the 'grammar' I gave, deciphering combinations comes naturally. Nevertheless I have included a verbose example of breaking an expression down to its parts. It is really easier if you view the data tag as a tree with values (like folders and flies. The tree is converted to text using the above rules or 'grammar'. – Kcats Feb 26 '14 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.