Package org.moddingx.libx.util.game
Class TextProcessor
java.lang.Object
org.moddingx.libx.util.game.TextProcessor
Allows text in the lang file to define style information. This is done by dollar commands.
A dollar command looks like this:
$(...)
where the parts in the parens are multiple
commands separated by ;
. Using $()
resets to the default style.
A command can be one of these:
n
ornewline
: A newline. When this is used, no other commands can be used in the same pair of parens.#RRGGBB
: A color in hex
b
orbold
: Bold text.i
oritalic
: Italic text.u
orunderline
: Underlined text.s
orstrikethrough
: Strikethrough text.
customCommand(Style, String)
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final TextProcessor
A text processor without any custom command. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.chat.Style
customCommand
(net.minecraft.network.chat.Style style, String command) Handles a custom command.List<net.minecraft.network.chat.Component>
Processes a string.List<net.minecraft.network.chat.Component>
process
(net.minecraft.network.chat.Component text) Processes a text component.net.minecraft.network.chat.Component
processLine
(String line) Processes a single-line string.net.minecraft.network.chat.Component
processLine
(net.minecraft.network.chat.Component line) Processes a single-line text component.
-
Field Details
-
INSTANCE
A text processor without any custom command.
-
-
Constructor Details
-
TextProcessor
public TextProcessor()
-
-
Method Details
-
process
public List<net.minecraft.network.chat.Component> process(net.minecraft.network.chat.Component text) Processes a text component.- Returns:
- A list of components. Each entry represents one line in the text.
-
process
Processes a string.- Returns:
- A list of components. Each entry represents one line in the text.
-
processLine
public net.minecraft.network.chat.Component processLine(net.minecraft.network.chat.Component line) Processes a single-line text component. -
processLine
Processes a single-line string. -
customCommand
public net.minecraft.network.chat.Style customCommand(net.minecraft.network.chat.Style style, String command) Handles a custom command. The given style can be modified, or a completely new style can be created The default implementation does nothing.
-