Class AbstractScrollWidget

java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractScrollWidget
All Implemented Interfaces:
GuiEventListener, Renderable, TabOrderedElement, LayoutElement, NarratableEntry, NarrationSupplier, IAbstractWidgetExtension
Direct Known Subclasses:
FittingMultiLineTextWidget, MultiLineEditBox, TelemetryEventWidget

public abstract class AbstractScrollWidget extends AbstractWidget implements Renderable, GuiEventListener
  • Field Details

    • BACKGROUND_SPRITES

      private static final WidgetSprites BACKGROUND_SPRITES
    • SCROLLER_SPRITE

      private static final ResourceLocation SCROLLER_SPRITE
    • INNER_PADDING

      private static final int INNER_PADDING
      See Also:
    • SCROLL_BAR_WIDTH

      private static final int SCROLL_BAR_WIDTH
      See Also:
    • scrollAmount

      private double scrollAmount
    • scrolling

      private boolean scrolling
  • Constructor Details

    • AbstractScrollWidget

      public AbstractScrollWidget(int x, int y, int width, int height, Component message)
  • Method Details

    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
      Description copied from class: AbstractWidget
      Called when a mouse button is clicked within the GUI element.

      Specified by:
      mouseClicked in interface GuiEventListener
      Overrides:
      mouseClicked in class AbstractWidget
      Parameters:
      mouseX - the X coordinate of the mouse.
      mouseY - the Y coordinate of the mouse.
      button - the button that was clicked.
      Returns:
      true if the event is consumed, false otherwise.
    • mouseReleased

      public boolean mouseReleased(double mouseX, double mouseY, int button)
      Description copied from class: AbstractWidget
      Called when a mouse button is released within the GUI element.

      Specified by:
      mouseReleased in interface GuiEventListener
      Overrides:
      mouseReleased in class AbstractWidget
      Parameters:
      mouseX - the X coordinate of the mouse.
      mouseY - the Y coordinate of the mouse.
      button - the button that was released.
      Returns:
      true if the event is consumed, false otherwise.
    • mouseDragged

      public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY)
      Description copied from class: AbstractWidget
      Called when the mouse is dragged within the GUI element.

      Specified by:
      mouseDragged in interface GuiEventListener
      Overrides:
      mouseDragged in class AbstractWidget
      Parameters:
      mouseX - the X coordinate of the mouse.
      mouseY - the Y coordinate of the mouse.
      button - the button that is being dragged.
      dragX - the X distance of the drag.
      dragY - the Y distance of the drag.
      Returns:
      true if the event is consumed, false otherwise.
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY)
      Specified by:
      mouseScrolled in interface GuiEventListener
    • keyPressed

      public boolean keyPressed(int keyCode, int scanCode, int modifiers)
      Called when a keyboard key is pressed within the GUI element.

      Specified by:
      keyPressed in interface GuiEventListener
      Parameters:
      keyCode - the key code of the pressed key.
      scanCode - the scan code of the pressed key.
      modifiers - the keyboard modifiers.
      Returns:
      true if the event is consumed, false otherwise.
    • renderWidget

      public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
      Specified by:
      renderWidget in class AbstractWidget
    • getScrollBarHeight

      private int getScrollBarHeight()
    • renderDecorations

      protected void renderDecorations(GuiGraphics guiGraphics)
    • innerPadding

      protected int innerPadding()
    • totalInnerPadding

      protected int totalInnerPadding()
    • scrollAmount

      protected double scrollAmount()
    • setScrollAmount

      protected void setScrollAmount(double scrollAmount)
    • getMaxScrollAmount

      protected int getMaxScrollAmount()
    • getContentHeight

      private int getContentHeight()
    • renderBackground

      protected void renderBackground(GuiGraphics guiGraphics)
    • renderBorder

      protected void renderBorder(GuiGraphics guiGraphics, int x, int y, int width, int height)
    • renderScrollBar

      private void renderScrollBar(GuiGraphics guiGraphics)
    • withinContentAreaTopBottom

      protected boolean withinContentAreaTopBottom(int top, int bottom)
    • withinContentAreaPoint

      protected boolean withinContentAreaPoint(double x, double y)
    • scrollbarVisible

      protected boolean scrollbarVisible()
    • scrollbarWidth

      public int scrollbarWidth()
    • getInnerHeight

      protected abstract int getInnerHeight()
    • scrollRate

      protected abstract double scrollRate()
    • renderContents

      protected abstract void renderContents(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)