Class Checkbox.Builder

Enclosing class:
Checkbox

public static final class Checkbox.Builder extends Entry.Builder<Checkbox.Builder>
Builds a Checkbox; from Checkbox.builder(String). Also has the options every entry has (Entry.Builder).
  • Method Details

    • label

      public Checkbox.Builder label(Supplier<Text> label)
      The text to the right of the box, re-read on every refresh. Required.
      Parameters:
      label - read on refresh
      Returns:
      this builder
    • label

      public Checkbox.Builder label(Text label)
      A fixed label; see label(Supplier).
      Parameters:
      label - the label
      Returns:
      this builder
    • value

      public Checkbox.Builder value(BooleanSupplier value)
      Reads whether the box is checked; re-read on every refresh. Required.
      Parameters:
      value - reads the mod's value
      Returns:
      this builder
    • onChange

      public Checkbox.Builder onChange(Consumer<Boolean> onChange)
      Stores a new value when the player clicks; runs on the main thread. Required. The box shows the new state only if value returns it afterwards.
      Parameters:
      onChange - receives the new value
      Returns:
      this builder
    • build

      public Checkbox build()
      Builds the check box.
      Returns:
      the check box
      Throws:
      IllegalStateException - if label, value or onChange is missing