Skip to content

UI Elements

GuiText

This element is used to display text on the screen.

Fields:

  • text - The text to display, a Component (can be a Literal or a Translatable like gui.my_mod.my_text)
  • HorizontalAlignment - The horizontal alignment of the text, can be LEFT, CENTER or RIGHT
  • VerticalAlignment - The vertical alignment of the text, can be TOP, CENTER or BOTTOM

GuiRichText

This element is used to display rich text on the screen.
Supports BBCode formatting, allowing for standard BBCode featurs such as colors, bold, italic.
LibLib provides custom BBCode tags for additional features, such as shake, wave, tornado, rainbow, gradient and pulse.

Same fields as GuiText, but also supports the following additional fields:

  • textWidth - The width of the text area, if the text exceeds this width it will wrap to the next line.

GuiImage

This element is used to display an image on the screen.

When constructing a GuiImage, you need to provied the image's dimensions.

Fields:

  • imagePath - The path to the image, a ResourceLocation
  • imageHorizontalAlignment - The horizontal alignment of the image, can be LEFT, CENTER or RIGHT
  • imageVerticalAlignment - The vertical alignment of the image, can be TOP, CENTER or BOTTOM

GuiButton

A button element that can be clicked by the user.

When constructing a GuiButton, you need to provide the button's content (a Component) and optionally the click calback.

GuiColorRect

This element is used to display a colored rectangle on the screen.

When constructing a GuiColorRect, you need to provide the color of the rectangle as well as its corners.