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!
== Usage == In a regular ''Minecraft'' client or the [[stand alone client]], commands are entered via ''Minecraft's'' [[chat]] window, which is displayed by pressing the {{key|T}} key (default) or {{key|/}} key. Using the {{key|/}} key will also enter the forward slash that commands require as a prefix, so it is a useful shortcut. Pressing {{key|Tab}} while entering commands cycles through possible commands or arguments. Commands may also be entered in a multiplayer [[server]]'s console, but are '''not''' preceded by a {{key|/}} when entered this way. A server admin running commands in this way is often referred to as "ghosting". Commands in [[command block]]s '''can be''' preceded by a slash, but it is not required. Commands in a command block may also require an optional argument, usually a player's username. The majority of commands are only available in the following situations: * In a ''Minecraft'' [[multiplayer]] [[server]] game, entered by an [[operator]] or [[command block]]. * In other multiplayer games, entered by the player who opened a [[LAN]] game with cheats enabled, or is hosting their own multiplayer [[server]] * In [[singleplayer]], if cheats were enabled at world creation (via the "More World Options..." button). Some [[#Player commands|player commands]] are also available in singleplayer even when cheats are not enabled. '''Note:''' In singleplayer worlds where cheats were not enabled at creation, they can be enabled on a temporary basis by opening the current game session to LAN play ( {{key|Esc}} β "Open to LAN", then "Allow Cheats" button and "Start LAN World"). You do not actually need to be on a LAN or have others join. This is not permanent, but will allow the use of commands until you quit the world, and changes you make via commands (items spawned, etc.) will be saved with the world. You can do this each time you start playing the world again. Note that this will disable game pausing for the duration, so while open to LAN, you should get somewhere safe or reload your world before using the Game Menu. Remember that you can disable your LAN world by reloading the world. === Tilde notation === Many commands allow ''relative'' coordinates to be specified using [[wikipedia:tilde|tilde]]s (<code>~</code>). A number following a tilde is an ''offset'' from something rather than a coordinate. The sign of the offset specifies whether to go in the positive or negative direction for that axis. A single tilde by itself is shorthand for <code>~0</code>. For example, <code>/tp 0 64 0</code> will teleport the user to the coordinate (0, 64, 0), while <code>/tp ~3 ~ ~-3</code> will teleport the user to a position +3 blocks in the "x" direction (i.e., east), keep their current height, and -3 blocks in the "z" direction (i.e., north). Usually absolute coordinates can be mixed with relative coordinates. For example, <code>/tp ~ 64 ~</code> will keep the user's "x" and "z" coordinates the same, but teleport them to absolute height of 64. The origin for the offset depends on the command. For example, in {{cmd|tp}} the offset is from the target's starting position. Other common offsets include from the position of the command's execution or from another coordinate specified by the command. === Target selectors === In most commands where a player may be specified as an argument, it is possible to "target" one or more players satisfying certain conditions instead of specifying players by name. To target players by condition, choose a target selector variable and, optionally, one or more target selector arguments to modify the conditions to be satisfied. For example, to change the game mode of all players on team Red to creative mode, instead of specifying them by name individually: :<code>/gamemode creative @a[team=Red]</code> <!-- please retain double newline above for section differentiation --> ==== Target selector variables ==== {| class="floatright wikitable" style="clear:none;margin-left:1em;" |+ Summary of target selector variables ! Variable !! Function |- | <code>@p</code> || nearest player |- | <code>@r</code> || random player |- | <code>@a</code> || all players |- | <code>@e</code> || all entities |} A target selector variable identifies the broad category of targets to select. There are four variables: ; <code>@p</code> : Targets the nearest player. If there are multiple nearest players, caused by them being precisely the same distance away, the player who most recently joined the server is selected. : [[#Target selector arguments|Target selector arguments]] may be used to reduce the set of players from which the nearest player will be selected. For example, <code>@p[team=Red]</code> will target the nearest player on team Red even if there are other players closer. : The <code>c</code> target selector argument can be used to increase the number of nearest players targeted (for example, <code>@p[c=3]</code> will target the three nearest players). When negative, <code>c</code> will reverse the order of targeting (for example, <code>@p[c=-1]</code> will target the ''farthest'' player). ; <code>@r</code> : Targets a random player (or entity with the <code>type</code> target selector argument). : [[#Target selector arguments|Target selector arguments]] may be used to reduce the set of players from which a random player will be targeted. For example, <code>@r[team=Red]</code> will only target a random player from team Red. : The <code>c</code> target selector argument can be used to increase the number of random players targeted. For example, <code>@r[c=3]</code> will target three random players. : When used without the <code>type</code> argument, <code>@r</code> always targets a random player. The <code>type</code> argument can be used to target non-player entities (for example, <code>@r[type=Zombie]</code> will target a random [[zombie]], <code>@r[type=!Player]</code> will target a random non-player entity, <code>@r[type=!Zombie]</code> will target a random non-zombie, etc.). ; <code>@a</code> : Targets all players, including dead players. No other selector will find dead players. : [[#Target selector arguments|Target selector arguments]] may be used to reduce the set of players targeted. For example, <code>@a[team=Red]</code> will only target players on team Red. ; <code>@e</code> : Targets all entities (including players). : [[#Target selector arguments|Target selector arguments]] may be used to reduce the set of entities targeted. For example, <code>@e[type=Cow]</code> will only target cows. <!-- please retain double newline above for section differentiation --> ==== Target selector arguments ==== {| class="floatright wikitable" style="clear:none;margin-left:1em;" |+ Summary of target selector arguments ! colspan="2" | Selection by Position |- ! Argument(s) !! Selection criteria |- | <code>x</code>, <code>y</code>, <code>z</code> | [[#Selecting targets by coordinate|coordinate]] |- | <code>r</code>, <code>rm</code> | [[#Selecting targets by radius|radius (max, min)]] |- | <code>dx</code>, <code>dy</code>, <code>dz</code> | [[#Selecting targets by volume|volume dimensions]] |- ! colspan="2" | Selection by Scoreboard Values |- ! Argument(s) !! Selection criteria |- | <code>score_''name''</code> | [[#Selecting targets by score|max score]] |- | <code>score_''name''_min</code> | [[#Selecting targets by score|min score]] |- | <code>tag</code> | [[#Selecting targets by tag|scoreboard tag]] |- | <code>team</code> | [[#Selecting targets by team|team name]] |- ! colspan="2" | Selection by Traits |- ! Argument(s) !! Selection criteria |- | <code>c</code> | [[#Selecting targets by count|count]] |- | <code>l</code>, <code>lm</code> | [[#Selecting targets by experience level|experience level (max, min)]] |- | <code>m</code> | [[#Selecting targets by game mode|game mode]] |- | <code>name</code> | [[#Selecting targets by name|entity name]] |- | <code>rx</code>, <code>rxm</code> | [[#Selecting targets by vertical rotation|vertical rotation (max, min)]] |- | <code>ry</code>, <code>rym</code> | [[#Selecting targets by horizontal rotation|horizontal rotation (max, min)]] |- | <code>type</code> | [[#Selecting targets by type|entity type]] |} After using a target selector, you can optionally use arguments to modify the set of targets selected. When used with <code>@a</code> or <code>@e</code>, arguments narrow down the number of targets from the full list to a specific few. When used with <code>@p</code> or <code>@r</code>, arguments narrow the number of targets down from the full list to a smaller set from which the nearest or random player is selected. Add argument-value pairs as a comma-separated list contained within square brackets after the target selector variable: : <code>@<variable>[<argument>=<''value''>,<argument>=<''value''>,β¦]</code>. Spaces are not allowed around the brackets, equal signs, or commas, and only commas may be used to separate argument-value pairs. Arguments are case-sensitive and unsupported arguments are silently ignored. For example, <code>kill @e[type=Creeper,r=20]</code> will kill all creepers in a 20-block radius, but <code>kill @e['''T'''ype=Creeper,r=20]</code> (the 't' in 'type' capitalized) will kill ''all'' entities (including players) in that radius because there is no longer a ''valid'' argument limiting the targets to just creepers. If the first few arguments (up to four) are specified simply as values without identifying the arguments, they are assumed to be, in order, <code>x</code>, <code>y</code>, <code>z</code>, and <code>r</code>. Thus, the following two commands are identical: :<code>/gamemode creative @a[x=10,y=20,z=30,r=4]</code> :<code>/gamemode creative @a[10,20,30,4]</code> ;{{anchor|Selecting targets by coordinate}}Selecting targets by coordinate : <code>[x=''X'',y=''Y'',z=''Z'']</code> β Selects targets based on distance to that exact position. Combine with selecting by radius to select only targets at that specific position. : The coordinates have to be integers and must be exact - [[#Tilde notation|tilde notation]] is not available for selector argument coordinates. ;{{anchor|Selecting targets by radius}}Selecting targets by radius : <code>[r=''R'']</code> β Selects only targets less than ''R'' blocks from the command's execution. : <code>[rm=''RM'']</code> β Selects only targets more than ''RM'' blocks from the command's execution. :If a coordinate (above) and either or both radius/i are both defined, the radius/i will center on the coordinate rather than the postion of the command's execution. By using a very distant coordinate and a very large radius, it is possible to simulate a near-linear edge to use to specify targets. ;{{anchor|Selecting targets by volume}}Selecting targets by volume : <code>[dx=''DX'',dy=''DY'',dz=''DZ'']</code> : Selects only targets within the volume defined as starting from the location where the command was executed and extending ''DX'' blocks in the "x" direction (i.e., east/west), ''DY'' blocks in the "y" direction (i.e., upwards/downwards), and ''DZ'' blocks in the "z" direction (i.e., north/south). If an initial coordinate is specified with the <code>x</code>, <code>y</code>, and <code>z</code> arguments, that will be used instead of the position of the command's execution for the lower northwestern corner (<code>dx</code>, <code>dy</code>, and <code>dz</code> still specify ''distances'' from that coordinate; they do ''not'' specify a separate coordinate). : It is possible to combine selection by radius and selection by volume, in which case the command will only select targets within the overlap of both regions (within certain radius/i of the volume's lower northwest corner and not outside the defined volume). ;{{anchor|Selecting targets by score}}Selecting targets by score : <code>[score_''name''=''SCORE'']</code> β Selects only targets with a score in objective ''name'' of no more than ''SCORE''. : <code>[score_''name''_min=''SCOREMIN'']</code> β Selects only targets with a score in objective ''name'' of no less than ''SCOREMIN''. : For example, <code>@a[score_points_min=30,score_points=39]</code> will select all players with a score in objective "points" between 30 and 39 (inclusive). {{see also|Scoreboard#Objectives}} ;{{anchor|Selecting targets by tag}}Selecting targets by tag : <code>[tag=''TAG'']</code> β Selects only targets that have been given the scoreboard tag ''TAG''. : <code>[tag=!''TAG'']</code> β Selects only targets that have ''not'' been given the scoreboard tag ''TAG''. : <code>[tag=]</code> β Selects only targets without ''any'' scoreboard tags. : <code>[tag=!]</code> β Selects only targets with ''any'' scoreboard tags. {{see also|Scoreboard#Tags_commands}} ;{{anchor|Selecting targets by team}}Selecting targets by team : <code>[team=''TEAM'']</code> β Selects only targets on team ''TEAM''. : <code>[team=!''TEAM'']</code> β Selects only targets ''not'' on team ''TEAM''. : <code>[team=]</code> β Selects only targets not on ''any'' team. : <code>[team=!]</code> β Selects only targets on ''any'' team. {{see also|Scoreboard#Teams}} ;{{anchor|Selecting targets by count}}Selecting targets by count : <code>[c=''C'']</code> β Selects only the specified number of targets. Usually in order of distance from the command executor. : When used with <code>@p</code> or <code>@r</code>, this argument defaults to 1, so using a higher number will ''increase'' the number of nearest or random targets returned. When used with <code>@a</code> or <code>@e</code>, this argument returns only the nearest targets. :If there are multiple nearest targets, caused by them being precisely the same distance away, targets are sorted by the time they have been on the server (since their most recent join for players or their creation for other entities) with the longest times selected first. For example, ''if equally distant'', <code>@a[c=1]</code> will select the player who has been on the server the longest and <code>@e[type=Creeper,c=3]</code> will select the three oldest creepers. : When used with a negative value, the order of targets is reversed. For example, <code>@p[c=-3]</code> will return the three ''farthest'' targets, and, if all potential targets are equally far away, <code>@e[c=-3]</code> will select the last three targets created. ;{{anchor|Selecting targets by experience level}}Selecting targets by experience level : <code>[l=''L'']</code> β Selects only targets with no more than ''L'' experience levels. : <code>[lm=''LM'']</code> β Selects only targets with no less than ''LM'' experience levels. ;{{anchor|Selecting targets by game mode}}Selecting targets by game mode : <code>[m=''M'']</code> β Selects only targets on the specified [[game mode]]. : <code>[m=!''M'']</code> β Selects only targets that are ''not'' on the specified [[game mode]]. : Permitted values for ''M'' are: :* <code>-1</code>: all game modes :* <code>0</code>, <code>s</code>, <code>survival</code>: survival mode :* <code>1</code>, <code>c</code>, <code>creative</code>: creative mode :* <code>2</code>, <code>a</code>, <code>adventure</code>: adventure mode :* <code>3</code>, <code>sp</code>, <code>spectator</code>: spectator mode ;{{anchor|Selecting targets by name}}Selecting targets by name : <code>[name=''NAME'']</code> β Selects only targets named ''NAME''. : <code>[name=!''NAME'']</code> β Selects only targets ''not'' named ''NAME''. ;{{anchor|Selecting targets by vertical rotation}}Selecting targets by vertical rotation : <code>[rx=''RX'']</code> β Selects only targets with a maximum vertical rotation of ''RX''. : <code>[rxm=''RXM'']</code> β Selects only targets with a minimum vertical rotation of ''RXM''. : Vertical rotation values vary from -90.0 facing straight up to 90.0 facing straight down (thus vertical rotation values increase with rotation ''downwards''). ;{{anchor|Selecting targets by horizontal rotation}}Selecting targets by horizontal rotation : <code>[ry=''RY'']</code> β Selects only targets with a maximum horizontal rotation of ''RY''. : <code>[rym=''RYM'']</code> β Selects only targets with a minimum horizontal rotation of ''RYM''. : Horizontal rotation values vary from -180.0 (facing due north), to -90.0 (facing due east), to 0.0 (facing due south), to 90.0 (facing due west), to 179.9 (just west of due north) before wrapping back to -180.0 (thus horizontal rotation values increase with rotation to the right, or clockwise viewed from above). ;{{anchor|Selecting targets by type}}Selecting targets by type : <code>[type=''TYPE'']</code> β Selects only targets of the specific entity type. : <code>[type=!''TYPE'']</code> β Selects only targets ''not'' of the specific entity type. : ''TYPE'' must be an [[Data values#Entity IDs|entity ID]] used to identify different types of entities internally (for example, <code>Creeper</code> for [[creeper]]s, <code>MinecartRideable</code> for regular [[minecart]]s, <code>PrimedTnt</code> for primed [[TNT]], etc.). Entity IDs are case-sensitive and invalid entity IDs will cause the command to fail. : When used with <code>@r</code>, can change its normal behavior of targeting only players to target other entities. <!-- please retain double newline above for section differentiation --> === Data tags === A '''data tag''' is a sequence of text which describes a data structure using [[wikipedia:attribute-value pair|attribute-value pair]]s. Data tags are used in commands to specify complex data for players, entities, and some blocks. A data tag consists of zero or more attribute-value pairs separated by commas and delineated by curly brackets. Each attribute-value pair consists of an attribute name and the attribute's value, separated by a colon. Some values, however, may themselves contain attribute-value pairs, allowing a data tag to describe a hierarchical data structure. :''Example:'' <code>{name1:123,name2:"sometext",name3:{subname1:456,subname2:789}}</code> The data structures that data tags describe are the same ones used in ''Minecraft'''s save files. These data structures are described in other articles and commands expect data tags to use the same attribute names (which are case-sensitive): {| class="wikitable" |+ Data Structure Specification Links ! Objects ! Examples |- | [[Chunk format#Block entity format|Block entities]] | chests, furnaces, command blocks, mob spawners, signs, etc. |- | [[Player.dat#Item structure|Items]] | items in inventories (includes specifications for enchantments, lore, custom names, etc.) |- | [[Chunk format#Items and XPOrbs|Item entities]] | items on the ground |- | [[Chunk format#Mobs|Mobs]] | creepers, cows, villagers, etc. |- | [[Chunk format#Projectiles|Projectiles]] | arrows, fireballs, thrown potions, etc. |- | [[Chunk format#Vehicles|Vehicles]] | boats, minecarts, etc. |- | [[Chunk format#Dynamic Tiles|Dynamic tiles]] |primed TNT, falling sand/gravel/anvils |- | [[Chunk format#Other|Other entities]] | firework rockets, paintings, and item frames |} The defined data structures also expect the values to be of the correct type. {| class="wikitable" |+ Data Tags Value Types ! Type ! Description |- | {{nbt|byte|Byte}} | An integer between -128 and 127 (inclusive). |- | {{nbt|short|Short}} | An integer between -32,768 and 32,767 (inclusive). |- | {{nbt|int|Int}} | An integer between -2,147,483,648 and 2,147,483,647 (inclusive). |- | {{nbt|long|Long}} | An integer between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 (inclusive). |- | {{nbt|float|Float}}<br>{{nbt|double|Double}} | Numbers which can have a decimal portion (for example, <code>3.14159</code>). |- | {{nbt|string|String}} | A sequence of text, optionally delineated with double quotes. Double quotes ''must'' be used if the String contains commas, curly brackets, or square brackets. To include a double quote ''inside'' a String, add a backslash before the double quote. :''Example:'' <code>"Call me \"Ishmael\""</code> |- | {{nbt|list|List}} | A sequence of values, separated by commas and delineated with square brackets. The values must be of the same type, which is dictated by the first value in the sequence. :''Example:'' <code>[3.2,64.5,129.5]</code> |- | {{nbt|int-array|Int Array}} | A sequence of integers between -2,147,483,648 and 2,147,483,647 (inclusive), separated by commas and delineated with square brackets. |- | style="white-space:nowrap" | {{nbt|compound|Compound}} | A sequence of attribute-value pairs, separated by commas and delineated with curly brackets. :''Example:'' <code>{X:3,Y:64,Z:129}</code> Every data tag argument is itself a Compound. |} The {{nbt|byte-array|Byte Array}} type is unavailable to commands.<!-- see net/minecraft/server/MojangsonPrimitiveParser in mc-dev --> Some commands may require that a number's type be specified by adding a letter (B, S, L, F, D) to the end of the value. For example, <code>3s</code> for a short, <code>3.2f</code> for a float, etc. (This doesn't work with I for int.) The letter can be uppercase or lowercase. When no letter is used and Minecraft can't tell the type from context, it assumes double (if there's a decimal point), int (if there's no decimal point and the number is small enough to store as an int), or string (if neither is true). A square-bracketed literal is assumed to be an int array if every element that's between commas is an int; otherwise, it is assumed to be a list. An exception applies: <code>[]</code> is an empty list, but <code>[,]</code> is an empty int array. When commands such as {{cmd|testfor}}, {{cmd|testforblock}}, and {{cmd|clear}} are used to match data tags, they only check for the presence of the provided tags in the target entity/block/item. This means that the entity/block/item may have additional tags and will still match. This is true even for lists and arrays: the order of a list is not acknowledged, and as long as every requested element is in the list, it will match even if there are additional elements. The format used for data tags is a [https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient%28boolean%29 lenient] form of [[wikipedia:JSON|JSON]]. === {{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