Package net.minecraft.client.gui.widget
Class SliderWidget
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.widget.AbstractButtonWidget
net.minecraft.client.gui.widget.SliderWidget
- Direct Known Subclasses:
OptionSliderWidget
,RealmsSlotOptionsScreen.SettingsSlider
@Environment(CLIENT) public abstract class SliderWidget extends AbstractButtonWidget
-
Field Summary
Fields Modifier and Type Field Description protected double
value
Fields inherited from class net.minecraft.client.gui.widget.AbstractButtonWidget
active, alpha, height, hovered, nextNarration, visible, WIDGETS_LOCATION, width, x, y
Fields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE
-
Constructor Summary
Constructors Constructor Description SliderWidget(int x, int y, int width, int height, Text text, double value)
-
Method Summary
Modifier and Type Method Description protected abstract void
applyValue()
protected MutableText
getNarrationMessage()
protected int
getYImage(boolean hovered)
boolean
keyPressed(int keyCode, int scanCode, int modifiers)
Callback for when a key down event has been captured.void
onClick(double mouseX, double mouseY)
protected void
onDrag(double mouseX, double mouseY, double deltaX, double deltaY)
void
onRelease(double mouseX, double mouseY)
void
playDownSound(SoundManager soundManager)
protected void
renderBg(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY)
private void
setValue(double mouseX)
private void
setValueFromMouse(double mouseX)
protected abstract void
updateMessage()
Methods inherited from class net.minecraft.client.gui.widget.AbstractButtonWidget
changeFocus, clicked, getHeight, getMessage, getWidth, isFocused, isHovered, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrate, onFocusedChanged, queueNarration, render, renderButton, renderToolTip, setAlpha, setFocused, setMessage, setWidth
Methods inherited from class net.minecraft.client.gui.DrawableHelper
drawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, setZOffset
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.Element
charTyped, keyReleased, mouseMoved, mouseScrolled
-
Field Details
-
value
protected double value
-
-
Constructor Details
-
SliderWidget
-
-
Method Details
-
getYImage
protected int getYImage(boolean hovered)- Overrides:
getYImage
in classAbstractButtonWidget
-
getNarrationMessage
- Overrides:
getNarrationMessage
in classAbstractButtonWidget
-
renderBg
- Overrides:
renderBg
in classAbstractButtonWidget
-
onClick
public void onClick(double mouseX, double mouseY)- Overrides:
onClick
in classAbstractButtonWidget
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers)Callback for when a key down event has been captured. The key code is identified by the constants inGLFW
class.- Parameters:
keyCode
- the named key code of the event as described in theGLFW
classscanCode
- the unique/platform-specific scan code of the keyboard inputmodifiers
- a GLFW bitfield describing the modifier keys that are held down (see {@linkplain https://www.glfw.org/docs/3.3/group__mods.html GLFW Modifier key flags})- Returns:
true
to indicate that the event handling is successful/valid- See Also:
Keyboard.onKey(long, int, int, int, int)
,GLFW.GLFW_KEY_Q
,GLFWKeyCallbackI.invoke(long, int, int, int, int)
-
setValueFromMouse
private void setValueFromMouse(double mouseX) -
setValue
private void setValue(double mouseX) -
onDrag
protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY)- Overrides:
onDrag
in classAbstractButtonWidget
-
playDownSound
- Overrides:
playDownSound
in classAbstractButtonWidget
-
onRelease
public void onRelease(double mouseX, double mouseY)- Overrides:
onRelease
in classAbstractButtonWidget
-
updateMessage
protected abstract void updateMessage() -
applyValue
protected abstract void applyValue()
-