Mastering Minecraft’s Tellraw Command: A Comprehensive Guide
The /tellraw
command in Minecraft is a powerful tool that allows you to display formatted text to players, going far beyond the simple messages offered by the standard chat. If you’ve ever seen vibrant, multi-colored messages, clickable links, or hover text in a Minecraft server, chances are they were created using the /tellraw
command. This comprehensive guide will walk you through everything you need to know to master this command, from basic usage to advanced techniques.
What is the /tellraw
Command?
At its core, the /tellraw
command takes a JSON-formatted text input and displays it to specified players. Unlike the regular /say
command, /tellraw
lets you control almost every aspect of the text’s appearance, making it incredibly versatile for creating custom messages, interactive tutorials, adventure maps, and much more. It allows you to:
- Display text in different colors.
- Format text with bold, italics, underline, strikethrough, and obfuscation.
- Insert clickable links that players can use.
- Add hover text that appears when a player hovers their mouse over the text.
- Translate text into the player’s chosen language.
- Insert items and their metadata directly into the chat.
- Insert player names and scores dynamically.
The possibilities with /tellraw
are vast, and it’s often considered an essential command for anyone looking to create immersive and engaging Minecraft experiences.
Basic Syntax of the /tellraw
Command
The basic syntax of the /tellraw
command is as follows:
/tellraw <targets> <raw json text>
Let’s break down each part:
<targets>
: This is a selector that specifies which players will receive the message. Common selectors include:@p
: The nearest player to the command’s execution point.@a
: All players currently online.@r
: A random player online.@s
: The entity executing the command.@e
: All entities in the world, often used with specific tags to target specific entities.- You can also target specific player names directly like:
PlayerName
Additionally, selectors can be further modified with parameters:
@a[distance=..10]
: All players within 10 blocks@a[level=20..]
: All players level 20 or higher@a[team=red]
: All players on the team red@a[tag=special]
: All players with the tag special
<raw json text>
: This is where the magic happens. This part contains the JSON formatted text that determines the message’s appearance and behavior. This is complex and requires careful structure.
Understanding JSON Structure for /tellraw
The JSON format used in /tellraw
can appear daunting at first, but it’s based on a relatively simple structure of objects and arrays. The basic JSON structure for text is an array of JSON objects, where each object represents a separate part of the text.
Basic JSON Object Structure
Each JSON object can contain multiple attributes that control its behavior. Here’s the most basic object that represents a text component:
{
"text": "Your text here"
}
text
: Specifies the actual text to be displayed.
Let’s see an example in the command:
/tellraw @a {"text":"Hello World"}
This command will display a simple “Hello World” message in the default color to all players.
Adding Color to Your Text
To add color, you use the color
attribute:
{
"text": "This text is red",
"color": "red"
}
Here are the possible colors in Minecraft:
black
dark_blue
dark_green
dark_aqua
dark_red
dark_purple
gold
gray
dark_gray
blue
green
aqua
red
light_purple
yellow
white
Example command:
/tellraw @a {"text":"This text is green","color":"green"}
Adding Formatting Styles
You can further modify the text with these formatting attributes:
bold
:true
orfalse
italic
:true
orfalse
underlined
:true
orfalse
strikethrough
:true
orfalse
obfuscated
:true
orfalse
(scrambled text)
Example:
{
"text": "This text is bold and italic",
"bold": true,
"italic": true,
"color": "blue"
}
And the corresponding command:
/tellraw @a {"text":"This text is bold and italic","bold":true,"italic":true, "color":"blue"}
Combining Multiple Text Components
The power of /tellraw
lies in its ability to combine multiple text components into a single message. To do this, you provide an array of JSON objects. Each object is treated as a separate component and combined to form a single line. Example:
[
{
"text": "First part, ",
"color": "red"
},
{
"text": "second part, ",
"color": "blue",
"bold":true
},
{
"text": "third part",
"color":"yellow",
"italic":true
}
]
The command will be:
/tellraw @a [{"text":"First part, ","color":"red"},{"text":"second part, ","color":"blue","bold":true},{"text":"third part","color":"yellow","italic":true}]
This example demonstrates a message with three distinct text components.
Advanced Features of /tellraw
Now, let’s dive into some of the advanced features that make /tellraw
truly powerful.
Click Events
You can make text clickable with the clickEvent
attribute. There are several types of click events:
open_url
: Opens a URL in the player’s web browser.open_file
: Opens a file on the player’s computer (not commonly used).run_command
: Executes a command when the player clicks.suggest_command
: Suggests a command in the player’s chat input box.change_page
: Changes the page of a book.
Click Event – open_url
{
"text": "Click here to visit Google",
"clickEvent": {
"action": "open_url",
"value": "https://www.google.com"
},
"color":"aqua"
}
Command:
/tellraw @a {"text":"Click here to visit Google","clickEvent":{"action":"open_url","value":"https://www.google.com"}, "color":"aqua"}
Click Event – run_command
{
"text": "Click here to say hello",
"clickEvent": {
"action": "run_command",
"value": "/say Hello!"
},
"color": "green"
}
Command:
/tellraw @a {"text":"Click here to say hello","clickEvent":{"action":"run_command","value":"/say Hello!"}, "color": "green"}
Click Event – suggest_command
{
"text": "Click to use a command",
"clickEvent": {
"action": "suggest_command",
"value": "/give @p diamond 64"
},
"color": "yellow"
}
Command:
/tellraw @a {"text":"Click to use a command","clickEvent":{"action":"suggest_command","value":"/give @p diamond 64"}, "color": "yellow"}
Hover Events
You can add text that appears when a player hovers over text with the hoverEvent
attribute. Hover events can display:
- Simple text.
- An item and its NBT data (useful to show details about the item).
- An entity and its NBT data (useful to show details about mobs or players)
Hover Event – Show Text
{
"text": "Hover over this",
"hoverEvent": {
"action": "show_text",
"value": "This is the hover text!"
},
"color":"light_purple"
}
Command:
/tellraw @a {"text":"Hover over this","hoverEvent":{"action":"show_text","value":"This is the hover text!"}, "color":"light_purple"}
Hover Event – Show Item
{
"text": "Hover to see a Diamond",
"hoverEvent": {
"action": "show_item",
"value": "{id:\"minecraft:diamond\",Count:1}"
}
}
Command:
/tellraw @a {"text":"Hover to see a Diamond","hoverEvent":{"action":"show_item","value":"{id:\"minecraft:diamond\",Count:1}"}}
Hover Event – Show Entity
{
"text": "Hover to see a Creeper",
"hoverEvent": {
"action": "show_entity",
"value": "{type:\"minecraft:creeper\",id:[I;1089169776,2004063118,-1853108750,725328080],name:\"Steve\"}"
}
}
Command:
/tellraw @a {"text":"Hover to see a Creeper","hoverEvent":{"action":"show_entity","value":"{type:\"minecraft:creeper\",id:[I;1089169776,2004063118,-1853108750,725328080],name:\"Steve\"}"}}
Translation Keys
You can use translate
key to translate text into the user’s chosen language. This is extremely useful for creating multi-lingual content. The with
key is used to insert variables into the translated text.
{
"translate": "chat.type.text",
"with": [
"PlayerName",
"Hello"
]
}
Command:
/tellraw @a {"translate":"chat.type.text","with":["PlayerName","Hello"]}
This will translate to “<PlayerName> Hello” based on the language settings in minecraft.
Inserting Scores and Player Names
You can dynamically insert player scores and player names into the chat using score and selector attributes. This allows you to create interactive messages that are specific to each player.
Inserting Scores
{
"text":"Your score is:",
"color":"yellow"
},{
"score":{
"name":"@p",
"objective":"example_score"
},
"color":"white"
}
Command:
/tellraw @a [{"text":"Your score is:","color":"yellow"},{"score":{"name":"@p","objective":"example_score"},"color":"white"}]
Where “example_score” is the name of a scoreboard objective created via the /scoreboard command.
Inserting Player Names
{
"text": "Hello, ",
"color": "green"
},
{
"selector": "@p",
"color":"white"
}
Command:
/tellraw @a [{"text":"Hello, ","color":"green"},{"selector":"@p", "color":"white"}]
This will display “Hello, PlayerName” where PlayerName is the player who receives the message.
Practical Examples
Now that we have covered the theory, let’s look at some practical examples.
Example 1: Welcome Message with Color and Formatting
This example will display a welcome message with different colored and formatted text.
/tellraw @a [
{
"text": "Welcome ",
"color": "green"
},
{
"selector": "@p",
"color": "aqua",
"bold": true
},
{
"text": " to the server!",
"color": "green"
}
]
This command will output something like “Welcome <PlayerName> to the server!” where <PlayerName> is bold and aqua color.
Example 2: Interactive Tutorial with Clickable Links
This example creates an interactive tutorial that guides players on how to play:
/tellraw @a [
{
"text": "Click here to view the rules:",
"color": "yellow"
},
{
"text": " Rules",
"color": "blue",
"clickEvent": {
"action": "open_url",
"value": "https://example.com/rules"
}
},
{
"text": "\nClick here to join our Discord:",
"color": "yellow"
},
{
"text": " Discord",
"color":"light_purple",
"clickEvent": {
"action": "open_url",
"value": "https://discord.gg/example"
}
}
]
This command outputs clickable links to an external webpage with the rules and a discord server link.
Example 3: Shop Menu with Hoverable Items
This example creates a shop menu where players can hover over text to see item information:
/tellraw @a [
{
"text": "Welcome to the Shop!\n",
"color": "gold",
"bold": true
},
{
"text": "Diamond",
"color":"aqua",
"hoverEvent": {
"action": "show_item",
"value": "{id:\"minecraft:diamond\",Count:1,tag:{display:{Name:'{\"text\":\"Shiny Diamond\"}'}}}"
}
},
{
"text": " : 10 Coins\n",
"color":"white"
},
{
"text": "Iron Ingot",
"color":"gray",
"hoverEvent": {
"action": "show_item",
"value": "{id:\"minecraft:iron_ingot\",Count:1,tag:{display:{Name:'{\"text\":\"Standard Iron Ingot\"}'}}}"
}
},
{
"text": " : 5 Coins",
"color":"white"
}
]
Players will see the items in chat with hoverable text and the proper names, including the cost.
Tips for Using /tellraw
Effectively
- Use an online JSON generator or editor: Writing raw JSON can be tedious and error-prone. Use online tools to generate JSON structures and validate the code before using them in Minecraft. Some popular online tools include: Minecraft JSON Generator
- Test your commands: It’s crucial to test your
/tellraw
commands, especially the more complex ones, to catch errors and bugs before using them. - Start simple: Begin with simple text and gradually introduce new features as you gain confidence with the command.
- Use comments: While JSON does not support comments, you can add comments outside of the JSON part of the command to keep track of what parts of the message do.
- Be mindful of length: Long
/tellraw
commands can be difficult to read and manage. Break down complex messages into multiple commands if needed. - Keep it organized: Make sure to always organize your code, by using proper indentation.
Conclusion
The /tellraw
command is a very powerful feature in Minecraft that, once mastered, can enhance any Minecraft experience. From basic color messages to complex interactive text, the possibilities are endless. By practicing and testing these techniques, you’ll be able to add a new level of detail and interactivity to your Minecraft builds and adventures. This guide provides a solid foundation for exploring more advanced uses of the command. Happy crafting!