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 WidgetSprites
private static final int
private static final int
private double
private static final ResourceLocation
private boolean
Fields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, width
Fields 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 int
protected abstract int
protected int
private int
protected int
boolean
keyPressed
(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.boolean
mouseClicked
(double pMouseX, double pMouseY, int pButton) Called when a mouse button is clicked within the GUI element.boolean
mouseDragged
(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Called when the mouse is dragged within the GUI element.boolean
mouseReleased
(double pMouseX, double pMouseY, int pButton) Called when a mouse button is released within the GUI element.boolean
mouseScrolled
(double pMouseX, double pMouseY, double pScrollX, double pScrollY) protected void
renderBackground
(GuiGraphics pGuiGraphics) protected void
renderBorder
(GuiGraphics pGuiGraphics, int pX, int pY, int pWidth, int pHeight) protected abstract void
renderContents
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) protected void
renderDecorations
(GuiGraphics pGuiGraphics) private void
renderScrollBar
(GuiGraphics pGuiGraphics) void
renderWidget
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) protected double
protected boolean
int
protected abstract double
protected void
setScrollAmount
(double pScrollAmount) protected int
protected boolean
withinContentAreaPoint
(double pX, double pY) protected boolean
withinContentAreaTopBottom
(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, 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, getRectangle, isFocused, isMouseOver, keyReleased, mouseMoved, nextFocusPath, setFocused
Methods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClick
Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
Methods inherited from interface net.minecraft.client.gui.components.Renderable
render
Methods 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:AbstractWidget
Called when a mouse button is clicked within the GUI element.- Specified by:
mouseClicked
in interfaceGuiEventListener
- Overrides:
mouseClicked
in classAbstractWidget
- Parameters:
pMouseX
- the X coordinate of the mouse.pMouseY
- the Y coordinate of the mouse.pButton
- the button that was clicked.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseReleased
public boolean mouseReleased(double pMouseX, double pMouseY, int pButton) Description copied from class:AbstractWidget
Called when a mouse button is released within the GUI element.- Specified by:
mouseReleased
in interfaceGuiEventListener
- Overrides:
mouseReleased
in classAbstractWidget
- Parameters:
pMouseX
- the X coordinate of the mouse.pMouseY
- the Y coordinate of the mouse.pButton
- the button that was released.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseDragged
public boolean mouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Description copied from class:AbstractWidget
Called when the mouse is dragged within the GUI element.- Specified by:
mouseDragged
in interfaceGuiEventListener
- Overrides:
mouseDragged
in 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:
true
if the event is consumed,false
otherwise.
-
mouseScrolled
public boolean mouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY) - Specified by:
mouseScrolled
in interfaceGuiEventListener
-
keyPressed
public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.- Specified by:
keyPressed
in interfaceGuiEventListener
- Parameters:
pKeyCode
- the key code of the pressed key.pScanCode
- the scan code of the pressed key.pModifiers
- the keyboard modifiers.- Returns:
true
if the event is consumed,false
otherwise.
-
renderWidget
- Specified by:
renderWidget
in 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)
-