Skip to content

Cycle Button

Extends Button and implements ValueElement<T>.

The cycle button can be pressed to cycle through options.

Builders:

  • <T>builder: The default builder.

Builder methods:

  • index: The index of the option to select
    • getter / setter
  • addOption: Adds an option.

Class methods:

  • addOption: Adds an option.

Example:

CycleButton.<String>builder()
.addOption(Text.literal("Strawberry"), "strawberry")
.addOption(Text.literal("Blueberry"), "blueberry")
.onPress(self -> {
var value = ((CycleButton<?>) self).getValue();
Main.LOGGER.info("You selected {}", value)
})
.build();