Home Migration Guide Getting Started With Scripts Commands Examples
BracketHandlers

MCStyle

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.

script.zs
import crafttweaker.api.util.text.MCStyle;

Constructors

No Description Provided

script.zs
new MCStyle() as MCStyle
new MCStyle();

Methods

Applies the formatting characteristics (Bold, Italic, Obfucated, etc) of the given MCTExtFormatting as well as the colour of the formatting.

Returns: A new MCStyle with the given Formatting.
Return Type: MCStyle

script.zs
MCStyle.applyFormatting(formatting as TextFormatting) as MCStyle
ParameterTypeDescription
Parameter
formatting
Type
TextFormatting
Description
The formatting to set.

Return Type: boolean

script.zs
MCStyle.equals(other as Object) as boolean
ParameterTypeDescription
Parameter
other
Type
Object
Description
No Description Provided

Return Type: boolean

script.zs
// MCStyle.getBold() as boolean
new MCStyle().getBold();

Return Type: int

script.zs
// MCStyle.getColor() as int
new MCStyle().getColor();

Return Type: MCResourceLocation

script.zs
// MCStyle.getFontId() as MCResourceLocation
new MCStyle().getFontId();

Return Type: string

script.zs
// MCStyle.getInsertion() as string
new MCStyle().getInsertion();

Return Type: boolean

script.zs
// MCStyle.getItalic() as boolean
new MCStyle().getItalic();

Return Type: boolean

script.zs
// MCStyle.getObfuscated() as boolean
new MCStyle().getObfuscated();

Return Type: boolean

script.zs
// MCStyle.getStrikethrough() as boolean
new MCStyle().getStrikethrough();

Return Type: boolean

script.zs
// MCStyle.getUnderlined() as boolean
new MCStyle().getUnderlined();

Return Type: int

script.zs
// MCStyle.hashCode() as int
new MCStyle().hashCode();

Whether or not this style is empty (inherits everything from the parent).

Return Type: boolean

script.zs
// MCStyle.isEmpty() as boolean
new MCStyle().isEmpty();

Return Type: MCStyle

script.zs
MCStyle.mergeStyle(style as MCStyle) as MCStyle
ParameterTypeDescription
Parameter
style
Type
MCStyle
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setBold(boldIn as bool?) as MCStyle
ParameterTypeDescription
Parameter
boldIn
Type
bool?
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setColor(colour as int) as MCStyle
ParameterTypeDescription
Parameter
colour
Type
int
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setColor(formatting as TextFormatting) as MCStyle
ParameterTypeDescription
Parameter
formatting
Type
TextFormatting
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setFontId(location as MCResourceLocation) as MCStyle
ParameterTypeDescription
Parameter
location
Type
MCResourceLocation
Description
No Description Provided

Sets the formatting of the style.

This will only take the colour of the text formatting, so using <formatting:obfuscated> would not do anything as it does not have a colour. If you want to take the actual characteristics of the MCTextFormatting, use MCStyle#applyFormatting(MCTextFormatting)

Returns: A new MCStyle with the given Formatting.
Return Type: MCStyle

script.zs
MCStyle.setFormatting(formatting as TextFormatting) as MCStyle
ParameterTypeDescription
Parameter
formatting
Type
TextFormatting
Description
The formatting to set.

Set a text to be inserted into Chat when the component is shift-clicked

Return Type: MCStyle

script.zs
MCStyle.setInsertion(insertion as string) as MCStyle
ParameterTypeDescription
Parameter
insertion
Type
string
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setItalic(italic as bool?) as MCStyle
ParameterTypeDescription
Parameter
italic
Type
bool?
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setObfuscated(obfuscated as bool?) as MCStyle
ParameterTypeDescription
Parameter
obfuscated
Type
bool?
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setStrikethrough(strikethrough as bool?) as MCStyle
ParameterTypeDescription
Parameter
strikethrough
Type
bool?
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setUnderlined(underlined as bool?) as MCStyle
ParameterTypeDescription
Parameter
underlined
Type
bool?
Description
No Description Provided

Return Type: MCStyle

script.zs
MCStyle.setUnderlined(underlined as boolean) as MCStyle
ParameterTypeDescription
Parameter
underlined
Type
boolean
Description
No Description Provided

Return Type: string

script.zs
// MCStyle.toString() as string
new MCStyle().toString();