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
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final WidgetSpritesprivate static final intprivate static final intprivate doubleprivate static final ResourceLocationprivate booleanFields 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
ConstructorsConstructorDescriptionAbstractScrollWidget(int pX, int pY, int pWidth, int pHeight, Component pMessage) -
Method Summary
Modifier and TypeMethodDescriptionprivate intprotected abstract intprotected intprivate intprotected intbooleankeyPressed(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.booleanmouseClicked(double pMouseX, double pMouseY, int pButton) Called when a mouse button is clicked within the GUI element.booleanmouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Called when the mouse is dragged within the GUI element.booleanmouseReleased(double pMouseX, double pMouseY, int pButton) Called when a mouse button is released within the GUI element.booleanmouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY) protected voidrenderBackground(GuiGraphics pGuiGraphics) protected voidrenderBorder(GuiGraphics pGuiGraphics, int pX, int pY, int pWidth, int pHeight) protected abstract voidrenderContents(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) protected voidrenderDecorations(GuiGraphics pGuiGraphics) private voidrenderScrollBar(GuiGraphics pGuiGraphics) voidrenderWidget(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) protected doubleprotected booleanintprotected abstract doubleprotected voidsetScrollAmount(double pScrollAmount) protected intprotected booleanwithinContentAreaPoint(double pX, double pY) protected booleanwithinContentAreaTopBottom(int pTop, int pBottom) Methods inherited from class net.minecraft.client.gui.components.AbstractWidget
clearFGColor, clicked, createNarrationMessage, defaultButtonNarrationText, getBottom, getFGColor, getHeight, getMessage, getRectangle, getRight, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, narrationPriority, nextFocusPath, onClick, onDrag, onRelease, playDownSound, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setFocused, setHeight, setMessage, setRectangle, setSize, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, updateWidgetNarration, 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, getRectangle, isFocused, isMouseOver, keyReleased, mouseMoved, nextFocusPath, setFocusedMethods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClickMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPositionMethods inherited from interface net.minecraft.client.gui.components.Renderable
renderMethods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
BACKGROUND_SPRITES
-
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
-
-
Method Details
-
mouseClicked
public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) Description copied from class:AbstractWidgetCalled when a mouse button is clicked within the GUI element.- Specified by:
mouseClickedin interfaceGuiEventListener- Overrides:
mouseClickedin classAbstractWidget- Parameters:
pMouseX- the X coordinate of the mouse.pMouseY- the Y coordinate of the mouse.pButton- the button that was clicked.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseReleased
public boolean mouseReleased(double pMouseX, double pMouseY, int pButton) Description copied from class:AbstractWidgetCalled when a mouse button is released within the GUI element.- Specified by:
mouseReleasedin interfaceGuiEventListener- Overrides:
mouseReleasedin classAbstractWidget- Parameters:
pMouseX- the X coordinate of the mouse.pMouseY- the Y coordinate of the mouse.pButton- the button that was released.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseDragged
public boolean mouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Description copied from class:AbstractWidgetCalled when the mouse is dragged within the GUI element.- Specified by:
mouseDraggedin interfaceGuiEventListener- Overrides:
mouseDraggedin classAbstractWidget- Parameters:
pMouseX- the X coordinate of the mouse.pMouseY- the Y coordinate of the mouse.pButton- the button that is being dragged.pDragX- the X distance of the drag.pDragY- the Y distance of the drag.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseScrolled
public boolean mouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY) - Specified by:
mouseScrolledin interfaceGuiEventListener
-
keyPressed
public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.- Specified by:
keyPressedin interfaceGuiEventListener- Parameters:
pKeyCode- the key code of the pressed key.pScanCode- the scan code of the pressed key.pModifiers- the keyboard modifiers.- Returns:
trueif the event is consumed,falseotherwise.
-
renderWidget
- Specified by:
renderWidgetin classAbstractWidget
-
getScrollBarHeight
private int getScrollBarHeight() -
renderDecorations
-
innerPadding
protected int innerPadding() -
totalInnerPadding
protected int totalInnerPadding() -
scrollAmount
protected double scrollAmount() -
setScrollAmount
protected void setScrollAmount(double pScrollAmount) -
getMaxScrollAmount
protected int getMaxScrollAmount() -
getContentHeight
private int getContentHeight() -
renderBackground
-
renderBorder
-
renderScrollBar
-
withinContentAreaTopBottom
protected boolean withinContentAreaTopBottom(int pTop, int pBottom) -
withinContentAreaPoint
protected boolean withinContentAreaPoint(double pX, double pY) -
scrollbarVisible
protected boolean scrollbarVisible() -
scrollbarWidth
public int scrollbarWidth() -
getInnerHeight
protected abstract int getInnerHeight() -
scrollRate
protected abstract double scrollRate() -
renderContents
protected abstract void renderContents(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
-