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 class
static interface
static interface
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BooleanSupplier
private final boolean
private int
private final Component
private final Function
<CycleButton<T>, MutableComponent> private final CycleButton.OnValueChange
<T> private final OptionInstance.TooltipSupplier
<T> private T
private final CycleButton.ValueListSupplier
<T> Fields inherited from class net.minecraft.client.gui.components.AbstractButton
SPRITES, TEXT_MARGIN
Fields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, width
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
ConstructorsConstructorDescriptionCycleButton
(int pX, int pY, int pWidth, int pHeight, Component pMessage, Component pName, int pIndex, T pValue, CycleButton.ValueListSupplier<T> pValues, Function<T, Component> pValueStringifier, Function<CycleButton<T>, MutableComponent> pNarrationProvider, CycleButton.OnValueChange<T> pOnValueChange, OptionInstance.TooltipSupplier<T> pTooltipSupplier, boolean pDisplayOnlyValue) -
Method Summary
Modifier and TypeMethodDescriptionstatic CycleButton.Builder
<Boolean> booleanBuilder
(Component pComponentOn, Component pComponentOff) static <T> CycleButton.Builder
<T> private MutableComponent
createFullName
(T pValue) private Component
createLabelForValue
(T pValue) protected MutableComponent
private void
cycleValue
(int pDelta) private T
getCycledValue
(int pDelta) getValue()
boolean
mouseScrolled
(double pMouseX, double pMouseY, double pScrollX, double pScrollY) static CycleButton.Builder
<Boolean> static CycleButton.Builder
<Boolean> onOffBuilder
(boolean pInitialValue) void
onPress()
void
private void
private void
updateValue
(T pValue) void
updateWidgetNarration
(NarrationElementOutput pNarrationElementOutput) Methods inherited from class net.minecraft.client.gui.components.AbstractButton
keyPressed, onClick, renderString, renderWidget
Methods 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, wrapDefaultNarrationMessage
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
charTyped, getCurrentFocusPath, keyReleased, mouseMoved
Methods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClick
Methods 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 pX, int pY, int pWidth, int pHeight, Component pMessage, Component pName, int pIndex, T pValue, CycleButton.ValueListSupplier<T> pValues, Function<T, Component> pValueStringifier, Function<CycleButton<T>, MutableComponent> pNarrationProvider, CycleButton.OnValueChange<T> pOnValueChange, OptionInstance.TooltipSupplier<T> pTooltipSupplier, boolean pDisplayOnlyValue)
-
-
Method Details
-
updateTooltip
private void updateTooltip() -
onPress
public void onPress()- Specified by:
onPress
in classAbstractButton
-
cycleValue
private void cycleValue(int pDelta) -
getCycledValue
-
mouseScrolled
public boolean mouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY) -
setValue
-
updateValue
-
createLabelForValue
-
createFullName
-
getValue
-
createNarrationMessage
- Overrides:
createNarrationMessage
in classAbstractWidget
-
updateWidgetNarration
- Specified by:
updateWidgetNarration
in classAbstractWidget
-
createDefaultNarrationMessage
-
builder
-
booleanBuilder
public static CycleButton.Builder<Boolean> booleanBuilder(Component pComponentOn, Component pComponentOff) -
onOffBuilder
-
onOffBuilder
-