This is not a tutorial on the JSON format itself. Instead, this will provide examples of JSON usage in Minecraft, specifically through the "/tellraw" and "/title" commands. Most command syntax provided will include indentation for simpler reading. Each will have a spoiler tag displaying a condensed version for copying and pasting. Some commands will have image examples to display the end result.
Formatting features will have icons to indicate which commands can successfully access specific features:
/tellraw: /title:
If you have any questions concerning the /tellraw or /title commands, feel free to ask in the comments. This can include debugging a command you're having an issue with, requesting a specific command from scratch, or just a general question about the topic. Be sure to check the FAQ for typical questions before asking.
STANDARD SYNTAX
Text Component
The visual structure of the JSON format is similar to the NBT format seen in dataTags. Strings use quotation marks to encase text, lists are indicated by square brackets, and compounds are indicated by curly brackets. Here is a list containing every tag used with Minecraft's JSON text component as used in command syntax:
Note: if the above is not up-to-date, you can check the Minecraft Wiki instead.
/tellraw
The /tellraw command allows you to insert a formatted message into the chat, which includes several functions for player interaction.
Syntax:
/tellraw <player> <JSON>
The <player> will be the one who receives the message, allowing you to send messages to specific players via selector parameters. <JSON> is the text component, which can be added in several different ways. The first is simply adding a single word, in which spaces will break the syntax:
Right:
/tellraw @a Hello
Wrong:
/tellraw @a Hello there
If more text is needed, you will need to encase the text within quotation marks. Note that this does not give you access to any of the text component syntax features, and simply uses the "text" tag for the output. This means you will still not be able to apply color (or other formatting options) to text, nor use functions such as "clickEvent" or "hoverEvent.
Right:
/tellraw @a "Hello there"
Wrong:
/tellraw @a "Hello there",color:blue
If you wish to gain access to all of the features, you must use the full text component syntax, opening with curly brackets and properly labeling tags. Curly brackets indicate the root compound tag that holds the text component. Within it will contain all of the tags used in text manipulation, though not all features are available depending on its usage. For example, the "clickEvent" tag is not usable in the /title command, but can be used in /tellraw.
Right:
/tellraw @a {text:"Hello there",color:blue}
Wrong:
/tellraw @a {"Hello there",color:blue}
Alternatively, you may start directly within the "extra" tag to quickly insert more text. This will require you to open the JSON with square brackets instead, as the "extra" tag is a list while the root component is a compound.
Right:
/tellraw @a [{text:"Hello there",color:blue}]
Right:
/tellraw @a ["Hello there"]
Wrong:
/tellraw @a {{text:"Hello there",color:blue}}
Wrong:
/tellraw @a [Hello there]
/title
The /title command allows you to display large text within the center of the screen for a specified duration. This includes a large title and a smaller subtitle.
Syntax:
/title <player> <title|subtitle> <JSON>
/title <player> <clear|reset>
/title <player> times <fadeIn> <stay> <fadeOut>
The /title command follows the same syntax requirements for the JSON message as /tellraw. Each time the /title command runs a 'title', the stored 'subtitle' is displayed and removed from storage. This means you will have to create a subtitle each time you want it to appear. A single word can be displayed by excluding quotation marks, but that would be the limit of your command.
Right:
/title @a title Hello
Wrong:
/title @a title Hello there
You would then use quotation marks to insert more text. Note that with the /title command, you can have a blank 'title' by merely opening and closing the quotation marks while inserting no text, and the stored 'subtitle' will still be displayed. As stated earlier, this method of inserting text cannot be formatted.
Right:
/title @a title "Hello there"
Wrong:
/title @a title "Hello there",color:blue
Just like the /tellraw command, the /title command will require you to open the root text component with curly brackets. You can also begin within the "extra" tag by using square brackets instead, but will instead have to follow the "extra" format, as it is a list instead of compound.
Right:
/title @a title {text:"Hello there",color:blue}
Right:
/title @a title [{"Hello there",color:blue}]
Wrong:
/title @a title {"Hello there",color:blue}
Wrong:
/title @a title [text:"Hello there",color:blue]
TEXT FORMATTING
Colors
Currently (14w20b) we are restricted to a predetermined list of colors that we can choose from for our text. The "color" tag is used for selecting one of the colors, with the default being white. Note that colors, like all formatting options and functions, are inherited by text children (such as via the "extra" tag). List of available colors:
black dark_blue dark_green dark_aqua dark_red dark_purple gold gray dark_gray blue green aqua red light_purple yellow white
/title @a subtitle {text:"there",color:blue}
/title @a title {text:"Hello",color:gold}
Options
Along with color, you can assign different text emphases, such as bold, italic, and underlined. Each of these tags are booleans, meaning you'll only use "true" or "false" as the value. By default, all of these tags are set to "false". A list of the available options:
/title @a subtitle {text:"there",bold:true,italic:true}
/title @a title {text:"Hello",underlined:true,strikethrough:true,obfuscated:true}
ESCAPING
There are instances where you end up using quotation marks within quotation marks, such as in "clickEvent" or "hoverEvent" values. These quotation marks will tell the game that the tag has ended early, and the remaining text throws an error for being out of place. For example:
text:"I said "hello there" 59 times so far"
The tag's resulting content is:
text:"I said "
And the remaining text outside the tag does not follow proper JSON syntax, thus the command fails to execute. In order to get around this, one of two methods can be used. First, you can swap out the tags' double quotation marks for single (or vice versa). However, if you use any single quotation marks within the text, the same problem will occur. Ultimately, the second method will need to be used, in which you apply a backslash character just before the quotation mark. This tells the game to not use that quotation mark to end the tag. You will have to do this for all quotation marks:
text:'I said "hello there" 60 times so far'
text:"I said \"hello there\" 61 times so far"
CHAT FUNCTIONS
"clickEvent" NOTE: Web Links must be enabled to use this feature (Options -> Multiplayer Settings)
The "clickEvent" function allows you to detect when the player clicks on text provided through the /tellraw command. Once clicked, a selected "action" is performed. These actions are accompanied by a "value" to be used based on the action. The "clickEvent" tag is a compound, thus it encases its data with curly brackets.
run_command = The player clicking will automatically insert the "value" into chat as if they were typing it themselves. Thus commands can be run, but the player can also simply insert text into the chat. Base coordinates will be that of the player, meaning a simple @p will be the player clicking. Due to its behaviour, players who are not OP'd will not be capable of running many commands. "value" will also be limited by the 100-character limit players have. The /trigger command was created to overcome these issues.
suggest_command = The player clicking will automatically replace all text within their chat textbox with the "value". This differs from "insertion" in that it does not require shift to be held, and that it will replace text within the textbox rather than append at the end. "value" does not necessarily need to be a command.
The "hoverEvent" function allows you to perform a specific action when a player hovers over text provided by the /tellraw command. These actions are currently limited to displaying further text at the mouse cursor. The text shown is dependent on the "value", in which the format of the text can differ depending on the action. Just like the "clickEvent", this compound tag contains its data within curly brackets.
show_text = Intangible, formatable text appears at the cursor. The "value" will be the text component, which is inserted as though you're creating the JSON for a /tellraw or /title command. This means the text can either be encased in only quotation marks, curly brackets to start within the root of the component, or square brackets to start in the "extra" tag. This will allow you to apply colors and other options to the hover text.
show_item = Intangible text appears at the cursor, defaulting to the format in which Minecraft items are displayed. The "value" will contain NBT data for the item, starting at the root item tree. Unlike the text component, you must encase the NBT data in quotation marks. This will result in the need to escape recessive quotes. See the Wiki for more information on the NBT format for items.
show_entity = Intangible and unformatable text appears at the cursor. "value" must follow a specific format for displaying very basic entity data. The "value" only has three tags (none of which are required), being 'name' for the custom entity name, 'type' for the entity ID, and 'id' for the UUID. "value" must also be encased in quotation marks.
show_achievement = Intangible and unformatable text appears at the cursor. "value" will be the achievement ID (starting with "achievement") or statistic ID, which will fill in the blanks for the presented and pre-formatted text. You can find a list of achievement IDs here and statistic IDs here.
Unlike "clickEvent" and "hoverEvent", "insertion" is a single string with one purpose: upon holding shift and left-clicking the text, the player will append the value of the tag at the end of what is currently in their chat textbox. If there is not enough room for the entire value, what will fit will be inserted. This function can be seen in Minecraft when using the /say command to display entities; shift-clicking the entity name will insert the UUID into your textbox using the "insertion" method.
The "score" function displays the score value of a specified objective and matching player. This resulting text is used instead of the root "text" tag. If you need to insert more text than this, you will have to use the "extra" tag.
Currently (14w20b) the "name" tag does not allow you to use player selectors to display an unkwnown player's score. In this case, it would be more useful to display known fake player scores. However, you can use the 'operation' method in the /scoreboard command to make a fake player's score equal to an unknown player's score, and use the fake player to display it. You can also use an asterisk (*) in place of the "name" to have the objective score of the viewing player display to them (essentially, players would see their own scores).
/tellraw @a {text:"Your score is: ",extra:[{score:{name:"*",objective:"TEST"}}]}
/tellraw @a ["Your score is: ",{score:{name:"*",objective:"TEST"}}]
"selector"
To compensate for the inability to use player selectors to display player names, the "selector" tag allows you to input a selector to display a player (or entity) name. This will replace the "text" tag for display, so again you will have to use the "extra" tag to insert more text. The /tellraw command will fail to execute if the selector does not find a match.
Language files can be accessed to display translatable text using the "translate" tag. The resulting output will be dependent on what language the viewer has selected. As usual, this replaces the "text" tag. Some translatable text require additional arguments to fill in blanks, in which the "with" list-tag will provide such text. The "with" tag, like "extra", is a list of text components. This means you can format the text to what you'd like, as well as inserting functions or using other alternative texts (such as displaying a score or player name (currently bugged), or even another translation). If arguments are not properly provided, the argument will be left blank instead.
Examples:
/tellraw @a {
translate:"item.ghastTear.name"
}
NOTE: achievement.openInventory.desc = Press '%1$s' to open your inventory.
/tellraw @a {
translate:"achievement.openInventory.desc",
with:[
"ESC"
]
}
The "exra" tag is a list of text components, which is essentially a collection of individual texts. Typically this should not be used for very simple, unedited text. However, if you would like only a single word out of a sentence to be clicked on, or have different words be different colors, then you will have to use this tag.
There are two methods of instantiating an "extra" tag. First is the normal method, in which you open at the root of the component, defining the required text display (via an applicable method, such as "test" or "translate") and then the "extra" tag.
Example:
/tellraw @a {
text:"Hello ",
extra:[
"there."
]
}
/tellraw @a {text:"Hello ",extra:["there."]}
The other method is to open the raw JSON text within the "extra" tag by using square brackets instead of curly. This will require you to follow the standard format for the "extra" tag.
Example:
/tellraw @a [
"Hello ",
"there."
]
/tellraw @a ["Hello ","there."]
Because each list item is an individual text component, you must follow the syntax for instantiating raw JSON text. If you need to colorize the text, you must open the root (now child) compound tag.
When you use the "extra" tag, the text within it will inherit all properties of the parent (or root) component. This includes colors, emphasis options, and all functions such as "clickEvent" and "hoverEvent".
To avoid having all extra text inherit from the root, you can instead leave the root "text" blank. Instantiating the raw JSON with the "extra" tag will not prevent inheritance, and instead chooses the first listed text component's properties as the parent.
You can insert "extra" tags within themselves, in which they will receive the properties of the immediate parent. Any unspecified properties will inherit from each parent upward until it reaches the root.
In the above command, the "!!!" is yellow and inherits the underline from the parent above, and the bold from the root. This child has its own color specified, so it will not inherit it from any parent.
UNICODE
Minecraft's JSON text includes unicode support, which allows you to enter a large number of characters not normally accessible via the standard keyboard. The format for a unicode character is \u#### in which # represents the unicode number. For example, to display the runic letter "o", which has a unicode character of 16DF:
/tellraw @a "Hello there \u16DF"
The unicode's insertion can be prevented by applying a backslash before the format:
Q. Can multiple "clickEvents" be run at the same time? A. No, you can only activate one "clickEvent" at a time. If you have multiple clickEvents for the same text, the last "clickEvent" that is entered will be the one that runs, while the others are ignored.
Q. Is there any way to run multiple commands in one click? A. Not directly. You must use external methods, such as using /trigger within the "clickEvent" and detecting the change in score using a redstone clock. You would then use that signal to activate other command blocks.
Q. Can I run commands relative to the player that originally could not, such as /setblock? A. Yes, the player becomes the initiator of the command, thus any relative coordinates will be of that player. It would be better to use /trigger and /execute combined, as the player must be OP'd to use /setblock in the /tellraw command.
Q. What if I have the player run a command such as /effect @p[score_NAME_min=1] 14 1000000? A. The nearest player to the player clicking would be themselves. Thus the @p selector would select the player running the command. However, if that player does not match the parameters (score_NAME_min), the next player (being the one closest to the initiator) will be selected instead, continuing until a player finally matches.
Q. Does the player clicking need to be OP'd? A. Yes. The /trigger command was added to overcome this.
Q. Do I need to put quotes around every single variable and value? A. No, the only time you need to include quotation marks is for values you expect to use spaces or commas, such as the "text" and "value" tags. The names themselves don't need to be in quotes, but the values do.
Q. What is the character limit for command blocks? A. The character limit is 32,767 characters.
Q. What is the character limit for the "value" tag for "clickEvents"? A. Currently, commands run through the clickEvent are run through the player clicking. So if I were to click, I am the one running that command (not the command block). Players have a character limit of 100, so if your "value" exceeds this amount, the command will not run properly.
Q. Can I use player selectors (@p, @a, @r) within the /tellraw text? A. No, the standard JSON string tags do not parse player selectors. You must use the "selector" tag to display unknown player names.
Q. Can a newline be inserted? A. Not within chat or title output. It is possible to use the newline character (\n) in the "hoverEvent's" 'show_text' action to go to a new line.
Q. Can I reset all formatting options in one tag? A. No such "reset" tag exists for the text component. In previous formatting methods using the section symbol (§), one could use "§r" to reset all formatting options back to default, but there is no proper feature for this.
Q. Do I have to include arguments with translatable text that requires them? A. No. Any unprovided arguments will be left blank. The order in which you insert the text components in the "with" tag is the same order that it fills in the arguments.
Q. Is there an easy method to create /tellraw commands? A. Yes, linked below is a useful web-based tool for creating /tellraw commands.
Q. Is the /tellraw and /title format the same as the format used in NBT data? A. Both use the JSON format. However, in-game the parsing rules are different. For example, you can encase the labels with quotation marks in the /tellraw and /title commands, but not in NBT data for /summon, /setblock, or other commands using NBT data. Eventually, all string tags will allow you to use the JSON text component to apply text formatting.
OUTRO
If you have any questions, just ask! If there is outdated, missing, or incorrect information, please correct me by leaving a reply in this topic or sending me a private message. I will attempt to keep this topic up-to-date, though will be hesitant in the case of snapshots.
-
View User Profile
-
View Posts
-
Send Message
Retired Staff(for /tellraw and /title)
Note: this post contains 1.8 content. Not all of it will work in previous versions.
1. Introduction
2. Standard Syntax
ii. /tellraw
iii. /title
ii. Options
5. Chat Functions
ii. "hoverEvent"
iii. "insertion"
ii. "selector"
iii. "translate"
ii. Inheritance
9. /trigger
10. FAQ
11. Outro
This is not a tutorial on the JSON format itself. Instead, this will provide examples of JSON usage in Minecraft, specifically through the "/tellraw" and "/title" commands. Most command syntax provided will include indentation for simpler reading. Each will have a spoiler tag displaying a condensed version for copying and pasting. Some commands will have image examples to display the end result.
Formatting features will have icons to indicate which commands can successfully access specific features:
/tellraw:
/title:
If you have any questions concerning the /tellraw or /title commands, feel free to ask in the comments. This can include debugging a command you're having an issue with, requesting a specific command from scratch, or just a general question about the topic. Be sure to check the FAQ for typical questions before asking.
The visual structure of the JSON format is similar to the NBT format seen in dataTags. Strings use quotation marks to encase text, lists are indicated by square brackets, and compounds are indicated by curly brackets. Here is a list containing every tag used with Minecraft's JSON text component as used in command syntax:
{ text:"<text>", selector:"<selector>", insertion:"<text>", translate:"<lang>", color:<color>, bold:<true/false>, italic:<true/false>, underlined:<true/false>, strikethrough:<true/false>, obfuscated:<true/false>, clickEvent:{ action:<action>, value:"<value/URL>" }, hoverEvent:{ action:<action>, value:"<value/JSON/NBT>" }, score:{ name:"<player>", objective:"<objective>" }, with:[ <JSON> ], extra:[ <JSON> ] }The /tellraw command allows you to insert a formatted message into the chat, which includes several functions for player interaction.
Syntax:
The <player> will be the one who receives the message, allowing you to send messages to specific players via selector parameters. <JSON> is the text component, which can be added in several different ways. The first is simply adding a single word, in which spaces will break the syntax:
Right:
Wrong:
If more text is needed, you will need to encase the text within quotation marks. Note that this does not give you access to any of the text component syntax features, and simply uses the "text" tag for the output. This means you will still not be able to apply color (or other formatting options) to text, nor use functions such as "clickEvent" or "hoverEvent.
Right:
Wrong:
If you wish to gain access to all of the features, you must use the full text component syntax, opening with curly brackets and properly labeling tags. Curly brackets indicate the root compound tag that holds the text component. Within it will contain all of the tags used in text manipulation, though not all features are available depending on its usage. For example, the "clickEvent" tag is not usable in the /title command, but can be used in /tellraw.
Right:
/tellraw @a {text:"Hello there",color:blue}Wrong:
/tellraw @a {"Hello there",color:blue}Alternatively, you may start directly within the "extra" tag to quickly insert more text. This will require you to open the JSON with square brackets instead, as the "extra" tag is a list while the root component is a compound.
Right:
/tellraw @a [{text:"Hello there",color:blue}]Right:
Wrong:
/tellraw @a {{text:"Hello there",color:blue}}Wrong:
The /title command allows you to display large text within the center of the screen for a specified duration. This includes a large title and a smaller subtitle.
Syntax:
The /title command follows the same syntax requirements for the JSON message as /tellraw. Each time the /title command runs a 'title', the stored 'subtitle' is displayed and removed from storage. This means you will have to create a subtitle each time you want it to appear. A single word can be displayed by excluding quotation marks, but that would be the limit of your command.
Right:
Wrong:
You would then use quotation marks to insert more text. Note that with the /title command, you can have a blank 'title' by merely opening and closing the quotation marks while inserting no text, and the stored 'subtitle' will still be displayed. As stated earlier, this method of inserting text cannot be formatted.
Right:
Wrong:
Just like the /tellraw command, the /title command will require you to open the root text component with curly brackets. You can also begin within the "extra" tag by using square brackets instead, but will instead have to follow the "extra" format, as it is a list instead of compound.
Right:
/title @a title {text:"Hello there",color:blue}Right:
/title @a title [{"Hello there",color:blue}]Wrong:
/title @a title {"Hello there",color:blue}Wrong:
Currently (14w20b) we are restricted to a predetermined list of colors that we can choose from for our text. The "color" tag is used for selecting one of the colors, with the default being white. Note that colors, like all formatting options and functions, are inherited by text children (such as via the "extra" tag). List of available colors:
dark_blue
dark_green
dark_aqua
dark_red
dark_purple
gold
gray
dark_gray
blue
green
aqua
red
light_purple
yellow
white
Examples:
/tellraw @a { text:"Hello there", color:gold }/title @a subtitle { text:"there", color:blue } /title @a title { text:"Hello", color:gold }/tellraw @a {text:"Hello there",color:gold}/title @a subtitle {text:"there",color:blue} /title @a title {text:"Hello",color:gold}Along with color, you can assign different text emphases, such as bold, italic, and underlined. Each of these tags are booleans, meaning you'll only use "true" or "false" as the value. By default, all of these tags are set to "false". A list of the available options:
italic:true
underlined:true
strikethrough:trueobfuscated:true
Examples:
/tellraw @a { text:"Hello there", bold:true, italic:true, underlined:true, strikethrough:true, obfuscated:true }/title @a subtitle { text:"there", bold:true, italic:true } /title @a title { text:"Hello", underlined:true, strikethrough:true, obfuscated:true }/tellraw @a {text:"Hello there",bold:true,italic:true,underlined:true,strikethrough:true,obfuscated:true}/title @a subtitle {text:"there",bold:true,italic:true} /title @a title {text:"Hello",underlined:true,strikethrough:true,obfuscated:true}There are instances where you end up using quotation marks within quotation marks, such as in "clickEvent" or "hoverEvent" values. These quotation marks will tell the game that the tag has ended early, and the remaining text throws an error for being out of place. For example:
The tag's resulting content is:
And the remaining text outside the tag does not follow proper JSON syntax, thus the command fails to execute. In order to get around this, one of two methods can be used. First, you can swap out the tags' double quotation marks for single (or vice versa). However, if you use any single quotation marks within the text, the same problem will occur. Ultimately, the second method will need to be used, in which you apply a backslash character just before the quotation mark. This tells the game to not use that quotation mark to end the tag. You will have to do this for all quotation marks:
NOTE: Web Links must be enabled to use this feature (Options -> Multiplayer Settings)
The "clickEvent" function allows you to detect when the player clicks on text provided through the /tellraw command. Once clicked, a selected "action" is performed. These actions are accompanied by a "value" to be used based on the action. The "clickEvent" tag is a compound, thus it encases its data with curly brackets.
Examples:
/tellraw @a { text:"Click.", clickEvent:{ action:run_command, value:"/say Clicked." } }/tellraw @a { text:"Click.", clickEvent:{ action:run_command, value:"Clicked." } }/tellraw @a {text:"Click.",clickEvent:{action:run_command,value:"/say Clicked."}}/tellraw @a {text:"Click.",clickEvent:{action:run_command,value:"Clicked."}}Example:
/tellraw @a { text:"Click.", clickEvent:{ action:suggest_command, value:"Hello there" } }/tellraw @a {text:"Click.",clickEvent:{action:suggest_command,value:"Hello there"}}Example:
/tellraw @a { text:"Click.", clickEvent:{ action:open_url, value:"http://www.skylinerw.com" } }/tellraw @a {text:"Click.",clickEvent:{action:open_url,value:"http://www.skylinerw.com"}}The "hoverEvent" function allows you to perform a specific action when a player hovers over text provided by the /tellraw command. These actions are currently limited to displaying further text at the mouse cursor. The text shown is dependent on the "value", in which the format of the text can differ depending on the action. Just like the "clickEvent", this compound tag contains its data within curly brackets.
Examples:
/tellraw @a { text:"Hover.", hoverEvent:{ action:show_text, value:"Hello there." } }/tellraw @a { text:"Hover.", hoverEvent:{ action:show_text, value:{text:"Hello there.",color:blue} } }/tellraw @a { text:"Hover.", hoverEvent:{ action:show_text, value:[{text:"Hello there.",color:blue}] } }/tellraw @a {text:"Hover.",hoverEvent:{action:show_text,value:"Hello there."}}/tellraw @a {text:"Hover.",hoverEvent:{action:show_text,value:{text:"Hello there.",color:blue}}}/tellraw @a {text:"Hover.",hoverEvent:{action:show_text,value:[{text:"Hello there.",color:blue}]}}Example:
/tellraw @a { text:"Hover.", hoverEvent:{ action:show_item, value:"{id:minecraft:iron_pickaxe,tag:{ench:[{id:16,lvl:1}],display:{Lore:[\"Hello there.\"]}}}" } }/tellraw @a {text:"Hover.",hoverEvent:{action:show_item,value:"{id:minecraft:iron_pickaxe,tag:{ench:[{id:16,lvl:1}],display:{Lore:[\"Hello there.\"]}}}"}}Example:
/tellraw @a {
text:"Hover.",
hoverEvent:{
action:show_entity,
value:"{name:\"Bob\",type:Creeper,id:00000000-0000-0000-0000-000000000000}"
}
}
/tellraw @a {text:"Hover.",hoverEvent:{action:show_entity,value:"{name:\"Bob\",type:Creeper,id:00000000-0000-0000-0000-000000000000}"}}Examples:
/tellraw @a { text:"Hover.", hoverEvent:{ action:show_achievement, value:"achievement.theEnd2" } }/tellraw @a { text:"Hover.", hoverEvent:{ action:show_achievement, value:"stat.damageDealt" } }/tellraw @a {text:"Hover.",hoverEvent:{action:show_achievement,value:"achievement.theEnd2"}}/tellraw @a {text:"Hover.",hoverEvent:{action:show_achievement,value:"stat.damageDealt"}}Unlike "clickEvent" and "hoverEvent", "insertion" is a single string with one purpose: upon holding shift and left-clicking the text, the player will append the value of the tag at the end of what is currently in their chat textbox. If there is not enough room for the entire value, what will fit will be inserted. This function can be seen in Minecraft when using the /say command to display entities; shift-clicking the entity name will insert the UUID into your textbox using the "insertion" method.
Example:
/tellraw @a { text:"Click.", insertion:"Hello there." }/tellraw @a {text:"Click.",insertion:"Hello there."}The "score" function displays the score value of a specified objective and matching player. This resulting text is used instead of the root "text" tag. If you need to insert more text than this, you will have to use the "extra" tag.
Currently (14w20b) the "name" tag does not allow you to use player selectors to display an unkwnown player's score. In this case, it would be more useful to display known fake player scores. However, you can use the 'operation' method in the /scoreboard command to make a fake player's score equal to an unknown player's score, and use the fake player to display it. You can also use an asterisk (*) in place of the "name" to have the objective score of the viewing player display to them (essentially, players would see their own scores).
Examples:
/tellraw @a { score:{ name:"Skylinerw", objective:"TEST" } }/tellraw @a { score:{ name:"*", objective:"TEST" } }/tellraw @a { text:"Your score is: ", extra:[ { score:{ name:"*", objective:"TEST" } } ] }/tellraw @a [ "Your score is: ", { score:{ name:"*", objective:"TEST" } } ]/tellraw @a {score:{name:"Skylinerw",objective:"TEST"}}/tellraw @a {score:{name:"*",objective:"TEST"}}/tellraw @a {text:"Your score is: ",extra:[{score:{name:"*",objective:"TEST"}}]}/tellraw @a ["Your score is: ",{score:{name:"*",objective:"TEST"}}]To compensate for the inability to use player selectors to display player names, the "selector" tag allows you to input a selector to display a player (or entity) name. This will replace the "text" tag for display, so again you will have to use the "extra" tag to insert more text. The /tellraw command will fail to execute if the selector does not find a match.
Examples:
/tellraw @a { selector:"@e" }/tellraw @a { selector:"@a[score_TEST_min=1]" }/tellraw @a { text:"Hello there, ", extra:[ { selector:"@p" }, "." ] }/tellraw @a [ "Hello there, ", { selector:"@p" }, "." ]/tellraw @a {selector:"@e"}/tellraw @a {selector:"@a[score_TEST_min=1]"}/tellraw @a {text:"Hello there, ",extra:[{selector:"@p"},"."]}/tellraw @a ["Hello there, ",{selector:"@p"},"."]Language files can be accessed to display translatable text using the "translate" tag. The resulting output will be dependent on what language the viewer has selected. As usual, this replaces the "text" tag. Some translatable text require additional arguments to fill in blanks, in which the "with" list-tag will provide such text. The "with" tag, like "extra", is a list of text components. This means you can format the text to what you'd like, as well as inserting functions or using other alternative texts (such as displaying a score or player name (currently bugged), or even another translation). If arguments are not properly provided, the argument will be left blank instead.
Examples:
/tellraw @a { translate:"item.ghastTear.name" }NOTE: achievement.openInventory.desc = Press '%1$s' to open your inventory. /tellraw @a { translate:"achievement.openInventory.desc", with:[ "ESC" ] }/tellraw @a { translate:"achievement.openInventory.desc", with:[ { selector:"@p", color:gold } ] }/tellraw @a {translate:"item.ghastTear.name"}/tellraw @a {translate:"achievement.openInventory.desc",with:["ESC"]}/tellraw @a {translate:"achievement.openInventory.desc",with:[{selector:"@p",color:gold}]}The "exra" tag is a list of text components, which is essentially a collection of individual texts. Typically this should not be used for very simple, unedited text. However, if you would like only a single word out of a sentence to be clicked on, or have different words be different colors, then you will have to use this tag.
There are two methods of instantiating an "extra" tag. First is the normal method, in which you open at the root of the component, defining the required text display (via an applicable method, such as "test" or "translate") and then the "extra" tag.
Example:
/tellraw @a { text:"Hello ", extra:[ "there." ] }/tellraw @a {text:"Hello ",extra:["there."]}The other method is to open the raw JSON text within the "extra" tag by using square brackets instead of curly. This will require you to follow the standard format for the "extra" tag.
Example:
Because each list item is an individual text component, you must follow the syntax for instantiating raw JSON text. If you need to colorize the text, you must open the root (now child) compound tag.
Examples:
/tellraw @a { text:"Hello ", extra:[ { text:"there.", color:blue } ] }/tellraw @a { text:"Hello ", extra:[ { text:"there ", color:blue }, { selector:"@p" }, "!" ] }/tellraw @a [ "Hello ", { text:"there ", color:blue }, { selector:"@p" }, "!" ]/tellraw @a {text:"Hello ",extra:["there."]}/tellraw @a {text:"Hello ",extra:[{text:"there ",color:blue},{selector:"@p"},"!"]}/tellraw @a ["Hello ",{text:"there ",color:blue},{selector:"@p"},"!"]When you use the "extra" tag, the text within it will inherit all properties of the parent (or root) component. This includes colors, emphasis options, and all functions such as "clickEvent" and "hoverEvent".
Example:
/tellraw @a { text:"Hello ", color:gold, extra:[ "there." ] }/tellraw @a {text:"Hello ",color:gold,extra:["there."]}To avoid having all extra text inherit from the root, you can instead leave the root "text" blank. Instantiating the raw JSON with the "extra" tag will not prevent inheritance, and instead chooses the first listed text component's properties as the parent.
Examples:
/tellraw @a { text:"", extra:[ { text:"Hello ", color:gold }, "there." ] }/tellraw @a [ { text:"Hello ", color:gold }, "there." ]/tellraw @a {text:"Hello ",color:gold,extra:["there."]}/tellraw @a [{text:"Hello ",color:gold},"there."]You can insert "extra" tags within themselves, in which they will receive the properties of the immediate parent. Any unspecified properties will inherit from each parent upward until it reaches the root.
Example:
/tellraw @a { text:"", bold:true, extra:[ { text:"Hello ", color:gold, extra:[ { text:"there ", color:aqua, extra:[ { selector:"@p", underlined:true, extra:[ { text:"!!!", color:yellow } ] } ] } ] } ] }/tellraw @a {text:"",bold:true,extra:[{text:"Hello ",color:gold,extra:[{text:"there ",color:aqua,extra:[{selector:"@p",underlined:true,extra:[{text:"!!!",color:yellow}]}]}]}]}In the above command, the "!!!" is yellow and inherits the underline from the parent above, and the bold from the root. This child has its own color specified, so it will not inherit it from any parent.
Minecraft's JSON text includes unicode support, which allows you to enter a large number of characters not normally accessible via the standard keyboard. The format for a unicode character is \u#### in which # represents the unicode number. For example, to display the runic letter "o", which has a unicode character of 16DF:
The unicode's insertion can be prevented by applying a backslash before the format:
You can find a list of unicode characters here: http://www.unicode.org/charts/
Coming soonTM
Q. Can multiple "clickEvents" be run at the same time?
A. No, you can only activate one "clickEvent" at a time. If you have multiple clickEvents for the same text, the last "clickEvent" that is entered will be the one that runs, while the others are ignored.
Q. Is there any way to run multiple commands in one click?
A. Not directly. You must use external methods, such as using /trigger within the "clickEvent" and detecting the change in score using a redstone clock. You would then use that signal to activate other command blocks.
Q. Can I run commands relative to the player that originally could not, such as /setblock?
A. Yes, the player becomes the initiator of the command, thus any relative coordinates will be of that player. It would be better to use /trigger and /execute combined, as the player must be OP'd to use /setblock in the /tellraw command.
Q. What if I have the player run a command such as /effect @p[score_NAME_min=1] 14 1000000?
A. The nearest player to the player clicking would be themselves. Thus the @p selector would select the player running the command. However, if that player does not match the parameters (score_NAME_min), the next player (being the one closest to the initiator) will be selected instead, continuing until a player finally matches.
Q. Does the player clicking need to be OP'd?
A. Yes. The /trigger command was added to overcome this.
Q. Do I need to put quotes around every single variable and value?
A. No, the only time you need to include quotation marks is for values you expect to use spaces or commas, such as the "text" and "value" tags. The names themselves don't need to be in quotes, but the values do.
Q. What is the character limit for command blocks?
A. The character limit is 32,767 characters.
Q. What is the character limit for the "value" tag for "clickEvents"?
A. Currently, commands run through the clickEvent are run through the player clicking. So if I were to click, I am the one running that command (not the command block). Players have a character limit of 100, so if your "value" exceeds this amount, the command will not run properly.
Q. Can I use player selectors (@p, @a, @r) within the /tellraw text?
A. No, the standard JSON string tags do not parse player selectors. You must use the "selector" tag to display unknown player names.
Q. Can a newline be inserted?
A. Not within chat or title output. It is possible to use the newline character (\n) in the "hoverEvent's" 'show_text' action to go to a new line.
Q. Can I reset all formatting options in one tag?
A. No such "reset" tag exists for the text component. In previous formatting methods using the section symbol (§), one could use "§r" to reset all formatting options back to default, but there is no proper feature for this.
Q. Do I have to include arguments with translatable text that requires them?
A. No. Any unprovided arguments will be left blank. The order in which you insert the text components in the "with" tag is the same order that it fills in the arguments.
Q. Is there an easy method to create /tellraw commands?
A. Yes, linked below is a useful web-based tool for creating /tellraw commands.
Q. Is the /tellraw and /title format the same as the format used in NBT data?
A. Both use the JSON format. However, in-game the parsing rules are different. For example, you can encase the labels with quotation marks in the /tellraw and /title commands, but not in NBT data for /summon, /setblock, or other commands using NBT data. Eventually, all string tags will allow you to use the JSON text component to apply text formatting.
If you have any questions, just ask! If there is outdated, missing, or incorrect information, please correct me by leaving a reply in this topic or sending me a private message. I will attempt to keep this topic up-to-date, though will be hesitant in the case of snapshots.
Useful links:
Web service for creating /tellraw commands: http://www.minecraftforum.net/topic/1980545-snapshot-website-to-generate-tellraw-commands/
Bug report concerning the inability to hide /tellraw 'run_command' output from the chat via the commandBlockOutput gamerule: https://bugs.mojang.com/browse/MC-35431
Bug report concerning the inability to display player scores in translatable text using *: https://bugs.mojang.com/browse/MC-50176
Bug report concerning the inability to display player names in translatable text using "selector": https://bugs.mojang.com/browse/MC-55333