Skip to main content

Text Component (Data Type)

A String, Array or Object for showing text with formatting, translations, keybinds and the other features of Minecraft's JSON text. It accepts everything vanilla's text component format accepts.

Automatic translation keys

If a power leaves out its name or description field, Apoli falls back to a generated translation key:

FieldGenerated key
namepower.<namespace>.<path>.name
descriptionpower.<namespace>.<path>.description

For example, a power at data/mymod/powers/fly.json with no name field is shown as power.mymod.fly.name. Add that key to a language file in a resource pack to translate it.

Examples

"name": "This is an example text string!"

A plain string.

"name": {
    "text": "This is an example text string with a fancy color!",
    "color": "yellow"
}

A coloured component.

"name": [
    "Press ",
    { "keybind": "key.attack" },
    " to attack!"
]

A component built from a list, where formatting on the first element carries over to the rest.

"name": {
    "translate": "power.mymod.fly.name"
}

An explicit translation key. When the generated key matches the power's ID, this is the same as leaving the field out.