Class SliderWidget

All Implemented Interfaces:
Drawable, Element
Direct Known Subclasses:
OptionSliderWidget, RealmsSlotOptionsScreen.SettingsSlider

@Environment(CLIENT)
public abstract class SliderWidget
extends AbstractButtonWidget
  • Field Details

    • value

      protected double value
  • Constructor Details

    • SliderWidget

      public SliderWidget​(int x, int y, int width, int height, Text text, double value)
  • Method Details

    • getYImage

      protected int getYImage​(boolean hovered)
      Overrides:
      getYImage in class AbstractButtonWidget
    • getNarrationMessage

      protected MutableText getNarrationMessage()
      Overrides:
      getNarrationMessage in class AbstractButtonWidget
    • renderBg

      protected void renderBg​(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY)
      Overrides:
      renderBg in class AbstractButtonWidget
    • onClick

      public void onClick​(double mouseX, double mouseY)
      Overrides:
      onClick in class AbstractButtonWidget
    • 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 in GLFW class.
      Parameters:
      keyCode - the named key code of the event as described in the GLFW class
      scanCode - the unique/platform-specific scan code of the keyboard input
      modifiers - 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 class AbstractButtonWidget
    • playDownSound

      public void playDownSound​(SoundManager soundManager)
      Overrides:
      playDownSound in class AbstractButtonWidget
    • onRelease

      public void onRelease​(double mouseX, double mouseY)
      Overrides:
      onRelease in class AbstractButtonWidget
    • updateMessage

      protected abstract void updateMessage()
    • applyValue

      protected abstract void applyValue()