Utility

Functions

draw_text.clear()

Removes all elements.

draw_text.suppress_done_message()

Removes the Done message that appears after a script finishes.

draw_text.get_font_height() int

Returns the text font height.

Returns:

Font height.

draw_text.still_exists(_id: int) bool

Returns True if the element with the given id exists, False otherwise.

Parameters:

_id – ID of the element to check.

Returns:

True if the element exists, False otherwise.

draw_text.remove_element(_id: int)

Removes the element with the given id.

Parameters:

_id – ID of the element to remove.

draw_text.argb(a: int, r: int, g: int, b: int) int

Converts a, r, g, b values into a minecraft color. Values must be between 0 and 255 (inclusive).

Parameters:
  • a – Alpha value of the color.

  • r – Red value of the color.

  • g – Green value of the color.

  • b – Blue value of the color.

Returns:

Minecraft color with the a, r, g, b values.

draw_text.argb_to_int(color: int) tuple[int, int, int, int]

Converts an ARGB minecraft color into it’s a, r, g, b values.

Parameters:

color – Color to convert.

Returns:

A, r, g, b values of the color.

draw_text.alpha_from_int(alpha: int) float

Converts an alpha value ranging from 0 to 255 (inclusive) to an integer.

Parameters:

alpha – Alpha value to convert.

Returns:

Integer representing alpha.

draw_text.rainbow_animation(t: BaseObject, step: int = 1)

A simple rainbow animation. Animates the color property of an element. It is recommended to set the base color to Colors.RED.

draw_text.rainbow_animation_with_speed(step: int) Callable[[BaseObject, int], None]

This function returns a rainbow_animation() with the given speed.

Parameters:

step – Amount by which to change color every frame.

Returns:

rainbow_animation() with given speed.

Classes

class draw_text.Colors

Collection of built-in minecraft colors.

WHITE = -1

White color.

BLACK = -16777216

Black color.

GRAY = -8355712

Gray color.

DARK_GRAY = -12566464

Dark gray color.

LIGHT_GRAY = -6250336

Light gray color.

ALTERNATE_WHITE = -4539718

Alternate white color.

RED = -65536

Red color.

LIGHT_RED = -2142128

Light red color.

GREEN = -16711936

Green color.

BLUE = -16776961

Blue color.

YELLOW = -256

Yellow color.

LIGHT_YELLOW = -171

Light yellow color.

PURPLE = -11534256

Purple color.

CYAN = -11010079

Cyan color.

LIGHT_PINK = -13108

Light pink color.

LIGHTER_GRAY = -2039584

Lighter gray color.

class draw_text.Matrix

Represents a 2D matrix that supports scaling, rotation and translation operations.

scale(x, y=None)

Applies scaling to the matrix.

Parameters:
  • x – Scaling factor along x-axis.

  • y – Scaling factor along y-axis. If not provided, x is used.

Returns:

This matrix.

rotate(radians)

Applies rotation to the matrix.

Parameters:

radians – Angle to rotate in radians.

Returns:

This matrix.

translate(x, y)

Applies translation to the matrix.

Parameters:
  • x – Translation along x-axis.

  • y – Translation along y-axis.

Returns:

This matrix.

to_list() list

Converts this matrix into a list.

Returns:

List containing all elements of this matrix.

class draw_text.Identifier(path: str, vanilla: bool)

Represents a texture identifier.

Parameters:
  • path – Path to the texture starting from the textures/gui/sprites/ folder.

  • vanillaTrue if the texture is a vanilla texture, False otherwise.