All Implemented Interfaces:
GuiEventListener, Widget, NarratableEntry, NarrationSupplier

public class Slider extends ExtendedButton
This class is blatantly stolen from iChunUtils with permission.
Author:
iChun
  • Field Details

    • sliderValue

      public double sliderValue
      The value of this slider control.
    • dispString

      public Component dispString
    • dragging

      public boolean dragging
      Is this slider control being dragged.
    • showDecimal

      public boolean showDecimal
    • minValue

      public double minValue
    • maxValue

      public double maxValue
    • precision

      public int precision
    • parent

      @Nullable public Slider.ISlider parent
    • suffix

      public Component suffix
    • drawString

      public boolean drawString
  • Constructor Details

    • Slider

      public Slider(int xPos, int yPos, int width, int height, Component prefix, Component suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.OnPress handler)
    • Slider

      public Slider(int xPos, int yPos, int width, int height, Component prefix, Component suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, Button.OnPress handler, @Nullable Slider.ISlider par)
    • Slider

      public Slider(int xPos, int yPos, Component displayStr, double minVal, double maxVal, double currentVal, Button.OnPress handler, Slider.ISlider par)
  • Method Details

    • getYImage

      public int getYImage(boolean par1)
      Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over this button.
      Overrides:
      getYImage in class AbstractWidget
    • renderBg

      protected void renderBg(PoseStack mStack, Minecraft par1Minecraft, int par2, int par3)
      Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e).
      Overrides:
      renderBg in class AbstractWidget
    • onClick

      public void onClick(double mouseX, double mouseY)
      Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent e).
      Overrides:
      onClick in class AbstractButton
    • updateSlider

      public void updateSlider()
    • onRelease

      public void onRelease(double mouseX, double mouseY)
      Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e).
      Overrides:
      onRelease in class AbstractWidget
    • getValueInt

      public int getValueInt()
    • getValue

      public double getValue()
    • setValue

      public void setValue(double d)