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
official ehv$a
intermediary net/minecraft/class_5676$class_5677
named net/minecraft/client/gui/widget/CyclingButtonWidget$Builder
  • Field Details

    • initialIndex

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

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

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

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

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

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

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

    • Builder

      public Builder(Function<T,Text> valueToText)
      Creates a builder.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official <init> Lehv$a;<init>(Ljava/util/function/Function;)V
      intermediary <init> Lnet/minecraft/class_5676$class_5677;<init>(Ljava/util/function/Function;)V
      named <init> Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;<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
      official a Lehv$a;a(Ljava/util/Collection;)Lehv$a;
      intermediary method_32620 Lnet/minecraft/class_5676$class_5677;method_32620(Ljava/util/Collection;)Lnet/minecraft/class_5676$class_5677;
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values(Ljava/util/Collection;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
    • values

      @SafeVarargs public final CyclingButtonWidget.Builder<T> values(T[] values)
      Sets the option values for this button.
      Mappings:
      Namespace Name Mixin selector
      official a Lehv$a;a([Ljava/lang/Object;)Lehv$a;
      intermediary method_32624 Lnet/minecraft/class_5676$class_5677;method_32624([Ljava/lang/Object;)Lnet/minecraft/class_5676$class_5677;
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values([Ljava/lang/Object;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
    • 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
      official a Lehv$a;a(Ljava/util/List;Ljava/util/List;)Lehv$a;
      intermediary method_32621 Lnet/minecraft/class_5676$class_5677;method_32621(Ljava/util/List;Ljava/util/List;)Lnet/minecraft/class_5676$class_5677;
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values(Ljava/util/List;Ljava/util/List;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
    • 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
      official a Lehv$a;a(Ljava/util/function/BooleanSupplier;Ljava/util/List;Ljava/util/List;)Lehv$a;
      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;
      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;
    • values

      Mappings:
      Namespace Name Mixin selector
      official a Lehv$a;a(Lehv$c;)Lehv$a;
      intermediary method_42729 Lnet/minecraft/class_5676$class_5677;method_42729(Lnet/minecraft/class_5676$class_5680;)Lnet/minecraft/class_5676$class_5677;
      named values Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;values(Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
    • 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
      official a Lehv$a;a(Lefx$l;)Lehv$a;
      intermediary method_32618 Lnet/minecraft/class_5676$class_5677;method_32618(Lnet/minecraft/class_7172$class_7277;)Lnet/minecraft/class_5676$class_5677;
      named tooltip Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;tooltip(Lnet/minecraft/client/option/SimpleOption$TooltipFactory;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
    • 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
      official a Lehv$a;a(Ljava/lang/Object;)Lehv$a;
      intermediary method_32619 Lnet/minecraft/class_5676$class_5677;method_32619(Ljava/lang/Object;)Lnet/minecraft/class_5676$class_5677;
      named initially Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;initially(Ljava/lang/Object;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
    • 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
      official a Lehv$a;a(Ljava/util/function/Function;)Lehv$a;
      intermediary method_32623 Lnet/minecraft/class_5676$class_5677;method_32623(Ljava/util/function/Function;)Lnet/minecraft/class_5676$class_5677;
      named narration Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;narration(Ljava/util/function/Function;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
    • 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
      official a Lehv$a;a()Lehv$a;
      intermediary method_32616 Lnet/minecraft/class_5676$class_5677;method_32616()Lnet/minecraft/class_5676$class_5677;
      named omitKeyText Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;omitKeyText()Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;
    • build

      public CyclingButtonWidget<T> build(int x, int y, int width, int height, Text optionText)
      Mappings:
      Namespace Name Mixin selector
      official a Lehv$a;a(IIIILrq;)Lehv;
      intermediary method_35723 Lnet/minecraft/class_5676$class_5677;method_35723(IIIILnet/minecraft/class_2561;)Lnet/minecraft/class_5676;
      named build Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;build(IIIILnet/minecraft/text/Text;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget;
    • 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
      official a Lehv$a;a(IIIILrq;Lehv$b;)Lehv;
      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;
      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;