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 boolean
private static final int
private static final int
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
private static final ResourceLocation
protected static final int
protected double
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
ConstructorsConstructorDescriptionAbstractSliderButton
(int pX, int pY, int pWidth, int pHeight, Component pMessage, double pValue) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
protected MutableComponent
protected ResourceLocation
protected ResourceLocation
boolean
keyPressed
(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.void
onClick
(double pMouseX, double pMouseY) protected void
onDrag
(double pMouseX, double pMouseY, double pDragX, double pDragY) void
onRelease
(double pMouseX, double pMouseY) void
playDownSound
(SoundManager pHandler) void
renderWidget
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) void
setFocused
(boolean pFocused) Sets the focus state of the GUI element.private void
setValue
(double pValue) private void
setValueFromMouse
(double pMouseX) protected abstract void
void
updateWidgetNarration
(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, 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, mouseScrolled
Methods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClick
Methods 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:
createNarrationMessage
in classAbstractWidget
-
updateWidgetNarration
- Specified by:
updateWidgetNarration
in classAbstractWidget
-
renderWidget
- Specified by:
renderWidget
in classAbstractWidget
-
onClick
public void onClick(double pMouseX, double pMouseY) - Overrides:
onClick
in classAbstractWidget
-
setFocused
public void setFocused(boolean pFocused) Description copied from class:AbstractWidget
Sets the focus state of the GUI element.- Specified by:
setFocused
in interfaceGuiEventListener
- Overrides:
setFocused
in classAbstractWidget
- Parameters:
pFocused
-true
to apply focus,false
to 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:
true
if the event is consumed,false
otherwise.
-
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:
onDrag
in classAbstractWidget
-
playDownSound
- Overrides:
playDownSound
in classAbstractWidget
-
onRelease
public void onRelease(double pMouseX, double pMouseY) - Overrides:
onRelease
in classAbstractWidget
-
updateMessage
protected abstract void updateMessage() -
applyValue
protected abstract void applyValue()
-