Class AbstractSliderButton
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractSliderButton
- All Implemented Interfaces:
GuiEventListener,Renderable,TabOrderedElement,LayoutElement,NarratableEntry,NarrationSupplier,IAbstractWidgetExtension
- Direct Known Subclasses:
AbstractOptionSliderButton,ExtendedSlider,RealmsSlotOptionsScreen.SettingsSlider
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final intprivate static final intprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprivate static final ResourceLocationprotected static final intprotected doubleFields 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
ConstructorsConstructorDescriptionAbstractSliderButton(int pX, int pY, int pWidth, int pHeight, Component pMessage, double pValue) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidprotected MutableComponentprotected ResourceLocationprotected ResourceLocationbooleankeyPressed(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.voidonClick(double pMouseX, double pMouseY) protected voidonDrag(double pMouseX, double pMouseY, double pDragX, double pDragY) voidonRelease(double pMouseX, double pMouseY) voidplayDownSound(SoundManager pHandler) voidrenderWidget(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) voidsetFocused(boolean pFocused) Sets the focus state of the GUI element.private voidsetValue(double pValue) private voidsetValueFromMouse(double pMouseX) protected abstract voidvoidupdateWidgetNarration(NarrationElementOutput pNarrationElementOutput) 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, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, 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, mouseMoved, mouseScrolledMethods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClickMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
-
Field Details
-
SLIDER_SPRITE
-
HIGHLIGHTED_SPRITE
-
SLIDER_HANDLE_SPRITE
-
SLIDER_HANDLE_HIGHLIGHTED_SPRITE
-
TEXT_MARGIN
protected static final int TEXT_MARGIN- See Also:
-
HANDLE_WIDTH
private static final int HANDLE_WIDTH- See Also:
-
HANDLE_HALF_WIDTH
private static final int HANDLE_HALF_WIDTH- See Also:
-
value
protected double value -
canChangeValue
private boolean canChangeValue
-
-
Constructor Details
-
AbstractSliderButton
public AbstractSliderButton(int pX, int pY, int pWidth, int pHeight, Component pMessage, double pValue)
-
-
Method Details
-
getSprite
-
getHandleSprite
-
createNarrationMessage
- Overrides:
createNarrationMessagein classAbstractWidget
-
updateWidgetNarration
- Specified by:
updateWidgetNarrationin classAbstractWidget
-
renderWidget
- Specified by:
renderWidgetin classAbstractWidget
-
onClick
public void onClick(double pMouseX, double pMouseY) - Overrides:
onClickin classAbstractWidget
-
setFocused
public void setFocused(boolean pFocused) Description copied from class:AbstractWidgetSets the focus state of the GUI element.- Specified by:
setFocusedin interfaceGuiEventListener- Overrides:
setFocusedin classAbstractWidget- Parameters:
pFocused-trueto apply focus,falseto remove focus
-
keyPressed
public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.- Parameters:
pKeyCode- the key code of the pressed key.pScanCode- the scan code of the pressed key.pModifiers- the keyboard modifiers.- Returns:
trueif the event is consumed,falseotherwise.
-
setValueFromMouse
private void setValueFromMouse(double pMouseX) -
setValue
private void setValue(double pValue) -
onDrag
protected void onDrag(double pMouseX, double pMouseY, double pDragX, double pDragY) - Overrides:
onDragin classAbstractWidget
-
playDownSound
- Overrides:
playDownSoundin classAbstractWidget
-
onRelease
public void onRelease(double pMouseX, double pMouseY) - Overrides:
onReleasein classAbstractWidget
-
updateMessage
protected abstract void updateMessage() -
applyValue
protected abstract void applyValue()
-