public class TranslationComponent extends TextComponent
TextComponent.ComponentConsumer| Constructor and Description |
|---|
TranslationComponent(java.lang.String key,
java.util.List<?> args) |
TranslationComponent(java.lang.String key,
java.lang.Object... args) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
asLegacyFormatString() |
java.lang.String |
asSingleString() |
void |
asSingleString(com.viaversion.viaversion.libs.mcstructs.converter.ConsumerTracking converter,
TextComponent.ComponentConsumer consumer) |
java.lang.Object[] |
getArgs() |
java.lang.String |
getFallback() |
java.lang.String |
getKey() |
TextComponent |
resolveIntoComponents() |
TranslationComponent |
setArgs(java.lang.Object[] args)
Set the arguments of this component.
|
TranslationComponent |
setFallback(java.lang.String fallback)
Set the fallback of this component.
The fallback is used when the translation of the key was not found. |
TranslationComponent |
setKey(java.lang.String key)
Set the key of this component.
|
TranslationComponent |
setTranslator(Translator translator)
Set the translator function used to translate the key.
If a key is not found return null. |
TextComponent |
shallowCopy()
Create a shallow copy of this component.
This will only copy the component itself (including style) and not its siblings. |
java.lang.String |
toString() |
append, append, append, append, asUnformattedString, asUnformattedString, atlasSprite, atlasSprite, atlasSprite, atlasSprite, blockNbt, blockNbt, copy, copyMetaTo, empty, entityNbt, entityNbt, forEach, formatted, getSiblings, getStyle, keybind, mergeSiblingParentStyle, of, of, of, of, score, score, selector, selector, setParentStyle, setSiblingParentStyle, setStyle, storageNbt, storageNbt, styled, translation, translation, visitpublic TranslationComponent(java.lang.String key,
java.util.List<?> args)
public TranslationComponent(java.lang.String key,
java.lang.Object... args)
public java.lang.String getKey()
public TranslationComponent setKey(java.lang.String key)
key - The keypublic java.lang.Object[] getArgs()
public TranslationComponent setArgs(java.lang.Object[] args)
args - The arguments@Nullable public java.lang.String getFallback()
public TranslationComponent setFallback(@Nullable java.lang.String fallback)
fallback - The fallbackpublic TranslationComponent setTranslator(@Nullable Translator translator)
null. This is required for the fallback to work.translator - The translator functionpublic TextComponent resolveIntoComponents()
public java.lang.String asLegacyFormatString()
asLegacyFormatString in class TextComponentStringFormat.vanilla(char, boolean),
StringFormat.toString(TextComponent, ColorHandling, SerializerUnknownHandling)public java.lang.String asSingleString()
asSingleString in class TextComponentpublic void asSingleString(com.viaversion.viaversion.libs.mcstructs.converter.ConsumerTracking converter,
TextComponent.ComponentConsumer consumer)
asSingleString in class TextComponentpublic TextComponent shallowCopy()
TextComponentshallowCopy in class TextComponentpublic java.lang.String toString()
toString in class TextComponent