Class CycleButton<T>
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractButton
net.minecraft.client.gui.components.CycleButton<T>
- All Implemented Interfaces:
GuiEventListener,Renderable,TabOrderedElement,LayoutElement,NarratableEntry,NarrationSupplier,IAbstractWidgetExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic interfaceNested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BooleanSupplierprivate final booleanprivate intprivate final Componentprivate final Function<CycleButton<T>, MutableComponent> private final CycleButton.OnValueChange<T> private final OptionInstance.TooltipSupplier<T> private Tprivate final CycleButton.ValueListSupplier<T> Fields inherited from class net.minecraft.client.gui.components.AbstractButton
SPRITES, TEXT_MARGINFields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, widthFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
ConstructorsConstructorDescriptionCycleButton(int x, int y, int width, int height, Component message, Component name, int index, T value, CycleButton.ValueListSupplier<T> values, Function<T, Component> valueStringifier, Function<CycleButton<T>, MutableComponent> narrationProvider, CycleButton.OnValueChange<T> onValueChange, OptionInstance.TooltipSupplier<T> tooltipSupplier, boolean displayOnlyValue) -
Method Summary
Modifier and TypeMethodDescriptionstatic CycleButton.Builder<Boolean> booleanBuilder(Component componentOn, Component componentOff) static <T> CycleButton.Builder<T> private MutableComponentcreateFullName(T value) private ComponentcreateLabelForValue(T value) protected MutableComponentprivate voidcycleValue(int delta) private TgetCycledValue(int delta) getValue()booleanmouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) static CycleButton.Builder<Boolean> static CycleButton.Builder<Boolean> onOffBuilder(boolean initialValue) voidonPress()voidprivate voidprivate voidupdateValue(T value) voidupdateWidgetNarration(NarrationElementOutput narrationElementOutput) Methods inherited from class net.minecraft.client.gui.components.AbstractButton
keyPressed, onClick, renderString, renderWidgetMethods inherited from class net.minecraft.client.gui.components.AbstractWidget
clearFGColor, clicked, defaultButtonNarrationText, getBottom, getFGColor, getHeight, getMessage, getRectangle, getRight, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrationPriority, nextFocusPath, onDrag, onRelease, playDownSound, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setFocused, setHeight, setMessage, setRectangle, setSize, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
charTyped, getCurrentFocusPath, keyReleased, mouseMovedMethods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClickMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
-
Field Details
-
DEFAULT_ALT_LIST_SELECTOR
-
BOOLEAN_OPTIONS
-
name
-
index
private int index -
value
-
values
-
valueStringifier
-
narrationProvider
-
onValueChange
-
displayOnlyValue
private final boolean displayOnlyValue -
tooltipSupplier
-
-
Constructor Details
-
CycleButton
CycleButton(int x, int y, int width, int height, Component message, Component name, int index, T value, CycleButton.ValueListSupplier<T> values, Function<T, Component> valueStringifier, Function<CycleButton<T>, MutableComponent> narrationProvider, CycleButton.OnValueChange<T> onValueChange, OptionInstance.TooltipSupplier<T> tooltipSupplier, boolean displayOnlyValue)
-
-
Method Details
-
updateTooltip
private void updateTooltip() -
onPress
public void onPress()- Specified by:
onPressin classAbstractButton
-
cycleValue
private void cycleValue(int delta) -
getCycledValue
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) -
setValue
-
updateValue
-
createLabelForValue
-
createFullName
-
getValue
-
createNarrationMessage
- Overrides:
createNarrationMessagein classAbstractWidget
-
updateWidgetNarration
- Specified by:
updateWidgetNarrationin classAbstractWidget
-
createDefaultNarrationMessage
-
builder
-
booleanBuilder
public static CycleButton.Builder<Boolean> booleanBuilder(Component componentOn, Component componentOff) -
onOffBuilder
-
onOffBuilder
-