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 doublevalueFields inherited from class net.minecraft.client.gui.widget.AbstractButtonWidget
active, alpha, height, hovered, nextNarration, visible, WIDGETS_LOCATION, width, x, yFields 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 voidapplyValue()protected MutableTextgetNarrationMessage()protected intgetYImage(boolean hovered)booleankeyPressed(int keyCode, int scanCode, int modifiers)Callback for when a key down event has been captured.voidonClick(double mouseX, double mouseY)protected voidonDrag(double mouseX, double mouseY, double deltaX, double deltaY)voidonRelease(double mouseX, double mouseY)voidplayDownSound(SoundManager soundManager)protected voidrenderBg(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY)private voidsetValue(double mouseX)private voidsetValueFromMouse(double mouseX)protected abstract voidupdateMessage()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, setWidthMethods 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, setZOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getYImagein classAbstractButtonWidget
-
getNarrationMessage
- Overrides:
getNarrationMessagein classAbstractButtonWidget
-
renderBg
- Overrides:
renderBgin classAbstractButtonWidget
-
onClick
public void onClick(double mouseX, double mouseY)- Overrides:
onClickin 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 inGLFWclass.- Parameters:
keyCode- the named key code of the event as described in theGLFWclassscanCode- 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:
trueto 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:
onDragin classAbstractButtonWidget
-
playDownSound
- Overrides:
playDownSoundin classAbstractButtonWidget
-
onRelease
public void onRelease(double mouseX, double mouseY)- Overrides:
onReleasein classAbstractButtonWidget
-
updateMessage
protected abstract void updateMessage() -
applyValue
protected abstract void applyValue()
-