Class CyclingButtonWidget.Builder<T>

java.lang.Object
net.minecraft.client.gui.widget.CyclingButtonWidget.Builder<T>
Enclosing class:
CyclingButtonWidget<T>

@Environment(CLIENT) public static class CyclingButtonWidget.Builder<T> extends Object
A builder to easily create cycling button widgets. Each builder must have at least one of its values methods called with at least one default (non-alternative) value in the list before building.
See Also:
Mappings:
Namespace Name
named net/minecraft/client/gui/widget/CyclingButtonWidget$Builder
intermediary net/minecraft/class_5676$class_5677
official fol$a
  • Field Details

    • initialIndex

      private int initialIndex
      Mappings:
      Namespace Name Mixin selector
      named initialIndex Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;initialIndex:I
      intermediary field_27972 Lnet/minecraft/class_5676$class_5677;field_27972:I
      official a Lfol$a;a:I
    • value

      @Nullable private T value
      Mappings:
      Namespace Name Mixin selector
      named value Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;value:Ljava/lang/Object;
      intermediary field_27973 Lnet/minecraft/class_5676$class_5677;field_27973:Ljava/lang/Object;
      official b Lfol$a;b:Ljava/lang/Object;
    • valueToText

      private final Function<T,Text> valueToText
      Mappings:
      Namespace Name Mixin selector
      named valueToText Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;valueToText:Ljava/util/function/Function;
      intermediary field_27974 Lnet/minecraft/class_5676$class_5677;field_27974:Ljava/util/function/Function;
      official c Lfol$a;c:Ljava/util/function/Function;
    • tooltipFactory

      private SimpleOption.TooltipFactory<T> tooltipFactory
      Mappings:
      Namespace Name Mixin selector
      named tooltipFactory Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;tooltipFactory:Lnet/minecraft/client/option/SimpleOption$TooltipFactory;
      intermediary field_27975 Lnet/minecraft/class_5676$class_5677;field_27975:Lnet/minecraft/class_7172$class_7277;
      official d Lfol$a;d:Lfmi$l;
    • narrationMessageFactory

      private Function<CyclingButtonWidget<T>,MutableText> narrationMessageFactory
      Mappings:
      Namespace Name Mixin selector
      named narrationMessageFactory Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;narrationMessageFactory:Ljava/util/function/Function;
      intermediary field_27976 Lnet/minecraft/class_5676$class_5677;field_27976:Ljava/util/function/Function;
      official e Lfol$a;e:Ljava/util/function/Function;
    • values

      private CyclingButtonWidget.Values<T> values
      Mappings:
      Namespace Name Mixin selector
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values:Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;
      intermediary field_27977 Lnet/minecraft/class_5676$class_5677;field_27977:Lnet/minecraft/class_5676$class_5680;
      official f Lfol$a;f:Lfol$c;
    • optionTextOmitted

      private boolean optionTextOmitted
      Mappings:
      Namespace Name Mixin selector
      named optionTextOmitted Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;optionTextOmitted:Z
      intermediary field_27978 Lnet/minecraft/class_5676$class_5677;field_27978:Z
      official g Lfol$a;g:Z
  • Constructor Details

    • Builder

      public Builder(Function<T,Text> valueToText)
      Creates a builder.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;<init>(Ljava/util/function/Function;)V
      intermediary <init> Lnet/minecraft/class_5676$class_5677;<init>(Ljava/util/function/Function;)V
      official <init> Lfol$a;<init>(Ljava/util/function/Function;)V
  • Method Details

    • values

      public CyclingButtonWidget.Builder<T> values(Collection<T> values)
      Sets the option values for this button.
      Mappings:
      Namespace Name Mixin selector
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values(Ljava/util/Collection;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_32620 Lnet/minecraft/class_5676$class_5677;method_32620(Ljava/util/Collection;)Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a(Ljava/util/Collection;)Lfol$a;
    • values

      @SafeVarargs public final CyclingButtonWidget.Builder<T> values(T[] values)
      Sets the option values for this button.
      Mappings:
      Namespace Name Mixin selector
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values([Ljava/lang/Object;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_32624 Lnet/minecraft/class_5676$class_5677;method_32624([Ljava/lang/Object;)Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a([Ljava/lang/Object;)Lfol$a;
    • values

      public CyclingButtonWidget.Builder<T> values(List<T> defaults, List<T> alternatives)
      Sets the option values for this button.

      When the user presses the ALT key, the alternatives values will be iterated; otherwise the defaults values will be iterated when clicking the built button.

      Mappings:
      Namespace Name Mixin selector
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values(Ljava/util/List;Ljava/util/List;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_32621 Lnet/minecraft/class_5676$class_5677;method_32621(Ljava/util/List;Ljava/util/List;)Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a(Ljava/util/List;Ljava/util/List;)Lfol$a;
    • values

      public CyclingButtonWidget.Builder<T> values(BooleanSupplier alternativeToggle, List<T> defaults, List<T> alternatives)
      Sets the option values for this button.

      When alternativeToggle getAsBoolean returns true, the alternatives values will be iterated; otherwise the defaults values will be iterated when clicking the built button.

      Mappings:
      Namespace Name Mixin selector
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values(Ljava/util/function/BooleanSupplier;Ljava/util/List;Ljava/util/List;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_32622 Lnet/minecraft/class_5676$class_5677;method_32622(Ljava/util/function/BooleanSupplier;Ljava/util/List;Ljava/util/List;)Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a(Ljava/util/function/BooleanSupplier;Ljava/util/List;Ljava/util/List;)Lfol$a;
    • values

      Mappings:
      Namespace Name Mixin selector
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values(Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_42729 Lnet/minecraft/class_5676$class_5677;method_42729(Lnet/minecraft/class_5676$class_5680;)Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a(Lfol$c;)Lfol$a;
    • tooltip

      public CyclingButtonWidget.Builder<T> tooltip(SimpleOption.TooltipFactory<T> tooltipFactory)
      Sets the tooltip factory that provides tooltips for any of the values.

      If this is not called, the values simply won't have tooltips.

      Mappings:
      Namespace Name Mixin selector
      named tooltip Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;tooltip(Lnet/minecraft/client/option/SimpleOption$TooltipFactory;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_32618 Lnet/minecraft/class_5676$class_5677;method_32618(Lnet/minecraft/class_7172$class_7277;)Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a(Lfmi$l;)Lfol$a;
    • initially

      public CyclingButtonWidget.Builder<T> initially(T value)
      Sets the initial value of this button widget.

      This is not effective if value is not in the default values (i.e. excluding alternative values).

      If this is not called, the initial value defaults to the first value in the values list supplied.

      Mappings:
      Namespace Name Mixin selector
      named initially Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;initially(Ljava/lang/Object;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_32619 Lnet/minecraft/class_5676$class_5677;method_32619(Ljava/lang/Object;)Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a(Ljava/lang/Object;)Lfol$a;
    • narration

      public CyclingButtonWidget.Builder<T> narration(Function<CyclingButtonWidget<T>,MutableText> narrationMessageFactory)
      Overrides the narration message of the button to build.

      If this is not called, the button will use CyclingButtonWidget.getGenericNarrationMessage() for narration messages.

      Mappings:
      Namespace Name Mixin selector
      named narration Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;narration(Ljava/util/function/Function;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_32623 Lnet/minecraft/class_5676$class_5677;method_32623(Ljava/util/function/Function;)Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a(Ljava/util/function/Function;)Lfol$a;
    • omitKeyText

      public CyclingButtonWidget.Builder<T> omitKeyText()
      Makes the built button omit the option and only display the current value for its text, such as showing "Jump Mode" than "Mode: Jump Mode".
      Mappings:
      Namespace Name Mixin selector
      named omitKeyText Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;omitKeyText()Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
      intermediary method_32616 Lnet/minecraft/class_5676$class_5677;method_32616()Lnet/minecraft/class_5676$class_5677;
      official a Lfol$a;a()Lfol$a;
    • build

      public CyclingButtonWidget<T> build(Text optionText, CyclingButtonWidget.UpdateCallback<T> callback)
      Mappings:
      Namespace Name Mixin selector
      named build Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;build(Lnet/minecraft/text/Text;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget;
      intermediary method_57720 Lnet/minecraft/class_5676$class_5677;method_57720(Lnet/minecraft/class_2561;Lnet/minecraft/class_5676$class_5678;)Lnet/minecraft/class_5676;
      official a Lfol$a;a(Lxv;Lfol$b;)Lfol;
    • build

      public CyclingButtonWidget<T> build(int x, int y, int width, int height, Text optionText)
      Mappings:
      Namespace Name Mixin selector
      named build Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;build(IIIILnet/minecraft/text/Text;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget;
      intermediary method_35723 Lnet/minecraft/class_5676$class_5677;method_35723(IIIILnet/minecraft/class_2561;)Lnet/minecraft/class_5676;
      official a Lfol$a;a(IIIILxv;)Lfol;
    • build

      public CyclingButtonWidget<T> build(int x, int y, int width, int height, Text optionText, CyclingButtonWidget.UpdateCallback<T> callback)
      Builds a cycling button widget.
      Throws:
      IllegalStateException - if no values call is made, or the values has no default values available
      Mappings:
      Namespace Name Mixin selector
      named build Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;build(IIIILnet/minecraft/text/Text;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget;
      intermediary method_32617 Lnet/minecraft/class_5676$class_5677;method_32617(IIIILnet/minecraft/class_2561;Lnet/minecraft/class_5676$class_5678;)Lnet/minecraft/class_5676;
      official a Lfol$a;a(IIIILxv;Lfol$b;)Lfol;