MCTextComponent
Importing the class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
import crafttweaker.api.util.text.MCTextComponent;Static Methods
Return Type: MCTextComponent
MCTextComponent.createStringTextComponent(text as string) as MCTextComponent| Parameter | Type | Description | 
|---|---|---|
| Parametertext | Typestring | DescriptionNo Description Provided | 
Return Type: MCTextComponent
MCTextComponent.createTranslationTextComponent(translationKey as string) as MCTextComponent| Parameter | Type | Description | 
|---|---|---|
| ParametertranslationKey | Typestring | DescriptionNo Description Provided | 
Return Type: MCTextComponent
MCTextComponent.createTranslationTextComponent(translationKey as string, args as Object[]) as MCTextComponent| Parameter | Type | Description | 
|---|---|---|
| ParametertranslationKey | Typestring | DescriptionNo Description Provided | 
| Parameterargs | TypeObject[] | DescriptionNo Description Provided | 
Casters
| Result type | Is Implicit | 
|---|---|
| Result typestring | Is Implicitfalse | 
Methods
Return Type: MCTextComponent
MCTextComponent.appendSibling(component as MCTextComponent) as MCTextComponent| Parameter | Type | Description | 
|---|---|---|
| Parametercomponent | TypeMCTextComponent | DescriptionNo Description Provided | 
Return Type: MCTextComponent
MCTextComponent.appendText(text as string) as MCTextComponent| Parameter | Type | Description | 
|---|---|---|
| Parametertext | Typestring | DescriptionNo Description Provided | 
Return Type: MCTextComponent
// MCTextComponent.copyRaw() as MCTextComponent
MCTextComponent.createStringTextComponent("Hello World!").copyRaw();Return Type: MCTextComponent
// MCTextComponent.deepCopy() as MCTextComponent
MCTextComponent.createStringTextComponent("Hello World!").deepCopy();Return Type: string
// MCTextComponent.getString() as string
MCTextComponent.createStringTextComponent("Hello World!").getString();Return Type: string
MCTextComponent.getStringTruncated(maxLen as int) as string| Parameter | Type | Description | 
|---|---|---|
| ParametermaxLen | Typeint | DescriptionNo Description Provided | 
Return Type: MCStyle
// MCTextComponent.getStyle() as MCStyle
MCTextComponent.createStringTextComponent("Hello World!").getStyle();If this is a Translation Text Component, return the actual translation key used for localization. If this is not a Translation Text Component, returns an empty string.
Returns: the translation key or an empty string.
Return Type: string
// MCTextComponent.getTranslationKey() as string
MCTextComponent.createStringTextComponent("Hello World!").getTranslationKey();Return Type: string
// MCTextComponent.getUnformattedComponentText() as string
MCTextComponent.createStringTextComponent("Hello World!").getUnformattedComponentText();Return Type: MCTextComponent
MCTextComponent.setStyle(style as MCStyle) as MCTextComponent| Parameter | Type | Description | 
|---|---|---|
| Parameterstyle | TypeMCStyle | DescriptionNo Description Provided | 
Operators
myMCTextComponent + component as MCTextComponentmyMCTextComponent ~ component as MCTextComponentmyMCTextComponent << component as MCTextComponentProperties
| Name | Type | Has Getter | Has Setter | Description | 
|---|---|---|---|---|
| NameformattedText | Typestring | Has Gettertrue | Has Setterfalse | DescriptionNo Description Provided | 
| Namesiblings | Typestdlib.List<MCTextComponent> | Has Gettertrue | Has Setterfalse | DescriptionNo Description Provided | 
| Namestyle | TypeMCStyle | Has Gettertrue | Has Setterfalse | DescriptionNo Description Provided | 
| NametranslationKey | Typestring | Has Gettertrue | Has Setterfalse | DescriptionIf this is a Translation Text Component, return the actual translation key used for localization. If this is not a Translation Text Component, returns an empty string. | 
| NameunformattedComponentText | Typestring | Has Gettertrue | Has Setterfalse | DescriptionNo Description Provided |