public class TranslatableText extends BaseText implements ParsableText
Text.Serializer
StringVisitable.StyledVisitor<T>, StringVisitable.Visitor<T>
Modifier and Type | Field and Description |
---|---|
private static Pattern |
ARG_FORMAT |
private Object[] |
args |
private static Object[] |
EMPTY_ARGUMENTS |
private String |
key |
private Language |
languageCache |
private static StringVisitable |
LITERAL_PERCENT_SIGN |
private static StringVisitable |
NULL_ARGUMENT |
private List<StringVisitable> |
translations |
EMPTY, TERMINATE_VISIT
Constructor and Description |
---|
TranslatableText(String key) |
TranslatableText(String key,
Object[] args) |
Modifier and Type | Method and Description |
---|---|
TranslatableText |
copy()
Copies the text itself, excluding the styles or siblings.
|
boolean |
equals(Object obj) |
private StringVisitable |
getArg(int index) |
Object[] |
getArgs() |
String |
getKey() |
int |
hashCode() |
MutableText |
parse(ServerCommandSource source,
Entity sender,
int depth) |
private void |
setTranslation(String translation) |
String |
toString() |
private void |
updateTranslations() |
<T> Optional<T> |
visitSelf(StringVisitable.StyledVisitor<T> visitor,
Style style)
Visits the text itself.
|
<T> Optional<T> |
visitSelf(StringVisitable.Visitor<T> visitor)
Visits the text itself.
|
append, asOrderedText, asString, getSiblings, getStyle, setStyle, shallowCopy
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
append, fillStyle, formatted, formatted, styled
asTruncatedString, getString, of, visit, visit
concat, concat, plain, styled
private static final Object[] EMPTY_ARGUMENTS
private static final StringVisitable LITERAL_PERCENT_SIGN
private static final StringVisitable NULL_ARGUMENT
private static final Pattern ARG_FORMAT
private final String key
private final Object[] args
private final List<StringVisitable> translations
public TranslatableText(String key)
private void updateTranslations()
private void setTranslation(String translation)
private StringVisitable getArg(int index)
public TranslatableText copy()
Text
@Environment(value=CLIENT) public <T> Optional<T> visitSelf(StringVisitable.StyledVisitor<T> visitor, Style style)
visitSelf
in interface Text
visitor
- the visitorstyle
- the current styleStringVisitable.visit(StyledVisitor, Style)
public <T> Optional<T> visitSelf(StringVisitable.Visitor<T> visitor)
visitSelf
in interface Text
visitor
- the visitorStringVisitable.visit(Visitor)
public MutableText parse(@Nullable ServerCommandSource source, @Nullable Entity sender, int depth) throws com.mojang.brigadier.exceptions.CommandSyntaxException
parse
in interface ParsableText
com.mojang.brigadier.exceptions.CommandSyntaxException
public String getKey()
public Object[] getArgs()