Package net.minecraft.client.gui.widget
Class CyclingButtonWidget<T>
java.lang.Object
net.minecraft.client.gui.widget.ClickableWidget
net.minecraft.client.gui.widget.ClickableWidget.InactivityIndicatingWidget
net.minecraft.client.gui.widget.PressableWidget
net.minecraft.client.gui.widget.CyclingButtonWidget<T>
- All Implemented Interfaces:
Drawable,Element,Narratable,Navigable,Selectable,Updatable,Widget
@Environment(CLIENT)
public class CyclingButtonWidget<T>
extends PressableWidget
implements Updatable
- Mappings:
Namespace Name named net/minecraft/client/gui/widget/CyclingButtonWidgetintermediary net/minecraft/class_5676official gjl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder to easily create cycling button widgets.static interfacestatic enumstatic interfacestatic interfaceNested classes/interfaces inherited from class net.minecraft.client.gui.widget.ClickableWidget
ClickableWidget.InactivityIndicatingWidgetNested classes/interfaces inherited from interface net.minecraft.client.gui.Selectable
Selectable.SelectionType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CyclingButtonWidget.UpdateCallback<T> static final BooleanSupplierprivate final CyclingButtonWidget.IconGetter<T> private intprivate final CyclingButtonWidget.LabelTypeprivate final Function<CyclingButtonWidget<T>, MutableText> private final Textprivate final SimpleOption.TooltipFactory<T> private Tprivate final CyclingButtonWidget.Values<T> Fields inherited from class net.minecraft.client.gui.widget.PressableWidget
field_43050 -
Constructor Summary
ConstructorsConstructorDescriptionCyclingButtonWidget(int x, int y, int width, int height, Text message, Text optionText, int index, T value, Supplier<T> valueSupplier, CyclingButtonWidget.Values<T> values, Function<T, Text> valueToText, Function<CyclingButtonWidget<T>, MutableText> narrationMessageFactory, CyclingButtonWidget.UpdateCallback<T> callback, SimpleOption.TooltipFactory<T> tooltipFactory, CyclingButtonWidget.LabelType labelType, CyclingButtonWidget.IconGetter<T> icon) -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic <T> CyclingButtonWidget.Builder<T> static <T> CyclingButtonWidget.Builder<T> Creates a new builder for a cycling button widget.private MutableTextcomposeGenericOptionText(T value) private TextcomposeText(T value) private voidcycle(int amount) protected voiddrawIcon(DrawContext context, int mouseX, int mouseY, float deltaTicks) Returns a generic narration message for this button.protected MutableTextgetValue()private TgetValue(int offset) private voidinternalSetValue(T value) booleanmouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) Callback for when a mouse button scroll event has been captured.static CyclingButtonWidget.Builder<Boolean> onOffBuilder(boolean defaultValue) Creates a builder for a cycling button widget that only has Boolean.TRUE and Boolean.FALSE values.static CyclingButtonWidget.Builder<Boolean> onOffBuilder(Text on, Text off, boolean defaultValue) Creates a builder for a cycling button widget that only has Boolean.TRUE and Boolean.FALSE values.voidonPress(AbstractInput input) private voidvoidvoidupdate()Methods inherited from class net.minecraft.client.gui.widget.PressableWidget
drawButton, drawLabel, keyPressed, onClick, renderWidget, setFocusOverrideMethods inherited from class net.minecraft.client.gui.widget.ClickableWidget.InactivityIndicatingWidget
getMessage, makeInactive, setMessageMethods inherited from class net.minecraft.client.gui.widget.ClickableWidget
appendDefaultNarrations, appendNarrations, drawTextWithMargin, forEachChild, getAlpha, getBottom, getHeight, getNarrationMessage, getNavigationFocus, getNavigationOrder, getNavigationPath, getRight, getType, getWidth, getX, getY, isFocused, isHovered, isInteractable, isMouseOver, isSelected, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, onDrag, onRelease, playClickSound, playDownSound, render, setAlpha, setCursor, setDimensions, setDimensionsAndPosition, setFocused, setHeight, setNavigationOrder, setTooltip, setTooltipDelay, setWidth, setX, setYMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.Element
charTyped, getBorder, getFocusedPath, isClickable, keyReleased, mouseMovedMethods inherited from interface net.minecraft.client.gui.Selectable
getNarratedPartsMethods inherited from interface net.minecraft.client.gui.widget.Widget
setPosition
-
Field Details
-
HAS_ALT_DOWN
- Mappings:
Namespace Name Mixin selector named HAS_ALT_DOWNLnet/minecraft/client/gui/widget/CyclingButtonWidget;HAS_ALT_DOWN:Ljava/util/function/BooleanSupplier;intermediary field_27961Lnet/minecraft/class_5676;field_27961:Ljava/util/function/BooleanSupplier;official aLgjl;a:Ljava/util/function/BooleanSupplier;
-
BOOLEAN_VALUES
- Mappings:
Namespace Name Mixin selector named BOOLEAN_VALUESLnet/minecraft/client/gui/widget/CyclingButtonWidget;BOOLEAN_VALUES:Ljava/util/List;intermediary field_27962Lnet/minecraft/class_5676;field_27962:Ljava/util/List;official bLgjl;b:Ljava/util/List;
-
valueSupplier
- Mappings:
Namespace Name Mixin selector named valueSupplierLnet/minecraft/client/gui/widget/CyclingButtonWidget;valueSupplier:Ljava/util/function/Supplier;intermediary field_63504Lnet/minecraft/class_5676;field_63504:Ljava/util/function/Supplier;official cLgjl;c:Ljava/util/function/Supplier;
-
optionText
- Mappings:
Namespace Name Mixin selector named optionTextLnet/minecraft/client/gui/widget/CyclingButtonWidget;optionText:Lnet/minecraft/text/Text;intermediary field_27963Lnet/minecraft/class_5676;field_27963:Lnet/minecraft/class_2561;official dLgjl;d:Lyh;
-
index
private int index- Mappings:
Namespace Name Mixin selector named indexLnet/minecraft/client/gui/widget/CyclingButtonWidget;index:Iintermediary field_27964Lnet/minecraft/class_5676;field_27964:Iofficial fLgjl;f:I
-
value
- Mappings:
Namespace Name Mixin selector named valueLnet/minecraft/client/gui/widget/CyclingButtonWidget;value:Ljava/lang/Object;intermediary field_27965Lnet/minecraft/class_5676;field_27965:Ljava/lang/Object;official nLgjl;n:Ljava/lang/Object;
-
values
- Mappings:
Namespace Name Mixin selector named valuesLnet/minecraft/client/gui/widget/CyclingButtonWidget;values:Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;intermediary field_27966Lnet/minecraft/class_5676;field_27966:Lnet/minecraft/class_5676$class_5680;official oLgjl;o:Lgjl$e;
-
valueToText
- Mappings:
Namespace Name Mixin selector named valueToTextLnet/minecraft/client/gui/widget/CyclingButtonWidget;valueToText:Ljava/util/function/Function;intermediary field_27967Lnet/minecraft/class_5676;field_27967:Ljava/util/function/Function;official pLgjl;p:Ljava/util/function/Function;
-
narrationMessageFactory
- Mappings:
Namespace Name Mixin selector named narrationMessageFactoryLnet/minecraft/client/gui/widget/CyclingButtonWidget;narrationMessageFactory:Ljava/util/function/Function;intermediary field_27968Lnet/minecraft/class_5676;field_27968:Ljava/util/function/Function;official qLgjl;q:Ljava/util/function/Function;
-
callback
- Mappings:
Namespace Name Mixin selector named callbackLnet/minecraft/client/gui/widget/CyclingButtonWidget;callback:Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;intermediary field_27969Lnet/minecraft/class_5676;field_27969:Lnet/minecraft/class_5676$class_5678;official rLgjl;r:Lgjl$c;
-
labelType
- Mappings:
Namespace Name Mixin selector named labelTypeLnet/minecraft/client/gui/widget/CyclingButtonWidget;labelType:Lnet/minecraft/client/gui/widget/CyclingButtonWidget$LabelType;intermediary field_64535Lnet/minecraft/class_5676;field_64535:Lnet/minecraft/class_5676$class_12346;official sLgjl;s:Lgjl$b;
-
tooltipFactory
- Mappings:
Namespace Name Mixin selector named tooltipFactoryLnet/minecraft/client/gui/widget/CyclingButtonWidget;tooltipFactory:Lnet/minecraft/client/option/SimpleOption$TooltipFactory;intermediary field_27970Lnet/minecraft/class_5676;field_27970:Lnet/minecraft/class_7172$class_7277;official tLgjl;t:Lgfn$m;
-
icon
- Mappings:
Namespace Name Mixin selector named iconLnet/minecraft/client/gui/widget/CyclingButtonWidget;icon:Lnet/minecraft/client/gui/widget/CyclingButtonWidget$IconGetter;intermediary field_64536Lnet/minecraft/class_5676;field_64536:Lnet/minecraft/class_5676$class_12347;official uLgjl;u:Lgjl$d;
-
-
Constructor Details
-
CyclingButtonWidget
CyclingButtonWidget(int x, int y, int width, int height, Text message, Text optionText, int index, T value, Supplier<T> valueSupplier, CyclingButtonWidget.Values<T> values, Function<T, Text> valueToText, Function<CyclingButtonWidget<T>, MutableText> narrationMessageFactory, CyclingButtonWidget.UpdateCallback<T> callback, SimpleOption.TooltipFactory<T> tooltipFactory, CyclingButtonWidget.LabelType labelType, CyclingButtonWidget.IconGetter<T> icon) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/client/gui/widget/CyclingButtonWidget;<init>(IIIILnet/minecraft/text/Text;Lnet/minecraft/text/Text;ILjava/lang/Object;Ljava/util/function/Supplier;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Values;Ljava/util/function/Function;Ljava/util/function/Function;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$UpdateCallback;Lnet/minecraft/client/option/SimpleOption$TooltipFactory;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$LabelType;Lnet/minecraft/client/gui/widget/CyclingButtonWidget$IconGetter;)Vintermediary <init>Lnet/minecraft/class_5676;<init>(IIIILnet/minecraft/class_2561;Lnet/minecraft/class_2561;ILjava/lang/Object;Ljava/util/function/Supplier;Lnet/minecraft/class_5676$class_5680;Ljava/util/function/Function;Ljava/util/function/Function;Lnet/minecraft/class_5676$class_5678;Lnet/minecraft/class_7172$class_7277;Lnet/minecraft/class_5676$class_12346;Lnet/minecraft/class_5676$class_12347;)Vofficial <init>Lgjl;<init>(IIIILyh;Lyh;ILjava/lang/Object;Ljava/util/function/Supplier;Lgjl$e;Ljava/util/function/Function;Ljava/util/function/Function;Lgjl$c;Lgfn$m;Lgjl$b;Lgjl$d;)V
-
-
Method Details
-
drawIcon
- Specified by:
drawIconin classPressableWidget- Mappings:
Namespace Name Mixin selector named drawIconLnet/minecraft/client/gui/widget/PressableWidget;drawIcon(Lnet/minecraft/client/gui/DrawContext;IIF)Vintermediary method_75752Lnet/minecraft/class_4264;method_75752(Lnet/minecraft/class_332;IIF)Vofficial bLgiu;b(Lgir;IIF)V
-
refreshTooltip
private void refreshTooltip()- Mappings:
Namespace Name Mixin selector named refreshTooltipLnet/minecraft/client/gui/widget/CyclingButtonWidget;refreshTooltip()Vintermediary method_47403Lnet/minecraft/class_5676;method_47403()Vofficial dLgjl;d()V
-
onPress
- Specified by:
onPressin classPressableWidget- Mappings:
Namespace Name Mixin selector named onPressLnet/minecraft/client/gui/widget/PressableWidget;onPress(Lnet/minecraft/client/input/AbstractInput;)Vintermediary method_25306Lnet/minecraft/class_4264;method_25306(Lnet/minecraft/class_11907;)Vofficial aLgiu;a(Lgza;)V
-
cycle
private void cycle(int amount) - Mappings:
Namespace Name Mixin selector named cycleLnet/minecraft/client/gui/widget/CyclingButtonWidget;cycle(I)Vintermediary method_32612Lnet/minecraft/class_5676;method_32612(I)Vofficial aLgjl;a(I)V
-
getValue
- Mappings:
Namespace Name Mixin selector named getValueLnet/minecraft/client/gui/widget/CyclingButtonWidget;getValue(I)Ljava/lang/Object;intermediary method_37027Lnet/minecraft/class_5676;method_37027(I)Ljava/lang/Object;official bLgjl;b(I)Ljava/lang/Object;
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) Callback for when a mouse button scroll event has been captured.- Specified by:
mouseScrolledin interfaceElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mousehorizontalAmount- the horizontal scroll amountverticalAmount- the vertical scroll amount- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named mouseScrolledLnet/minecraft/client/gui/Element;mouseScrolled(DDDD)Zintermediary method_25401Lnet/minecraft/class_364;method_25401(DDDD)Zofficial aLgmm;a(DDDD)Z
-
setValue
- Mappings:
Namespace Name Mixin selector named setValueLnet/minecraft/client/gui/widget/CyclingButtonWidget;setValue(Ljava/lang/Object;)Vintermediary method_32605Lnet/minecraft/class_5676;method_32605(Ljava/lang/Object;)Vofficial aLgjl;a(Ljava/lang/Object;)V
-
update
public void update() -
internalSetValue
- Mappings:
Namespace Name Mixin selector named internalSetValueLnet/minecraft/client/gui/widget/CyclingButtonWidget;internalSetValue(Ljava/lang/Object;)Vintermediary method_32609Lnet/minecraft/class_5676;method_32609(Ljava/lang/Object;)Vofficial bLgjl;b(Ljava/lang/Object;)V
-
composeText
- Mappings:
Namespace Name Mixin selector named composeTextLnet/minecraft/client/gui/widget/CyclingButtonWidget;composeText(Ljava/lang/Object;)Lnet/minecraft/text/Text;intermediary method_37026Lnet/minecraft/class_5676;method_37026(Ljava/lang/Object;)Lnet/minecraft/class_2561;official cLgjl;c(Ljava/lang/Object;)Lyh;
-
composeGenericOptionText
- Mappings:
Namespace Name Mixin selector named composeGenericOptionTextLnet/minecraft/client/gui/widget/CyclingButtonWidget;composeGenericOptionText(Ljava/lang/Object;)Lnet/minecraft/text/MutableText;intermediary method_32610Lnet/minecraft/class_5676;method_32610(Ljava/lang/Object;)Lnet/minecraft/class_5250;official dLgjl;d(Ljava/lang/Object;)Lyw;
-
getValue
- Mappings:
Namespace Name Mixin selector named getValueLnet/minecraft/client/gui/widget/CyclingButtonWidget;getValue()Ljava/lang/Object;intermediary method_32603Lnet/minecraft/class_5676;method_32603()Ljava/lang/Object;official aLgjl;a()Ljava/lang/Object;
-
getNarrationMessage
- Overrides:
getNarrationMessagein classClickableWidget- Mappings:
Namespace Name Mixin selector named getNarrationMessageLnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage()Lnet/minecraft/text/MutableText;intermediary method_25360Lnet/minecraft/class_339;method_25360()Lnet/minecraft/class_5250;official fLgjc;f()Lyw;
-
appendClickableNarrations
- Specified by:
appendClickableNarrationsin classClickableWidget- Mappings:
Namespace Name Mixin selector named appendClickableNarrationsLnet/minecraft/client/gui/widget/ClickableWidget;appendClickableNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)Vintermediary method_47399Lnet/minecraft/class_339;method_47399(Lnet/minecraft/class_6382;)Vofficial aLgjc;a(Lgpd;)V
-
getGenericNarrationMessage
Returns a generic narration message for this button.If the button omits the option text in rendering, such as showing only "Value", this narration message will still read out the option like "Option: Value".
- Returns:
- a generic narration message for this button
- Mappings:
Namespace Name Mixin selector named getGenericNarrationMessageLnet/minecraft/client/gui/widget/CyclingButtonWidget;getGenericNarrationMessage()Lnet/minecraft/text/MutableText;intermediary method_32611Lnet/minecraft/class_5676;method_32611()Lnet/minecraft/class_5250;official cLgjl;c()Lyw;
-
builder
public static <T> CyclingButtonWidget.Builder<T> builder(Function<T, Text> valueToText, Supplier<T> valueSupplier) - Mappings:
Namespace Name Mixin selector named builderLnet/minecraft/client/gui/widget/CyclingButtonWidget;builder(Ljava/util/function/Function;Ljava/util/function/Supplier;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;intermediary method_75345Lnet/minecraft/class_5676;method_75345(Ljava/util/function/Function;Ljava/util/function/Supplier;)Lnet/minecraft/class_5676$class_5677;official aLgjl;a(Ljava/util/function/Function;Ljava/util/function/Supplier;)Lgjl$a;
-
builder
Creates a new builder for a cycling button widget.- Mappings:
Namespace Name Mixin selector named builderLnet/minecraft/client/gui/widget/CyclingButtonWidget;builder(Ljava/util/function/Function;Ljava/lang/Object;)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;intermediary method_32606Lnet/minecraft/class_5676;method_32606(Ljava/util/function/Function;Ljava/lang/Object;)Lnet/minecraft/class_5676$class_5677;official aLgjl;a(Ljava/util/function/Function;Ljava/lang/Object;)Lgjl$a;
-
onOffBuilder
public static CyclingButtonWidget.Builder<Boolean> onOffBuilder(Text on, Text off, boolean defaultValue) Creates a builder for a cycling button widget that only has Boolean.TRUE and Boolean.FALSE values. It displaysonfortrueandoffforfalse. Its current initial value istrue.- Mappings:
Namespace Name Mixin selector named onOffBuilderLnet/minecraft/client/gui/widget/CyclingButtonWidget;onOffBuilder(Lnet/minecraft/text/Text;Lnet/minecraft/text/Text;Z)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;intermediary method_32607Lnet/minecraft/class_5676;method_32607(Lnet/minecraft/class_2561;Lnet/minecraft/class_2561;Z)Lnet/minecraft/class_5676$class_5677;official aLgjl;a(Lyh;Lyh;Z)Lgjl$a;
-
onOffBuilder
Creates a builder for a cycling button widget that only has Boolean.TRUE and Boolean.FALSE values. It displaysScreenTexts.ONfortrueandScreenTexts.OFFforfalse. Its current initial value istrue.- Mappings:
Namespace Name Mixin selector named onOffBuilderLnet/minecraft/client/gui/widget/CyclingButtonWidget;onOffBuilder(Z)Lnet/minecraft/client/gui/widget/CyclingButtonWidget$Builder;intermediary method_32614Lnet/minecraft/class_5676;method_32614(Z)Lnet/minecraft/class_5676$class_5677;official aLgjl;a(Z)Lgjl$a;
-