Package net.minecraft.text
Class TranslatableText
java.lang.Object
net.minecraft.text.BaseText
net.minecraft.text.TranslatableText
- All Implemented Interfaces:
com.mojang.brigadier.Message
,MutableText
,ParsableText
,StringVisitable
,Text
public class TranslatableText extends BaseText implements ParsableText
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.text.StringVisitable
StringVisitable.StyledVisitor<T>, StringVisitable.Visitor<T>
Nested classes/interfaces inherited from interface net.minecraft.text.Text
Text.Serializer
-
Field Summary
Fields Modifier and Type Field 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
Fields inherited from interface net.minecraft.text.StringVisitable
EMPTY, TERMINATE_VISIT
-
Constructor Summary
Constructors Constructor Description TranslatableText(String key)
TranslatableText(String key, Object[] args)
-
Method Summary
Modifier and Type Method 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.Methods inherited from class net.minecraft.text.BaseText
append, asOrderedText, asString, getSiblings, getStyle, setStyle, shallowCopy
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.text.MutableText
append, fillStyle, formatted, formatted, styled
Methods inherited from interface net.minecraft.text.Text
asTruncatedString, getString, visit, visit
-
Field Details
-
EMPTY_ARGUMENTS
-
LITERAL_PERCENT_SIGN
-
NULL_ARGUMENT
-
ARG_FORMAT
-
key
-
args
-
languageCache
-
translations
-
-
Constructor Details
-
TranslatableText
-
TranslatableText
-
-
Method Details
-
updateTranslations
private void updateTranslations() -
setTranslation
-
getArg
-
copy
Description copied from interface:Text
Copies the text itself, excluding the styles or siblings. -
visitSelf
@Environment(CLIENT) public <T> Optional<T> visitSelf(StringVisitable.StyledVisitor<T> visitor, Style style)Visits the text itself.- Specified by:
visitSelf
in interfaceText
- Parameters:
visitor
- the visitorstyle
- the current style- Returns:
- the visitor's return value
- See Also:
Text.visit(StyledVisitor, Style)
-
visitSelf
Visits the text itself.- Specified by:
visitSelf
in interfaceText
- Parameters:
visitor
- the visitor- Returns:
- the visitor's return value
- See Also:
Text.visit(Visitor)
-
parse
public MutableText parse(@Nullable ServerCommandSource source, @Nullable Entity sender, int depth) throws com.mojang.brigadier.exceptions.CommandSyntaxException- Specified by:
parse
in interfaceParsableText
- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
equals
-
hashCode
public int hashCode() -
toString
-
getKey
-
getArgs
-