Editing
MinecraftCommands
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== {{anchor|Raw JSON Text}} Raw JSON text === The {{cmd|tellraw}} and {{cmd|title}} commands use strict JSON syntax. Scores and target selectors are evaluated for a [[Sign]] when it is placed or edited and for a [[Written Book]] when it is "resolved" (opened for the first time after signing). They won't update after that, and they won't work if edited onto an existing sign with an NBT editor, or onto a book that's already marked resolved. There's no way to wrap text onto the next line of a sign or the next page of a book during resolution; instead, the extra text will simply disappear. The format of raw JSON text is a JSON Object which supports the following (mostly optional) elements: <div class="treeview"> * {{nbt|compound}} The base chat component Object ** {{nbt|string|text}}: A string representing raw text to display directly in chat. Note that selectors such as "@a" and "@p" are not translated into player names; use '''selector''' instead. "\n" is newline (enter). ** {{nbt|list|extra}}: A list of additional objects, sharing the same format as the base object. *** {{nbt|compound}} A list element with the same format as the base object (recursive). Note that all properties of this object are inherited by children except for '''text''', '''extra''', '''translate''', '''with''', and '''score'''. This means that children will retain the same formatting and events as this object unless they explicitly override them. ** {{nbt|string|color}}: The color to render this text in. Valid values are "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", "white", and "reset" (cancels out the effects of colors used by parent objects). Technically, "bold", "underline", "italic", "strikethrough", and "obfuscated" are also accepted, but it may be better practice to use the tags below for such formats. ** {{nbt|string|bold}}: Boolean (true/false) - whether to render text in bold. Defaults to false. ** {{nbt|string|underlined}}: Boolean (true/false) - whether to render text underlined. Defaults to false. ** {{nbt|string|italic}}: Boolean (true/false) - whether to render text in italics. Defaults to false. ** {{nbt|string|strikethrough}}: Boolean (true/false) - whether to render text with a strikethrough. Defaults to false. ** {{nbt|string|obfuscated}}: Boolean (true/false) - whether to render text obfuscated. Defaults to false. ** {{nbt|string|insertion}}: When the text is shift-clicked by a player, this string will be inserted in their chat input. It will not overwrite any existing text the player was writing. ** {{nbt|compound|clickEvent}}: Allows for events to occur when the player clicks on text. *** {{nbt|string|action}}: The action to perform when clicked. Valid values are "open_url" (opens '''value''' as a URL in the player's default web browser), "open_file" (opens the '''value''' file on the users computer), "twitch_user_info" (opens info about a twitch user), "run_command" (has '''value''' entered in chat as though the player typed it themselves. This can be used to run commands, but the command will fail if the player does not have the required permissions to use it), "change_page" (can only be used in written books) changes to page '''value''' if that page exists, and "suggest_command" (similar to "run_command", but the text only appears in the player's chat input, and is not automatically entered. Unlike '''insertion''', this will replace the existing contents of the chat input). "open_file" and "twitch_user_info" cannot be used with commands. *** {{nbt|string|value}}: The URL, file, twitch user, chat, command or book page used by the specified '''action'''. Note that commands must be prefixed with the usual "/" slash. ** {{nbt|compound|hoverEvent}}: Allows for a tooltip to be displayed when the player hovers their mouse over text. *** {{nbt|string|action}}: The type of tooltip to show. Valid values are "show_text" (shows raw JSON text), "show_item" (shows the tooltip of an item which can have NBT tags), "show_achievement" (shows formatted text describing an achievement or statistic. Normal achievement names are green, final achievement names are dark_purple, and statistic names are gray. In addition, a description is given for achievements), and "show_entity" (shows an entity's name, possibly its type, and its UUID). *** {{nbt|string|value}}: The formatting of this tag varies depending on the action. Note that "show_text" is the only action to support an Object as the value; all other action values are Strings and should thus be wrapped in quotes. **** ''"show_text"'': Can be either a raw String of text, or an Object with the same formatting as this base object. Note that '''clickEvent''' and '''hoverEvent''' do not function within the tooltip, but the formatting and '''extra''' tags still work. **** ''"show_item"'': A ''string'' formatted like item NBT data. Contains the "id" tag, and optionally the "Damage" tag and "tag" tag (which is the same compound used as "dataTag" in the {{cmd|give}} command). **** ''"show_achievement"'': The achievement or statistic's name. This uses the same format as achievement and statistic [[Scoreboard#Objectives|Scoreboard objective criteria]] and the {{cmd|achievement}} command. **** ''"show_entity"'': A ''string'' formatted like a compound with the string values "type" (such as "Zombie"), "name", and "id" (should be an entity UUID, but can actually be any string). ** {{nbt|string|translate}}: The translation identifier of text to be displayed using the player's selected language. This identifier is the same as the identifiers found in lang files from assets or resource packs. The translated text will only be displayed if the '''text''' string is ''not'' used. ** {{nbt|list|with}}: A list of chat component arguments and/or string arguments to be used by '''translate'''. *** The arguments are text corresponding to the arguments used by the translation string in the current language, in order (for example, the first list element corresponds to "%1$s" in a translation string). ** {{nbt|compound|score}}: A player's score in an objective. Displays nothing if the player is not tracked in the given objective. Ignored completely if '''text''' or '''translate''' is present. *** {{nbt|string|name}}: The name of the player whose score should be displayed. Selectors (such as @p) can be used, in addition to "fake" player names created by the scoreboard system. In addition, if the name is "*", it will show the reader's own score (for example, <code>/tellraw @a {score:{name:"*",objective:"obj"}}</code> will show every online player their own score in the "obj" objective). Note that non-player entity scores (such as @e[type=Cow]) do not show, even if the entity has been given a score in the objective. *** {{nbt|string|objective}}: The internal name of the objective to display the player's score in. *** {{nbt|string|value}}: Optional. If present, this value is used regardless of what the score would have been. ** {{nbt|string|selector}}: A string containing a selector (@p,@a,@r, or @e) and, optionally, selector arguments. Unlike '''text''', the selector will be translated into the correct player/entity names. If more than one player/entity is detected by the selector, it will be displayed in a form such as 'Name1 and Name2' or 'Name1, Name2, Name3, and Name4'. Ignored completely if '''text''', '''translate''', or '''score''' is present. Clicking a player's name inserted into a /tellraw command this way will suggest a command to whisper to that player. Shift-clicking a player's name will insert that name into chat. Shift-clicking a non-player entity's name will insert its UUID into chat. </div> Due to the '''extra''' tag, the above format may be recursively nested to produce very complex and functional text strings. However, a raw json text doesn't have to be complicated at all: virtually all properties are optional and may be left out. To be valid, each object must have at least either '''text''', '''translate''', '''score''' or '''selector''' (everything else is optional). As a matter of shorthand, however, the entire Object may be substituted with a String. In this case, that string will be considered the value of the '''text''' property. For example, <code>"This is raw text"</code> is equivalent to <code>{text:"This is raw text"}</code>. This shorthand substitution is valid anywhere a raw text object is required (including the base <''raw json message''> argument of {{cmd|tellraw}}, the elements of the '''extra''' list, and the '''value''' of a "show_text" '''hover_event'''). /tellraw also accepts an array of objects and/or strings; they are concatenated. It even accepts a tree of nested arrays; they are traversed depth-first. For example: /tellraw @a ["Hello there, ",{selector:"@p"},"."] /tellraw @a [<!-- -->[<!-- -->[<!-- -->["The "<!-- -->],<!-- -->[<!-- -->["quick ",<!-- -->"brown "<!-- -->],<!-- -->[<!-- -->{selector:"@p"},<!-- -->" jumps "<!-- -->],<!-- -->"over "<!-- -->],<!-- -->"the "],<!-- -->[<!-- -->"lazy ",<!-- -->"dog."<!-- -->]<!-- -->]<!-- -->] Finally, unlike other commands using JSON, {{cmd|tellraw}} Strings support Unicode via the notation <code>\u####</code>, where #### is the Unicode hexadecimal number for the desired character. ;External links : [//www.minecraftforum.net/topic/1975697-174-tellraw-formatting-examples-updated-to-14w02c Skylinerw's JSON Formatting Examples] : [//minecraftjson.com Tellraw Generator]
Summary:
Please note that all contributions to Hegemon Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Hegemon Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information