Class ModSlider

java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractWidget.WithInactiveMessage
net.minecraft.client.gui.components.AbstractSliderButton
com.mrbysco.captcha.client.screen.slide.ModSlider
All Implemented Interfaces:
net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.components.TabOrderedElement, net.minecraft.client.gui.layouts.LayoutElement, net.minecraft.client.gui.narration.NarratableEntry, net.minecraft.client.gui.narration.NarrationSupplier
Direct Known Subclasses:
PuzzleSlider

public class ModSlider extends net.minecraft.client.gui.components.AbstractSliderButton
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.client.gui.components.AbstractWidget

    net.minecraft.client.gui.components.AbstractWidget.WithInactiveMessage

    Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry

    net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected double
     
    protected double
     
    protected net.minecraft.network.chat.Component
     
    protected double
    Allows input of discontinuous values with a certain step
    protected net.minecraft.network.chat.Component
     

    Fields inherited from class net.minecraft.client.gui.components.AbstractSliderButton

    canChangeValue, DEFAULT_HEIGHT, HANDLE_WIDTH, TEXT_MARGIN, value

    Fields inherited from class net.minecraft.client.gui.components.AbstractWidget

    active, alpha, height, isHovered, message, visible, width
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModSlider(int x, int y, int width, int height, net.minecraft.network.chat.Component prefix, net.minecraft.network.chat.Component suffix, double minValue, double maxValue, double currentValue, boolean drawString)
    Overload with stepSize set to 1, useful for sliders with whole number values.
    ModSlider(int x, int y, int width, int height, net.minecraft.network.chat.Component prefix, net.minecraft.network.chat.Component suffix, double minValue, double maxValue, double currentValue, double stepSize, int precision, boolean drawString)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    double
     
    int
     
    long
     
     
    boolean
    keyPressed(net.minecraft.client.input.KeyEvent event)
     
    void
    onClick(net.minecraft.client.input.MouseButtonEvent buttonEvent, boolean doubleClick)
     
    protected void
    onDrag(net.minecraft.client.input.MouseButtonEvent buttonEvent, double p_93591_, double p_93592_)
     
    void
    setValue(double value)
     
    protected void
     

    Methods inherited from class net.minecraft.client.gui.components.AbstractSliderButton

    createNarrationMessage, extractWidgetRenderState, handleCursor, onRelease, playDownSound, setFocused, updateWidgetNarration

    Methods inherited from class net.minecraft.client.gui.components.AbstractWidget.WithInactiveMessage

    defaultInactiveMessage, getMessage, setMessage

    Methods inherited from class net.minecraft.client.gui.components.AbstractWidget

    defaultButtonNarrationText, extractRenderState, extractScrollingStringOverContents, extractTooltipForNextRenderPass, getAlpha, getBottom, getHeight, getRectangle, getRight, getTabOrderGroup, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrationPriority, nextFocusPath, playButtonClickSound, setAlpha, setHeight, setRectangle, setSize, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessage

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    charTyped, getBorderForArrowNavigation, getCurrentFocusPath, keyReleased, mouseMoved, mouseScrolled, preeditUpdated, shouldTakeFocusAfterInteraction

    Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement

    setPosition

    Methods inherited from interface net.minecraft.client.gui.narration.NarratableEntry

    getNarratables
  • Field Details

    • prefix

      protected net.minecraft.network.chat.Component prefix
    • suffix

      protected net.minecraft.network.chat.Component suffix
    • minValue

      protected double minValue
    • maxValue

      protected double maxValue
    • stepSize

      protected double stepSize
      Allows input of discontinuous values with a certain step
    • drawString

      protected boolean drawString
  • Constructor Details

    • ModSlider

      public ModSlider(int x, int y, int width, int height, net.minecraft.network.chat.Component prefix, net.minecraft.network.chat.Component suffix, double minValue, double maxValue, double currentValue, double stepSize, int precision, boolean drawString)
      Parameters:
      x - x position of upper left corner
      y - y position of upper left corner
      width - Width of the widget
      height - Height of the widget
      prefix - Component displayed before the value string
      suffix - Component displayed after the value string
      minValue - Minimum (left) value of slider
      maxValue - Maximum (right) value of slider
      currentValue - Starting value when widget is first displayed
      stepSize - Size of step used. Precision will automatically be calculated based on this value if this value is not 0.
      precision - Only used when stepSize is 0. Limited to a maximum of 4 (inclusive).
      drawString - Should text be displayed on the widget
    • ModSlider

      public ModSlider(int x, int y, int width, int height, net.minecraft.network.chat.Component prefix, net.minecraft.network.chat.Component suffix, double minValue, double maxValue, double currentValue, boolean drawString)
      Overload with stepSize set to 1, useful for sliders with whole number values.
  • Method Details

    • getValue

      public double getValue()
      Returns:
      Current slider value as a double
    • getValueLong

      public long getValueLong()
      Returns:
      Current slider value as an long
    • getValueInt

      public int getValueInt()
      Returns:
      Current slider value as an int
    • setValue

      public void setValue(double value)
      Overrides:
      setValue in class net.minecraft.client.gui.components.AbstractSliderButton
      Parameters:
      value - The new slider value
    • getValueString

      public String getValueString()
    • onClick

      public void onClick(net.minecraft.client.input.MouseButtonEvent buttonEvent, boolean doubleClick)
      Overrides:
      onClick in class net.minecraft.client.gui.components.AbstractSliderButton
    • onDrag

      protected void onDrag(net.minecraft.client.input.MouseButtonEvent buttonEvent, double p_93591_, double p_93592_)
      Overrides:
      onDrag in class net.minecraft.client.gui.components.AbstractSliderButton
    • keyPressed

      public boolean keyPressed(net.minecraft.client.input.KeyEvent event)
      Specified by:
      keyPressed in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      keyPressed in class net.minecraft.client.gui.components.AbstractSliderButton
    • updateMessage

      protected void updateMessage()
      Specified by:
      updateMessage in class net.minecraft.client.gui.components.AbstractSliderButton
    • applyValue

      protected void applyValue()
      Specified by:
      applyValue in class net.minecraft.client.gui.components.AbstractSliderButton