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 x, int y, int width, int height, Component message, double value) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
protected MutableComponent
protected ResourceLocation
protected ResourceLocation
boolean
keyPressed
(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.void
onClick
(double mouseX, double mouseY) protected void
onDrag
(double mouseX, double mouseY, double dragX, double dragY) void
onRelease
(double mouseX, double mouseY) void
playDownSound
(SoundManager handler) void
renderWidget
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) void
setFocused
(boolean focused) Sets the focus state of the GUI element.private void
setValue
(double value) private void
setValueFromMouse
(double mouseX) protected abstract void
void
updateWidgetNarration
(NarrationElementOutput narrationElementOutput) 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
-
-
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 mouseX, double mouseY) - Overrides:
onClick
in classAbstractWidget
-
setFocused
public void setFocused(boolean focused) Description copied from class:AbstractWidget
Sets the focus state of the GUI element.- Specified by:
setFocused
in interfaceGuiEventListener
- Overrides:
setFocused
in classAbstractWidget
- Parameters:
focused
-true
to apply focus,false
to remove focus
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.- Parameters:
keyCode
- the key code of the pressed key.scanCode
- the scan code of the pressed key.modifiers
- the keyboard modifiers.- Returns:
true
if the event is consumed,false
otherwise.
-
setValueFromMouse
private void setValueFromMouse(double mouseX) -
setValue
private void setValue(double value) -
onDrag
protected void onDrag(double mouseX, double mouseY, double dragX, double dragY) - Overrides:
onDrag
in classAbstractWidget
-
playDownSound
- Overrides:
playDownSound
in classAbstractWidget
-
onRelease
public void onRelease(double mouseX, double mouseY) - Overrides:
onRelease
in classAbstractWidget
-
updateMessage
protected abstract void updateMessage() -
applyValue
protected abstract void applyValue()
-