draw

context(ctx: GuiGraphicsExtractor)
abstract fun draw(text: FormattedCharSequence, parameters: AbstractFontRenderer.DrawParameters): Float

Draws text with minecraft font markup on GUI with GuiGraphicsExtractor.

Return

The unscaled width of text


context(ctx: GuiGraphicsExtractor)
inline fun draw(text: FormattedCharSequence, parameters: AbstractFontRenderer.DrawParameters.() -> Unit = {}): Float
context(ctx: WorldRenderEnvironment)
inline fun draw(text: FormattedCharSequence, parameters: AbstractFontRenderer.DrawParameters.() -> Unit = {}): Float

Draws text as it is - unlike the Component overloads, it is not sanitized.


context(ctx: GuiGraphicsExtractor)
inline fun draw(text: Component, parameters: AbstractFontRenderer.DrawParameters.() -> Unit = {}): Float

Draws a Component, degenerating its legacy formatting and applying sanitizeForeignInput first. Pass a FormattedCharSequence when the text is already prepared.


context(ctx: WorldRenderEnvironment)
abstract fun draw(text: FormattedCharSequence, parameters: AbstractFontRenderer.DrawParameters): Float

Draws text with minecraft font markup on GUI with WorldRenderEnvironment.

Return

The unscaled width of text


context(ctx: WorldRenderEnvironment)
inline fun draw(text: Component, parameters: AbstractFontRenderer.DrawParameters.() -> Unit = {}): Float


fun draw(ctx: GuiGraphicsExtractor, text: Component, x: Float, y: Float, color: Color4b = Color4b.WHITE, shadow: Boolean = false, scale: Float = scaleToVanillaFont, horizontalAnchor: HorizontalAnchor? = null, verticalAnchor: VerticalAnchor? = null): Float

Draws text on the GUI at x/y in GUI pixels; scale 1 is this font's own size, the default matches vanilla's. For Kotlin the context overloads with DrawParameters do the same.

Return

the width drawn

Parameters

color

The color of the font when no minecraft-markup applies