Class ScrollPanel

java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.neoforged.neoforge.client.gui.widget.ScrollPanel
All Implemented Interfaces:
net.minecraft.client.gui.components.events.ContainerEventHandler, net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.components.TabOrderedElement, net.minecraft.client.gui.narration.NarratableEntry, net.minecraft.client.gui.narration.NarrationSupplier
Direct Known Subclasses:
ModListScreen.InfoPanel, ModMismatchDisconnectedScreen.MismatchInfoPanel

public abstract class ScrollPanel extends net.minecraft.client.gui.components.events.AbstractContainerEventHandler implements net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.narration.NarratableEntry
Abstract scroll panel class.
  • Nested Class Summary

    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
    private final int
     
    private final int
     
    private final int
     
    private final int
     
    private final int
     
    protected final int
     
    protected final int
     
    protected boolean
     
    private final net.minecraft.client.Minecraft
     
    protected final int
     
    protected final int
     
    protected final int
     
    protected float
     
    private boolean
     
    protected final int
     
    protected final int
     

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

    DOUBLE_CLICK_THRESHOLD_MS
  • Constructor Summary

    Constructors
    Constructor
    Description
    ScrollPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left)
     
    ScrollPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left, int border)
     
    ScrollPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left, int border, int barWidth)
     
    ScrollPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left, int border, int barWidth, int barBgColor, int barColor, int barBorderColor)
    Base constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
     
    List<? extends net.minecraft.client.gui.components.events.GuiEventListener>
     
    protected boolean
    clickPanel(double mouseX, double mouseY, int button)
     
    protected void
    drawBackground(net.minecraft.client.gui.GuiGraphics guiGraphics, float partialTick)
    Draws the background of the scroll panel.
    protected void
    drawGradientRect(net.minecraft.client.gui.GuiGraphics guiGraphics, int left, int top, int right, int bottom, int color1, int color2)
     
    protected abstract void
    drawPanel(net.minecraft.client.gui.GuiGraphics guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY)
    Draw anything special on the screen.
    private int
     
    protected abstract int
     
    private int
     
    protected int
     
    boolean
    isMouseOver(double mouseX, double mouseY)
     
    boolean
    mouseClicked(double mouseX, double mouseY, int button)
     
    boolean
    mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
     
    boolean
    mouseReleased(double mouseX, double mouseY, int button)
     
    boolean
    mouseScrolled(double p_94686_, double p_94687_, double p_94688_, double p_294830_)
     
    void
    render(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
     

    Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler

    getFocused, isDragging, setDragging, setFocused

    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.ContainerEventHandler

    charTyped, getChildAt, getCurrentFocusPath, isFocused, keyPressed, keyReleased, nextFocusPath, setFocused

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

    getBorderForArrowNavigation, getRectangle, mouseMoved

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

    getNarratables, isActive, narrationPriority

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

    updateNarration

    Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement

    getTabOrderGroup
  • Field Details

    • client

      private final net.minecraft.client.Minecraft client
    • width

      protected final int width
    • height

      protected final int height
    • top

      protected final int top
    • bottom

      protected final int bottom
    • left

      protected final int left
    • scrolling

      private boolean scrolling
    • scrollDistance

      protected float scrollDistance
    • captureMouse

      protected boolean captureMouse
    • border

      protected final int border
    • barWidth

      private final int barWidth
    • barLeft

      private final int barLeft
    • barBgColor

      private final int barBgColor
    • barColor

      private final int barColor
    • barBorderColor

      private final int barBorderColor
  • Constructor Details

    • ScrollPanel

      public ScrollPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left)
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
    • ScrollPanel

      public ScrollPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left, int border)
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
      border - the size of the border
    • ScrollPanel

      public ScrollPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left, int border, int barWidth)
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
      border - the size of the border
      barWidth - the width of the scroll bar
    • ScrollPanel

      public ScrollPanel(net.minecraft.client.Minecraft client, int width, int height, int top, int left, int border, int barWidth, int barBgColor, int barColor, int barBorderColor)
      Base constructor
      Parameters:
      client - the minecraft instance this ScrollPanel should use
      width - the width
      height - the height
      top - the offset from the top (y coord)
      left - the offset from the left (x coord)
      border - the size of the border
      barWidth - the width of the scroll bar
      barBgColor - the color for the scroll bar background
      barColor - the color for the scroll bar handle
      barBorderColor - the border color for the scroll bar handle
  • Method Details

    • getContentHeight

      protected abstract int getContentHeight()
    • drawBackground

      protected void drawBackground(net.minecraft.client.gui.GuiGraphics guiGraphics, float partialTick)
      Draws the background of the scroll panel. This runs AFTER Scissors are enabled.
    • drawPanel

      protected abstract void drawPanel(net.minecraft.client.gui.GuiGraphics guiGraphics, int entryRight, int relativeY, int mouseX, int mouseY)
      Draw anything special on the screen. Scissor (RenderSystem.enableScissor) is enabled for anything that is rendered outside the view box. Do not mess with Scissor unless you support this.
    • clickPanel

      protected boolean clickPanel(double mouseX, double mouseY, int button)
    • getMaxScroll

      private int getMaxScroll()
    • applyScrollLimits

      private void applyScrollLimits()
    • mouseScrolled

      public boolean mouseScrolled(double p_94686_, double p_94687_, double p_94688_, double p_294830_)
      Specified by:
      mouseScrolled in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseScrolled in interface net.minecraft.client.gui.components.events.GuiEventListener
    • getScrollAmount

      protected int getScrollAmount()
    • isMouseOver

      public boolean isMouseOver(double mouseX, double mouseY)
      Specified by:
      isMouseOver in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseReleased

      public boolean mouseReleased(double mouseX, double mouseY, int button)
      Specified by:
      mouseReleased in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseReleased in interface net.minecraft.client.gui.components.events.GuiEventListener
    • getBarHeight

      private int getBarHeight()
    • mouseDragged

      public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
      Specified by:
      mouseDragged in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseDragged in interface net.minecraft.client.gui.components.events.GuiEventListener
    • render

      public void render(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
      Specified by:
      render in interface net.minecraft.client.gui.components.Renderable
    • drawGradientRect

      protected void drawGradientRect(net.minecraft.client.gui.GuiGraphics guiGraphics, int left, int top, int right, int bottom, int color1, int color2)
    • children

      public List<? extends net.minecraft.client.gui.components.events.GuiEventListener> children()
      Specified by:
      children in interface net.minecraft.client.gui.components.events.ContainerEventHandler