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 x, int y, int width, int height, Component message) -
Method Summary
Modifier and TypeMethodDescriptionprivate int
protected abstract int
protected int
private int
protected int
boolean
keyPressed
(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.boolean
mouseClicked
(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.boolean
mouseDragged
(double mouseX, double mouseY, int button, double dragX, double dragY) Called when the mouse is dragged within the GUI element.boolean
mouseReleased
(double mouseX, double mouseY, int button) Called when a mouse button is released within the GUI element.boolean
mouseScrolled
(double mouseX, double mouseY, double scrollX, double scrollY) protected void
renderBackground
(GuiGraphics guiGraphics) protected void
renderBorder
(GuiGraphics guiGraphics, int x, int y, int width, int height) protected abstract void
renderContents
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected void
renderDecorations
(GuiGraphics guiGraphics) private void
renderScrollBar
(GuiGraphics guiGraphics) void
renderWidget
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected double
protected boolean
int
protected abstract double
protected void
setScrollAmount
(double scrollAmount) protected int
protected boolean
withinContentAreaPoint
(double x, double y) protected boolean
withinContentAreaTopBottom
(int top, int bottom) 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 mouseX, double mouseY, int button) 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:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was clicked.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) 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:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was released.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) 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:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that is being dragged.dragX
- the X distance of the drag.dragY
- the Y distance of the drag.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) - Specified by:
mouseScrolled
in interfaceGuiEventListener
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.- Specified by:
keyPressed
in interfaceGuiEventListener
- Parameters:
keyCode
- the key code of the pressed key.scanCode
- the scan code of the pressed key.modifiers
- 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 scrollAmount) -
getMaxScrollAmount
protected int getMaxScrollAmount() -
getContentHeight
private int getContentHeight() -
renderBackground
-
renderBorder
-
renderScrollBar
-
withinContentAreaTopBottom
protected boolean withinContentAreaTopBottom(int top, int bottom) -
withinContentAreaPoint
protected boolean withinContentAreaPoint(double x, double y) -
scrollbarVisible
protected boolean scrollbarVisible() -
scrollbarWidth
public int scrollbarWidth() -
getInnerHeight
protected abstract int getInnerHeight() -
scrollRate
protected abstract double scrollRate() -
renderContents
protected abstract void renderContents(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
-