Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

Component

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.text.Component;

Implements

Component implements the following interfaces:

Message,FormattedText

Members

Getter
script.zs
// Component.contents as ComponentContents
myComponent.contents

Return Type: ComponentContents

contents() as ComponentContents
script.zs
// Component.contents() as ComponentContents;
myComponent.contents();

Return Type: ComponentContents

copy() as MutableComponent
script.zs
// Component.copy() as MutableComponent;
myComponent.copy();

Return Type: MutableComponent

static empty() as MutableComponent
script.zs
// Component.empty() as MutableComponent;
Component.empty();

Return Type: MutableComponent

getString(maxLength as int) as string
script.zs
// Component.getString(maxLength as int) as string;
myComponent.getString(myInt);

Parameters:

maxLength Type: int

Return Type: string

getString() as string
script.zs
// Component.getString() as string;
myComponent.getString();

Return Type: string

implicit as string
script.zs
// Component as string
myComponent as string

Return Type: string

static keybind(name as string) as MutableComponent
script.zs
// Component.keybind(name as string) as MutableComponent;
Component.keybind(myString);

Parameters:

name Type: string

Return Type: MutableComponent

static literal(content as string) as MutableComponent
script.zs
// Component.literal(content as string) as MutableComponent;
Component.literal(myString);

Parameters:

content Type: string

Return Type: MutableComponent

static nullToEmpty(content as string) as Component
script.zs
// Component.nullToEmpty(content as string) as Component;
Component.nullToEmpty(myString);

Parameters:

content Type: string

Return Type: Component

plainCopy() as MutableComponent
script.zs
// Component.plainCopy() as MutableComponent;
myComponent.plainCopy();

Return Type: MutableComponent

static score(name as string, objective as string) as MutableComponent
script.zs
// Component.score(name as string, objective as string) as MutableComponent;
Component.score(myString, myString);

Parameters:

name Type: string
objective Type: string

Return Type: MutableComponent

static selector(pattern as string, separator as Component = null) as MutableComponent
script.zs
// Component.selector(pattern as string, separator as Component = null) as MutableComponent;
Component.selector(myString, myComponent);

Parameters:

pattern Type: string
separator (optional) Type: Component

Default Value: null

Return Type: MutableComponent

Getter
script.zs
// Component.siblings as List<Component>
myComponent.siblings

Return Type: List<Component>

siblings() as List<Component>
script.zs
// Component.siblings() as List<Component>;
myComponent.siblings();

Return Type: List<Component>

Getter
script.zs
// Component.style as Style
myComponent.style

Return Type: Style

style() as Style
script.zs
// Component.style() as Style;
myComponent.style();

Return Type: Style

static translatable(content as string, args as string[]) as MutableComponent
script.zs
// Component.translatable(content as string, args as string[]) as MutableComponent;
Component.translatable(myString, myString[]);

Parameters:

content Type: string
args Type: string[]

Return Type: MutableComponent

static translatable(content as string, args as Component[]) as MutableComponent
script.zs
// Component.translatable(content as string, args as Component[]) as MutableComponent;
Component.translatable(myString, myComponent[]);

Parameters:

content Type: string
args Type: Component[]

Return Type: MutableComponent