Class AbstractSliderButton

java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractSliderButton
All Implemented Interfaces:
GuiEventListener, Renderable, TabOrderedElement, LayoutElement, NarratableEntry, NarrationSupplier, IAbstractWidgetExtension
Direct Known Subclasses:
AbstractOptionSliderButton, ExtendedSlider, RealmsSlotOptionsScreen.SettingsSlider

public abstract class AbstractSliderButton extends AbstractWidget
  • Field Details

    • SLIDER_SPRITE

      private static final ResourceLocation SLIDER_SPRITE
    • HIGHLIGHTED_SPRITE

      private static final ResourceLocation HIGHLIGHTED_SPRITE
    • SLIDER_HANDLE_SPRITE

      private static final ResourceLocation SLIDER_HANDLE_SPRITE
    • SLIDER_HANDLE_HIGHLIGHTED_SPRITE

      private static final ResourceLocation SLIDER_HANDLE_HIGHLIGHTED_SPRITE
    • TEXT_MARGIN

      protected static final int TEXT_MARGIN
      See Also:
    • HANDLE_WIDTH

      private static final int HANDLE_WIDTH
      See Also:
    • HANDLE_HALF_WIDTH

      private static final int HANDLE_HALF_WIDTH
      See Also:
    • value

      protected double value
    • canChangeValue

      private boolean canChangeValue
  • Constructor Details

    • AbstractSliderButton

      public AbstractSliderButton(int pX, int pY, int pWidth, int pHeight, Component pMessage, double pValue)
  • Method Details

    • getSprite

      protected ResourceLocation getSprite()
    • getHandleSprite

      protected ResourceLocation getHandleSprite()
    • createNarrationMessage

      protected MutableComponent createNarrationMessage()
      Overrides:
      createNarrationMessage in class AbstractWidget
    • updateWidgetNarration

      public void updateWidgetNarration(NarrationElementOutput pNarrationElementOutput)
      Specified by:
      updateWidgetNarration in class AbstractWidget
    • renderWidget

      public void renderWidget(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
      Specified by:
      renderWidget in class AbstractWidget
    • onClick

      public void onClick(double pMouseX, double pMouseY)
      Overrides:
      onClick in class AbstractWidget
    • setFocused

      public void setFocused(boolean pFocused)
      Description copied from class: AbstractWidget
      Sets the focus state of the GUI element.
      Specified by:
      setFocused in interface GuiEventListener
      Overrides:
      setFocused in class AbstractWidget
      Parameters:
      pFocused - true to apply focus, false to remove focus
    • keyPressed

      public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers)
      Called when a keyboard key is pressed within the GUI element.

      Parameters:
      pKeyCode - the key code of the pressed key.
      pScanCode - the scan code of the pressed key.
      pModifiers - the keyboard modifiers.
      Returns:
      true if the event is consumed, false otherwise.
    • setValueFromMouse

      private void setValueFromMouse(double pMouseX)
    • setValue

      private void setValue(double pValue)
    • onDrag

      protected void onDrag(double pMouseX, double pMouseY, double pDragX, double pDragY)
      Overrides:
      onDrag in class AbstractWidget
    • playDownSound

      public void playDownSound(SoundManager pHandler)
      Overrides:
      playDownSound in class AbstractWidget
    • onRelease

      public void onRelease(double pMouseX, double pMouseY)
      Overrides:
      onRelease in class AbstractWidget
    • updateMessage

      protected abstract void updateMessage()
    • applyValue

      protected abstract void applyValue()