
RichLocalTextLib
RichLocalText library provides mod developers and resource pack creators with the ability to use formatted text in localizations. Now you can easily add various font styles and colors to text elements without the need to write additional code.
Installation
Simply place the .jar file in your game's /mods folder. The library works autonomously and does not require installation of additional dependencies.
Note: resource packs utilizing formatted text capabilities are not included with the library.
Usage
To work with the library, use a format similar to the /tellraw command in language files. If you're overriding a string containing format placeholders, use the {"index":n} construct.
Example of changing the default chat text format:
//en_us.json
{
"chat.type.text": [
"",
{"text":"A mysterious stranger known only as <", "color": "gray"},
{"index":0, "obfuscated": true},
{"text":"> uttered: \"", "color": "gray"},
{"index":1},
{"text":"\"", "color": "gray"}
]
}
Important: If the first text component has a style, all subsequent components will inherit its formatting. This is a Minecraft quirk that we don't plan to fix.
The result of applying such formatting: