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 x, int y, int width, int height, Component message) -
Method Summary
Modifier and TypeMethodDescriptionprivate intprotected abstract intprotected intprivate intprotected intbooleankeyPressed(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.booleanmouseClicked(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.booleanmouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) Called when the mouse is dragged within the GUI element.booleanmouseReleased(double mouseX, double mouseY, int button) Called when a mouse button is released within the GUI element.booleanmouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) protected voidrenderBackground(GuiGraphics guiGraphics) protected voidrenderBorder(GuiGraphics guiGraphics, int x, int y, int width, int height) protected abstract voidrenderContents(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected voidrenderDecorations(GuiGraphics guiGraphics) private voidrenderScrollBar(GuiGraphics guiGraphics) voidrenderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected doubleprotected booleanintprotected abstract doubleprotected voidsetScrollAmount(double scrollAmount) protected intprotected booleanwithinContentAreaPoint(double x, double y) protected booleanwithinContentAreaTopBottom(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, 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 mouseX, double mouseY, int button) Description copied from class:AbstractWidgetCalled when a mouse button is clicked within the GUI element.- Specified by:
mouseClickedin interfaceGuiEventListener- Overrides:
mouseClickedin classAbstractWidget- Parameters:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.button- the button that was clicked.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) Description copied from class:AbstractWidgetCalled when a mouse button is released within the GUI element.- Specified by:
mouseReleasedin interfaceGuiEventListener- Overrides:
mouseReleasedin classAbstractWidget- Parameters:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.button- the button that was released.- Returns:
trueif the event is consumed,falseotherwise.
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) Description copied from class:AbstractWidgetCalled when the mouse is dragged within the GUI element.- Specified by:
mouseDraggedin interfaceGuiEventListener- Overrides:
mouseDraggedin 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:
trueif the event is consumed,falseotherwise.
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) - Specified by:
mouseScrolledin interfaceGuiEventListener
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.- Specified by:
keyPressedin interfaceGuiEventListener- Parameters:
keyCode- the key code of the pressed key.scanCode- the scan code of the pressed key.modifiers- 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 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)
-