LiteralTextBuilder

class LiteralTextBuilder(baseText: Component?, inheritStyle: Boolean)(source)

Constructors

Link copied to clipboard
constructor(text: String?, inheritStyle: Boolean)
constructor(baseText: Component?, inheritStyle: Boolean)

Properties

Link copied to clipboard
Link copied to clipboard
var clickEvent: ClickEvent?
Link copied to clipboard
var color: Int?

The text color. As this is an Int representing an RGB color, this can be set in the following way:

Link copied to clipboard
val currentStyle: Style
Link copied to clipboard
var font: ResourceLocation?

The resource location of the font for this component in the resource pack or mod resources within assets/<namespace>/font. Defaults to "minecraft:default".

Link copied to clipboard
var hoverEvent: HoverEvent?
Link copied to clipboard

When the text is shift-clicked by a player, this string is inserted in their chat input. It does not overwrite any existing text the player was writing. This only works in chat messages.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun build(): MutableComponent
Link copied to clipboard
fun emptyLine()

Adds an empty line.

Link copied to clipboard
fun newLine()

Adds a line break.

Link copied to clipboard
inline fun text(text: String = "", inheritStyle: Boolean = true, crossinline builder: LiteralTextBuilder.() -> Unit = { })

Append text to the parent.

inline fun text(text: Component, inheritStyle: Boolean = true, crossinline builder: LiteralTextBuilder.() -> Unit = { })

Appends a MutableComponent to the parent.