Class AbstractScroller
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
com.portingdeadmods.portingdeadlibs.api.client.screens.widgets.AbstractScroller
- 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,net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
public abstract class AbstractScroller
extends net.minecraft.client.gui.components.AbstractWidget
-
Nested Class Summary
Nested ClassesNested 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
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, widthFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
ConstructorsConstructorDescriptionAbstractScroller(PDLAbstractContainerScreen<?> parentScreen, int x, int y, int width, int height, int trackLength, AbstractScroller.Mode mode, net.minecraft.resources.ResourceLocation sprite) -
Method Summary
Modifier and TypeMethodDescriptionbooleanclicked(double mouseX, double mouseY) abstract intintintabstract intvoidonRelease(double mouseX, double mouseY) abstract voidonScroll()Called when the scroller is scrolledvoidrenderWidget(net.minecraft.client.gui.GuiGraphics guiGraphics) voidrenderWidget(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) voidupdatePos(double mouseX, double mouseY) protected voidupdateWidgetNarration(net.minecraft.client.gui.narration.NarrationElementOutput narrationElementOutput) Methods inherited from class net.minecraft.client.gui.components.AbstractWidget
clearFGColor, createNarrationMessage, defaultButtonNarrationText, getBottom, getFGColor, getHeight, getMessage, getRectangle, getRight, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrationPriority, nextFocusPath, onClick, onDrag, playDownSound, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setFocused, setHeight, setMessage, setRectangle, setSize, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
charTyped, getCurrentFocusPath, keyPressed, keyReleased, mouseMoved, mouseScrolledMethods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClickMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
-
Constructor Details
-
AbstractScroller
public AbstractScroller(PDLAbstractContainerScreen<?> parentScreen, int x, int y, int width, int height, int trackLength, AbstractScroller.Mode mode, net.minecraft.resources.ResourceLocation sprite) - Parameters:
parentScreen- The parent screen of the scrollerx- X position of the Top-Left corner of the scroller texturey- Y position of the Top-Left corner of the scroller texturewidth- Width of the scroller textureheight- Height of the scroller texturetrackLength- The track length of the scrollermode- Orientation of the scrollersprite- The texture of the scroller - It's recommended the texture to have an odd size (centerable to 1 px. Width for Horizontal - Horizontal for Vertical)
-
-
Method Details
-
renderWidget
public void renderWidget(net.minecraft.client.gui.GuiGraphics guiGraphics) -
renderWidget
public void renderWidget(net.minecraft.client.gui.GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) - Specified by:
renderWidgetin classnet.minecraft.client.gui.components.AbstractWidget
-
updateWidgetNarration
protected void updateWidgetNarration(net.minecraft.client.gui.narration.NarrationElementOutput narrationElementOutput) - Specified by:
updateWidgetNarrationin classnet.minecraft.client.gui.components.AbstractWidget
-
updatePos
public void updatePos(double mouseX, double mouseY) -
clicked
public boolean clicked(double mouseX, double mouseY) - Overrides:
clickedin classnet.minecraft.client.gui.components.AbstractWidget
-
onRelease
public void onRelease(double mouseX, double mouseY) - Overrides:
onReleasein classnet.minecraft.client.gui.components.AbstractWidget
-
getScrollOffset
public int getScrollOffset() -
getContentLength
public abstract int getContentLength()- Returns:
- The total length of content that could be seen
-
getVisibleContentLength
public abstract int getVisibleContentLength()- Returns:
- The total length of the content that is visible at a moment in time
-
onScroll
public abstract void onScroll()Called when the scroller is scrolled -
getScrollableLength
public int getScrollableLength()
-