Hello all, I am writing this as many people get stuck on how to format Minecraft metadata tags. I will update this regularly to fit for peoples needs in this topic. I have never really done anything on the forum so I thought I'd make this post to give me a place. /give formatting and metadata tags
Names and Lores:
We can all add item names using anvils, but in an adventure map, do you want players to stop and rename their items? This is where the solution comes in.
Say you want to give the players some wooden swords:
/give @a wooden_sword
Easy Enough? Now try adding a name, for example, Mr. Tree's Branch:
display The Display syntax Means basically, the visible properties of the item.
Name Is pretty straight forward, the name of the item.This gives us:Simple, huh?
Lores are slightly harder, but not by much. So we have Mr. Trees branch, we can add a description to it. Say this was pulled from Mr. Tree, we could add this to our current MetaData:
/give @a wooden_sword 1 0 {display:{Name:"Mr. Tree's Branch",Lore:["Pulled From Mr. Tree"]}}
Its not a lot of description though, so we can add another line of Lore by separating the lore area.
Lore:["Pulled From Mr. Tree","He does not care of the branch"]}}
When we compile all this, it gives us:Simple but it looks nice, am I right?
Enchantments:
So, your Players Have Mr. Tree's Branch, but what happens when it snaps, or you decide to add really tough mobs that the branch is useless against? Obviously, we all know the solution, but how do we make it work?
Mr. Trees Branch can be upgraded with the power of enchanting, and the syntax is this:
/give @a wooden_sword 1 0 {display:{Name:"Mr. Tree's Branch",Lore:["Pulled From Mr. Tree","He does not care of the branch"]},ench:[{id:34,lvl:10}]} ench This syntax means the list of enchantments you will have.
id This is the id of the enchantment, in this case 34=Unbreaking.
lvl This Means the power of the enchantment, in this case 10. This Gives us: Multiple Enchantments: So now the branch wont break, but what about the damage its doing, its only 4! Simple, More enchantments! To add more enchantments, simply edit the area where it reads
ench:[{id:34,lvl:10}]} We can add more enchantments after where it reads } but before the ].
ench:[{id:34,lvl:10},{id:20,lvl:5}]} When we compile all that we have learned, we get this:
(For a list of all the current Enchantment ids, expand this Spoiler:)
0 Protection
1 Fire Protection
2 Feather Falling
3 Blast Protection
4 Projectile Protection
5 Respiration
6 Aqua Affinity
7 Thorns
8 Depth Strider
16 Sharpness
17 Smite
18 Bane of Arthorpods
19 Knockback
20 Fire Aspect
21 Looting
32 Efficiency
33 Silk Touch
34 Unbreaking
35 Fortune
48 Power
49 Punch
50 Flame
51 Infinity
61 Luck of the Sea
62 Lure
Attributes:
I'm not that good with attributes myself, so your gonna have to bare with me when I'm doing this tutorial on how to add them to items
Lets start afresh, Mr. Tree's Branch can go back to bed now
I'm going to make a 'teleporter' here so the basic command is this:
/give @p compass 1 0 {AttributeModifiers:[{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:50,Operation:0,UUIDLeast:894654,UUIDMost:2872}]} This gives the closest Player a compass with a speed attribute of 50, so when they walk, they move so fast it looks like the teleport, just like the bukkit plugin for multiplayer. To alter this to your needs, you can change where it reads 'AttributeName:"generic.movementSpeed"' to any of the possible Attributes (They are listed below) and Where it reads 'Amount:50' to any number (It can be minus). 'Operation:0' Determines weather or not the number is listed as a percentage (For use on potions usually). Change this to '1' to make this happen. 'UUIDLeast' and 'UUIDMost' Syntaxs can be played around with all day, nobody knows what they do Just make sure UUIDMost is not the same as UUIDLeast Multiple attributes: This is the same deal as before in the enchanting, separate the first attribute from the second with a comma.Here is the code for a diamond sword with two attributes: /give @p diamond_sword 1 0 {AttributeModifiers:[{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:1,Operation:0,UUIDLeast:894654,UUIDMost:2872},{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:25,Operation:0,UUIDLeast:894654,UUIDMost:2872}]} Which gives us:Attribute List:
Hiding Flags (1.8)
Hiding Flags allows you to hide (basically) all attributes on a given item. To do this, you'll need a simple calculation tool that allows you to know the value of hiding flags, which can be found here.Tick the boxes to hide what attributes you wish to hide.In the 'HideFlags Value' box, there will be a number. Then type this command:/give @p iron_axe 1 0 {HideFlags:?}HideFlags The HideFlags syntax will hide parts of the item tooltip. Insert the number you got in the question mark. You can alter the data values of the item, this is just an example.
Coloured Armor:
Coloured armor uses RGB, so you need to find out which colour you want and the RGB, which can be done here. Pick a color you wish to be on your armor. Now you have your hexidecimal number (Mine was FF0000), goto this website and type in the Hexidecimal Number, and click to decimal. For me this got me the number 16711680. Then Type out this command: /give @p leather_boots 1 0 {display:{color:16711680}} color The color syntax modifies the color of leather armor. Insert the number you got here.You can change the leather_boots to leather_helmet, leather_leggings or leather_chestplate depending on the piece of armor you wish to have.This command gives us this:
Custom Potions
Potions are very similar to enchantments etc. /give @p 373 1 8262 This give us a night vision potion, but you can change the damage value to any potion you like, just to change the colours. /give @p 373 1 8262 {CustomPotionEffects:[{Id:3,Amplifier:5,Duration:300}]} Id This is the id of the potion effect, in this example, 3 is haste.
Amplifier This is the strength/amplification of the potion effect. This makes the haste effect amplified by 5.
Duration This is how long the potion effect lasts in game ticks. 20 games ticks=1 second of real life. So here the potion effect lasts for 15 seconds. Multiple effects: /give @p 373 1 8262 {CustomPotionEffects:[{Id:3,Amplifier:5,Duration:300},{Id:5, Amplifier:20,Duration:100}]} This is similar again to before, in the enchantments. Separate the two effects with a comma like above.The finished command gives us:WARNING! IF THIS COMMAND IS ENTERED INCORRECTLY IT COULD CRASH YOUR GAME!
/tellraw formatting and Codes
What is Tellraw?
Tellraw is a command used mostly by command blocks to tell the player something, but something that may also run an action.
Tellraw is in a code called JSON, which is different from the minecraft code. Also, I am not doing a lesson on json, just minecraft formatting For how to code in JSON, click here.The Main Format format for tellraw runs on a basis of "string:Value"
string String means command name or what you want the code to run.
value Value is the commands argument(s)
Chatting with Villagers
In some adventure maps, you may have an area where you talk with villagers. Using tellraw, you can make this possible.
This command makes the command write out a line of text that read 'Please don't hurt me, I come in peace!' /tellraw @a {"text":"Please don't hurt me, I come in peace!"} If we wish, we can colour this.
/tellraw @a {"text":"Please don't hurt me, I come in peace!","color":"gold"} This command gives us:text This is what the command will say physically in chat.
color This changes the colour of the text that is spoken.
Interactive Villagers.
Say you want to have your players interact with villagers.
/tellraw @p {"text":"","color":"white","extra":[{"text":" Hi, can I take your soul? ","color":"gold"},{"text":"[Yes] ","color":"green","clickEvent":{"action":"run_command","value":"/effect @p 7 1 3"},"hoverEvent":{"action":"show_text","value":"This will take your soul"}},{"text":"[No]","color":"red","clickEvent":{"action":"run_command","value":"/tellraw @p NoSoulTaken"},"hoverEvent":{"action":"show_text","value":"This wont take your soul"}}]} This command allows the players to interact with villagers.Clicking yes results in this:And clicking no results in:extra Self explanatory, adds extra to the command.
clickEvent This runs an action when an area of the text is clicked.
action This is the action mentioned above.
run_command This is the action, it runs a certain command.
hoverEvent This runs an action when your hover over certain text.
show_text This shows a value of text like when you hover over an item.
Phew, that was hard and also may be hard to follow Running a tellraw command in tellraw:
This was not fully possible to all its extents, so lets see why. A zoomed in version of the command above:
"clickEvent":{"action":"run_command","value":"/tellraw @p NoSoulTaken" As you can see, the tellraw in it is only a one word command. This is because of the nature of the tellraw thinking that the command ends earlier than it should with other speech marks. To make the tellraw not count other speech marks as the endpoint, you need to add a backwards-slash to void them as the endpoint:
"clickEvent":{"action":"run_command","value":"/tellraw @p {"\text\":\"No Soul Taken\",\"color\":"\gold\"} When the full command is compiled and ran, it gives us:
/tellraw @p {"text":"","color":"white","extra":[{"text":" Hi, can I take your soul? ","color":"gold"},{"text":"[Yes] ","color":"green","clickEvent":{"action":"run_command","value":"/effect @p 7 1 3"},"hoverEvent":{"action":"show_text","value":"This will take your soul"}},{"text":"[No]","color":"red","clickEvent":{"action":"run_command","value":"/tellraw @p {\"text\":\"No Soul Taken\",\"color\":\"gold\"}"},"hoverEvent":{"action":"show_text","value":"This wont take your soul"}}]}
Suggesting text/insertion
A quick example of suggesting text wont spark many ideas, but this could be useful in adventure maps when you want the player to talk back to something. Here is your average tellraw command:
/tellraw @p {"text":"I want bacon"} Simple? Now we'll add a new tag.
/tellraw @p {"text":"I want bacon","clickEvent":{"action":"suggest_command","value":"Your not eating mine"}} suggest_command Clear what is in the player's chat box and enters a configurable value (Here, its "Your not eating mine"). Clicking the text gives us:
Insertion is slightly different. It can only be used when shift clicked and is not part of the 'clickEvent' tag, and it does not clear the chat box, it inserts text.
/tellraw @p {"text":"I want bacon","insertion":"Your not eating mine"} Shift clicking on this multiple times results in:
Text colours and effects
So, you have seen colours, and know how to do them, but what is the full list of colours? Here they are:
dark_blue
black
dark_green
dark_aqua
dark_red
gold
dark_purple
blue
dark_gray
gray
green
red
white
aqua
yellow
light_purple
reset So now you know the colours, but is there any text effects you ask? Well yes there is.
The following commands will say the respective text effect in chat and show what they look like.
/tellraw @p {"text":"italic","italic":"true"} /tellraw @p {"text":"bold","bold":true} /tellraw @p {"text":"underlined","underlined":"true"} /tellraw @p {"text":"strikethrough","strikethrough":"true"} /tellraw @p {"text":"obfuscated","obfuscated":"true"}
/summon Metadata Tags
Introduction (IMPORTANT BEFORE YOU CONTINUE)
Let me stop you right here before you go on. If you are reading this, cookie for you, as it is very important. Here, I have stopped the layout completely as 1. I assume you have read important parts from above. 2. I assume you have understood the above. 3. I assume you will get the general idea.
Any-who, I shall delve into the subject of summoning.
The basic command is /summon (entity) and that is what we'll be working around, the layout for /summon is '/summon (EntityName) [x]* [y]* [z]* [metadata]'
0*These can be relative co-ordinates
Armor
Armor can be used on every single mob in the game BUT but but it only shows on Zombies, Skeletons, Zombie Pigmen, Wither Skeletons, and Witches*
*Only partially.
Here is your average summon command:
/summon Zombie ~ ~ ~ Which doesn't take a genius to figure out it makes a regular crappy Zombie, that will die in the daytime.
Now lets give him some clothes and tools to keep him warm.
/summon Zombie ~ ~ ~ {Equipment:[{id:flint_and_steel},{id:leather_boots},{id:leather_leggings},{id:leather_chestplate},{id:leather_helmet}]} Which summons:
Equipment What the Entity summons with, in the order of Hand, Feet, legs, Chest and head.
id The Id of what the item is.
Simple?
Drop Chances
So, This is a really picky command that doesn't like certain formatting ways.
To do this, you need to insert the count amount for the item (usually 1, unless you want it to drop 64 flint and steel on the floor, and you also need to include them decimal and float (f):
/summon Zombie ~ ~ ~ {Equipment:[{id:flint_and_steel,Count:1},{id:leather_boots},{id:leather_leggings},{id:leather_chestplate},{id:leather_helmet}],DropChances:[5.0f,0.0f,0.0f,0.0f,0.0f]} DropChances The chance of each item dropping, in the order of Hand, Feet, legs, Chest and head, again.
Which summon a zombie with the drop chance of 5 for dropping its flint and steel.
Leashing mobs
Leashing mobs to fences is fair enough:
/summon Pig ~ ~ ~ {Leashed:1,Leash:{X:100,Y:50,Z:100}} Leashed Just identifies the mobs as leashed if this value
Leash Identifies where the mob is leashed to (It cannot be relative coordinates and there must be a fence at the coordinates Leashing mobs to mobs Okay, I worked out the physics for this, and to do so, you have to have some kind of UUID set to the mobs. To do this, add the UUIDMost and Least tags to what you want to leash:
Uh, Quick note. This is in a spoiler because MinecraftForums is glitching up and I can't get it out. If this persists I may have to remake this thread :/ Sorry for any inconvinience this may cause. I was going to finish off summon tags but I can't now. If I do make a new one, the link will be put here.
/give formatting and metadata tags
Names and Lores:
Say you want to give the players some wooden swords:
Easy Enough? Now try adding a name, for example, Mr. Tree's Branch:
display The Display syntax Means basically, the visible properties of the item.
Name Is pretty straight forward, the name of the item.This gives us:Simple, huh?
Lores are slightly harder, but not by much. So we have Mr. Trees branch, we can add a description to it. Say this was pulled from Mr. Tree, we could add this to our current MetaData:
Its not a lot of description though, so we can add another line of Lore by separating the lore area.
When we compile all this, it gives us:Simple but it looks nice, am I right?
Enchantments:
Mr. Trees Branch can be upgraded with the power of enchanting, and the syntax is this:
/give @a wooden_sword 1 0 {display:{Name:"Mr. Tree's Branch",Lore:["Pulled From Mr. Tree","He does not care of the branch"]},ench:[{id:34,lvl:10}]} ench This syntax means the list of enchantments you will have.
id This is the id of the enchantment, in this case 34=Unbreaking.
lvl This Means the power of the enchantment, in this case 10. This Gives us:
Multiple Enchantments: So now the branch wont break, but what about the damage its doing, its only 4! Simple, More enchantments! To add more enchantments, simply edit the area where it reads
ench:[{id:34,lvl:10}]} We can add more enchantments after where it reads } but before the ].
ench:[{id:34,lvl:10},{id:20,lvl:5}]} When we compile all that we have learned, we get this:
(For a list of all the current Enchantment ids, expand this Spoiler:)
1 Fire Protection
2 Feather Falling
3 Blast Protection
4 Projectile Protection
5 Respiration
6 Aqua Affinity
7 Thorns
8 Depth Strider
16 Sharpness
17 Smite
18 Bane of Arthorpods
19 Knockback
20 Fire Aspect
21 Looting
32 Efficiency
33 Silk Touch
34 Unbreaking
35 Fortune
48 Power
49 Punch
50 Flame
51 Infinity
61 Luck of the Sea
62 Lure
Lets start afresh, Mr. Tree's Branch can go back to bed now
I'm going to make a 'teleporter' here so the basic command is this:
/give @p compass 1 0 {AttributeModifiers:[{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:50,Operation:0,UUIDLeast:894654,UUIDMost:2872}]} This gives the closest Player a compass with a speed attribute of 50, so when they walk, they move so fast it looks like the teleport, just like the bukkit plugin for multiplayer. To alter this to your needs, you can change where it reads 'AttributeName:"generic.movementSpeed"' to any of the possible Attributes (They are listed below) and Where it reads 'Amount:50' to any number (It can be minus). 'Operation:0' Determines weather or not the number is listed as a percentage (For use on potions usually). Change this to '1' to make this happen. 'UUIDLeast' and 'UUIDMost' Syntaxs can be played around with all day, nobody knows what they do Just make sure UUIDMost is not the same as UUIDLeast
Multiple attributes: This is the same deal as before in the enchanting, separate the first attribute from the second with a comma.Here is the code for a diamond sword with two attributes: /give @p diamond_sword 1 0 {AttributeModifiers:[{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:1,Operation:0,UUIDLeast:894654,UUIDMost:2872},{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:25,Operation:0,UUIDLeast:894654,UUIDMost:2872}]} Which gives us:
Attribute List:
Amplifier This is the strength/amplification of the potion effect. This makes the haste effect amplified by 5.
Duration This is how long the potion effect lasts in game ticks. 20 games ticks=1 second of real life. So here the potion effect lasts for 15 seconds.
Multiple effects: /give @p 373 1 8262 {CustomPotionEffects:[{Id:3,Amplifier:5,Duration:300},{Id:5, Amplifier:20,Duration:100}]} This is similar again to before, in the enchantments. Separate the two effects with a comma like above.The finished command gives us:WARNING! IF THIS COMMAND IS ENTERED INCORRECTLY IT COULD CRASH YOUR GAME!
/tellraw formatting and Codes
What is Tellraw?
Tellraw is in a code called JSON, which is different from the minecraft code. Also, I am not doing a lesson on json, just minecraft formatting For how to code in JSON, click here.The Main Format format for tellraw runs on a basis of "string:Value"
string String means command name or what you want the code to run.
value Value is the commands argument(s)
This command makes the command write out a line of text that read 'Please don't hurt me, I come in peace!' /tellraw @a {"text":"Please don't hurt me, I come in peace!"} If we wish, we can colour this.
/tellraw @a {"text":"Please don't hurt me, I come in peace!","color":"gold"} This command gives us:text This is what the command will say physically in chat.
color This changes the colour of the text that is spoken.
/tellraw @p {"text":"","color":"white","extra":[{"text":" Hi, can I take your soul? ","color":"gold"},{"text":"[Yes] ","color":"green","clickEvent":{"action":"run_command","value":"/effect @p 7 1 3"},"hoverEvent":{"action":"show_text","value":"This will take your soul"}},{"text":"[No]","color":"red","clickEvent":{"action":"run_command","value":"/tellraw @p NoSoulTaken"},"hoverEvent":{"action":"show_text","value":"This wont take your soul"}}]} This command allows the players to interact with villagers.Clicking yes results in this:And clicking no results in:extra Self explanatory, adds extra to the command.
clickEvent This runs an action when an area of the text is clicked.
action This is the action mentioned above.
run_command This is the action, it runs a certain command.
hoverEvent This runs an action when your hover over certain text.
show_text This shows a value of text like when you hover over an item.
Phew, that was hard and also may be hard to follow
Running a tellraw command in tellraw:
This was not fully possible to all its extents, so lets see why. A zoomed in version of the command above:
"clickEvent":{"action":"run_command","value":"/tellraw @p NoSoulTaken" As you can see, the tellraw in it is only a one word command. This is because of the nature of the tellraw thinking that the command ends earlier than it should with other speech marks. To make the tellraw not count other speech marks as the endpoint, you need to add a backwards-slash to void them as the endpoint:
"clickEvent":{"action":"run_command","value":"/tellraw @p {"\text\":\"No Soul Taken\",\"color\":"\gold\"} When the full command is compiled and ran, it gives us:
/tellraw @p {"text":"","color":"white","extra":[{"text":" Hi, can I take your soul? ","color":"gold"},{"text":"[Yes] ","color":"green","clickEvent":{"action":"run_command","value":"/effect @p 7 1 3"},"hoverEvent":{"action":"show_text","value":"This will take your soul"}},{"text":"[No]","color":"red","clickEvent":{"action":"run_command","value":"/tellraw @p {\"text\":\"No Soul Taken\",\"color\":\"gold\"}"},"hoverEvent":{"action":"show_text","value":"This wont take your soul"}}]}
/tellraw @p {"text":"I want bacon"} Simple? Now we'll add a new tag.
/tellraw @p {"text":"I want bacon","clickEvent":{"action":"suggest_command","value":"Your not eating mine"}} suggest_command Clear what is in the player's chat box and enters a configurable value (Here, its "Your not eating mine"). Clicking the text gives us:
Insertion is slightly different. It can only be used when shift clicked and is not part of the 'clickEvent' tag, and it does not clear the chat box, it inserts text.
/tellraw @p {"text":"I want bacon","insertion":"Your not eating mine"} Shift clicking on this multiple times results in:
dark_blue
black
dark_green
dark_aqua
dark_red
gold
dark_purple
blue
dark_gray
gray
green
red
white
aqua
yellow
light_purple
reset
So now you know the colours, but is there any text effects you ask? Well yes there is.
The following commands will say the respective text effect in chat and show what they look like.
/tellraw @p {"text":"italic","italic":"true"} /tellraw @p {"text":"bold","bold":true} /tellraw @p {"text":"underlined","underlined":"true"} /tellraw @p {"text":"strikethrough","strikethrough":"true"} /tellraw @p {"text":"obfuscated","obfuscated":"true"}
/summon Metadata Tags
Introduction (IMPORTANT BEFORE YOU CONTINUE)
1. I assume you have read important parts from above.
2. I assume you have understood the above.
3. I assume you will get the general idea.
Any-who, I shall delve into the subject of summoning.
The basic command is /summon (entity) and that is what we'll be working around, the layout for /summon is '/summon (EntityName) [x]* [y]* [z]* [metadata]'
0*These can be relative co-ordinates
*Only partially.
Here is your average summon command:
/summon Zombie ~ ~ ~ Which doesn't take a genius to figure out it makes a regular crappy Zombie, that will die in the daytime.
Now lets give him some clothes and tools to keep him warm.
/summon Zombie ~ ~ ~ {Equipment:[{id:flint_and_steel},{id:leather_boots},{id:leather_leggings},{id:leather_chestplate},{id:leather_helmet}]} Which summons:
Equipment What the Entity summons with, in the order of Hand, Feet, legs, Chest and head.
id The Id of what the item is.
Simple?
To do this, you need to insert the count amount for the item (usually 1, unless you want it to drop 64 flint and steel on the floor, and you also need to include them decimal and float (f):
/summon Zombie ~ ~ ~ {Equipment:[{id:flint_and_steel,Count:1},{id:leather_boots},{id:leather_leggings},{id:leather_chestplate},{id:leather_helmet}],DropChances:[5.0f,0.0f,0.0f,0.0f,0.0f]} DropChances The chance of each item dropping, in the order of Hand, Feet, legs, Chest and head, again.
Which summon a zombie with the drop chance of 5 for dropping its flint and steel.
/summon Pig ~ ~ ~ {Leashed:1,Leash:{X:100,Y:50,Z:100}} Leashed Just identifies the mobs as leashed if this value
Leash Identifies where the mob is leashed to (It cannot be relative coordinates and there must be a fence at the coordinates
Leashing mobs to mobs Okay, I worked out the physics for this, and to do so, you have to have some kind of UUID set to the mobs. To do this, add the UUIDMost and Least tags to what you want to leash:
Thanks for the Support!
I was planning on removing this, but since you like it, I'll carry on
Don't worry, I won't.
EDIT:
Looks like the forums removed most of the paragraphs , I'll fix that asapFixed!I'm looking for more ideas to place here. Anyone who would like to suggest an idea is welcome to do so.
-Fallen