Skip to content

Button

Extends TextElement.

The button can be pressed to run a function.

Builders:

  • builder: The default builder.

Builder methods:

  • onPress: The function to run when this button is pressed.
    • setter

Class methods:

  • press: Presses this button.

Example:

Button.builder()
.text(Text.literal("Press me!"))
.onPress(self -> Main.LOGGER.info("Hello world!"));
.build();