Class WidgetScrollBar

java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
org.cyclops.cyclopscore.client.gui.component.WidgetScrollBar
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

public class WidgetScrollBar extends net.minecraft.client.gui.components.AbstractWidget
A reusable scrollbar for screens. The using screen must add this as a child and call the following method from its respective method: * renderWidget(GuiGraphics, int, int, float) * mouseDragged(double, double, int, double, double) (@see ContainerScreenScrolling for an example)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     

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

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

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

    ACCESSIBILITY_TEXTURE, active, alpha, isHovered, packedFGColor, UNSET_FG_COLOR, visible, WIDGETS_LOCATION, width

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

    DOUBLE_CLICK_THRESHOLD_MS
  • Constructor Summary

    Constructors
    Constructor
    Description
    WidgetScrollBar(int x, int y, int height, net.minecraft.network.chat.Component narrationMessage, WidgetScrollBar.IScrollCallback scrollCallback, int visibleRows)
     
    WidgetScrollBar(int x, int y, int height, net.minecraft.network.chat.Component narrationMessage, WidgetScrollBar.IScrollCallback scrollCallback, int visibleRows, Rectangle scollRegion)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    float
     
    protected int
     
    int
     
    int
     
    boolean
    isMouseOver(double x, double y)
     
    boolean
    mouseDragged(double mouseX, double mouseY, int mouseButton, double offsetX, double offsetY)
     
    boolean
    mouseScrolled(double mouseX, double mouseY, double scroll)
     
    protected boolean
     
    void
    renderWidget(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
     
    void
    scrollRelative(double step)
     
    void
    scrollTo(float scroll)
     
    void
    scrollTo(float scroll, boolean invokeCallback)
     
    void
    setFirstRow(int firstRow, boolean invokeCallback)
     
    void
    setTotalRows(int totalRows)
     
    void
    setVisibleRows(int visibleRows)
     
    protected void
    updateWidgetNarration(net.minecraft.client.gui.narration.NarrationElementOutput narrationElementOutput)
     

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

    clearFGColor, clicked, createNarrationMessage, createTooltipPositioner, defaultButtonNarrationText, getFGColor, getHeight, getMessage, getRectangle, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isValidClickButton, mouseClicked, mouseReleased, narrationPriority, nextFocusPath, onClick, onDrag, onRelease, playDownSound, render, renderScrollingString, renderScrollingString, renderTexture, setAlpha, setFGColor, setFocused, setHeight, setMessage, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessage

    Methods inherited from class java.lang.Object

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

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

    charTyped, getCurrentFocusPath, keyPressed, keyReleased, mouseMoved

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

    setPosition
  • Constructor Details

    • WidgetScrollBar

      public WidgetScrollBar(int x, int y, int height, net.minecraft.network.chat.Component narrationMessage, @Nullable WidgetScrollBar.IScrollCallback scrollCallback, int visibleRows)
    • WidgetScrollBar

      public WidgetScrollBar(int x, int y, int height, net.minecraft.network.chat.Component narrationMessage, @Nullable WidgetScrollBar.IScrollCallback scrollCallback, int visibleRows, Rectangle scollRegion)
  • Method Details

    • isMouseOver

      public boolean isMouseOver(double x, double y)
      Specified by:
      isMouseOver in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      isMouseOver in class net.minecraft.client.gui.components.AbstractWidget
    • getCurrentScroll

      public float getCurrentScroll()
      Returns:
      The current scroll position.
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double scroll)
    • mouseDragged

      public boolean mouseDragged(double mouseX, double mouseY, int mouseButton, double offsetX, double offsetY)
      Specified by:
      mouseDragged in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      mouseDragged in class net.minecraft.client.gui.components.AbstractWidget
    • renderWidget

      public void renderWidget(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
      Specified by:
      renderWidget in class net.minecraft.client.gui.components.AbstractWidget
    • needsScrollBars

      protected boolean needsScrollBars()
    • getScrollStep

      protected int getScrollStep()
    • scrollRelative

      public void scrollRelative(double step)
    • scrollTo

      public void scrollTo(float scroll)
    • scrollTo

      public void scrollTo(float scroll, boolean invokeCallback)
    • setFirstRow

      public void setFirstRow(int firstRow, boolean invokeCallback)
    • getTotalRows

      public int getTotalRows()
    • setTotalRows

      public void setTotalRows(int totalRows)
    • getVisibleRows

      public int getVisibleRows()
    • setVisibleRows

      public void setVisibleRows(int visibleRows)
    • updateWidgetNarration

      protected void updateWidgetNarration(net.minecraft.client.gui.narration.NarrationElementOutput narrationElementOutput)
      Specified by:
      updateWidgetNarration in class net.minecraft.client.gui.components.AbstractWidget