Class TextUtils
java.lang.Object
io.github.thecsdev.tcdcommons.api.util.TextUtils
Contains various
It is not recommended to call
Text
related utilities.It is not recommended to call
Text
related functions too
frequently. Instead, store Text
s in a field, and access them from there.-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.text.MutableText
Same asliteral(String)
, except it is also formatted usingformatted(String)
.static net.minecraft.text.MutableText
Formats (styles) a given text and returns the formattedMutableText
.static net.minecraft.text.MutableText
formatted
(net.minecraft.text.Text text) Formats (styles) a givenMutableText
and returns the formattedMutableText
.
Please seeformatted(String)
.static net.minecraft.text.MutableText
fTranslatable
(String translationKey, Object... params) Same astranslatable(String, Object...)
, except it is also formatted usingformatted(Text)
.static net.minecraft.text.MutableText
Returns a literalMutableText
using the givenString
argument.static net.minecraft.text.MutableText
translatable
(String translationKey, Object... params) Returns a translatableMutableText
using the given translation key.
-
Method Details
-
literal
Returns a literalMutableText
using the givenString
argument.- Parameters:
text
- The literal text.
-
translatable
Returns a translatableMutableText
using the given translation key. The returned text will depend on the user's language settings.- Parameters:
translationKey
- The translation key.params
- The translatableText
formatting parameters.
-
fLiteral
Same asliteral(String)
, except it is also formatted usingformatted(String)
.- Parameters:
text
- The literal text.
-
fTranslatable
Same astranslatable(String, Object...)
, except it is also formatted usingformatted(Text)
.- Parameters:
translationKey
- The translation key.params
- The translatable text formatting parameters.
-
formatted
public static net.minecraft.text.MutableText formatted(net.minecraft.text.Text text) Formats (styles) a givenMutableText
and returns the formattedMutableText
.
Please seeformatted(String)
.- Parameters:
text
- TheText
to style/format.
-
formatted
Formats (styles) a given text and returns the formattedMutableText
. TheFormatting.FORMATTING_CODE_PREFIX
is used to format the given text.- Parameters:
text
- The text to format.
-