Package net.minecraft.client.gui.widget
Class ScrollableWidget
java.lang.Object
net.minecraft.client.gui.widget.ClickableWidget
net.minecraft.client.gui.widget.ScrollableWidget
- All Implemented Interfaces:
Drawable,Element,Narratable,Navigable,Selectable,Widget
- Direct Known Subclasses:
EditBoxWidget,ScrollableTextWidget,TelemetryEventWidget
@Environment(CLIENT)
public abstract class ScrollableWidget
extends ClickableWidget
implements Drawable, Element
A widget that can be focused and vertically scrolled.
- Mappings:
Namespace Name named net/minecraft/client/gui/widget/ScrollableWidgetintermediary net/minecraft/class_7528official fha
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.Selectable
Selectable.SelectionType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate booleanprivate static final Identifierprivate static final intprivate doubleprivate static final ButtonTexturesFields inherited from class net.minecraft.client.gui.widget.ClickableWidget
active, alpha, height, hovered, visible, widthFields inherited from interface net.minecraft.client.gui.Element
MAX_DOUBLE_CLICK_INTERVAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddrawBox(DrawContext context) Draws the box that the contents are rendered over, including its borders.protected voiddrawBox(DrawContext context, int x, int y, int width, int height) private voiddrawScrollbar(DrawContext context) protected abstract intReturns the total height of the contents.private intprotected abstract doubleprotected intprotected intprotected intprivate intintprotected doubleprotected booleanisVisible(int top, int bottom) protected booleanisWithinBounds(double mouseX, double mouseY) booleankeyPressed(int keyCode, int scanCode, int modifiers) Callback for when a key down event has been captured.booleanmouseClicked(double mouseX, double mouseY, int button) Callback for when a mouse button down event has been captured.booleanmouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) Callback for when a mouse button drag event has been captured.booleanmouseReleased(double mouseX, double mouseY, int button) Callback for when a mouse button release event has been captured.booleanmouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) Callback for when a mouse button scroll event has been captured.protected booleanReturns whether the contents overflow and needs a scrollbar.protected abstract voidrenderContents(DrawContext context, int mouseX, int mouseY, float delta) Renders the scrolled contents.protected voidrenderOverlay(DrawContext context) Renders overlays that are not scrolled but part of the widget.voidrenderWidget(DrawContext context, int mouseX, int mouseY, float delta) protected voidsetScrollY(double scrollY) Methods inherited from class net.minecraft.client.gui.widget.ClickableWidget
appendClickableNarrations, appendDefaultNarrations, appendNarrations, clicked, drawScrollableText, drawScrollableText, drawScrollableText, forEachChild, getBottom, getHeight, getMessage, getNarrationMessage, getNarrationMessage, getNavigationFocus, getNavigationOrder, getNavigationPath, getRight, getTooltip, getType, getWidth, getX, getY, isFocused, isHovered, isMouseOver, isNarratable, isSelected, isValidClickButton, onClick, onDrag, onRelease, playDownSound, render, setAlpha, setDimensions, setDimensionsAndPosition, setFocused, setHeight, setMessage, setNavigationOrder, setTooltip, setTooltipDelay, setWidth, setX, setYMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.Element
charTyped, getFocusedPath, getNavigationFocus, getNavigationPath, isFocused, isMouseOver, keyReleased, mouseMoved, setFocusedMethods inherited from interface net.minecraft.client.gui.navigation.Navigable
getNavigationOrderMethods inherited from interface net.minecraft.client.gui.widget.Widget
setPosition
-
Field Details
-
TEXT_FIELD_TEXTURES
- Mappings:
Namespace Name Mixin selector named TEXT_FIELD_TEXTURESLnet/minecraft/client/gui/widget/ScrollableWidget;TEXT_FIELD_TEXTURES:Lnet/minecraft/client/gui/screen/ButtonTextures;intermediary field_45905Lnet/minecraft/class_7528;field_45905:Lnet/minecraft/class_8666;official aLfha;a:Lfit;
-
SCROLLER_TEXTURE
- Mappings:
Namespace Name Mixin selector named SCROLLER_TEXTURELnet/minecraft/client/gui/widget/ScrollableWidget;SCROLLER_TEXTURE:Lnet/minecraft/util/Identifier;intermediary field_45906Lnet/minecraft/class_7528;field_45906:Lnet/minecraft/class_2960;official bLfha;b:Lalf;
-
PADDING
private static final int PADDING- See Also:
- Mappings:
Namespace Name Mixin selector named PADDINGLnet/minecraft/client/gui/widget/ScrollableWidget;PADDING:Iintermediary field_39496Lnet/minecraft/class_7528;field_39496:Iofficial cLfha;c:I
-
SCROLLER_WIDTH
private static final int SCROLLER_WIDTH- See Also:
- Mappings:
Namespace Name Mixin selector named SCROLLER_WIDTHLnet/minecraft/client/gui/widget/ScrollableWidget;SCROLLER_WIDTH:Iintermediary field_45907Lnet/minecraft/class_7528;field_45907:Iofficial dLfha;d:I
-
scrollY
private double scrollY- Mappings:
Namespace Name Mixin selector named scrollYLnet/minecraft/client/gui/widget/ScrollableWidget;scrollY:Dintermediary field_39497Lnet/minecraft/class_7528;field_39497:Dofficial eLfha;e:D
-
scrollbarDragged
private boolean scrollbarDragged- Mappings:
Namespace Name Mixin selector named scrollbarDraggedLnet/minecraft/client/gui/widget/ScrollableWidget;scrollbarDragged:Zintermediary field_39498Lnet/minecraft/class_7528;field_39498:Zofficial fLfha;f:Z
-
-
Constructor Details
-
ScrollableWidget
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/client/gui/widget/ClickableWidget;<init>(IIIILnet/minecraft/text/Text;)Vintermediary <init>Lnet/minecraft/class_339;<init>(IIIILnet/minecraft/class_2561;)Vofficial <init>Lfhe;<init>(IIIILxp;)V
-
-
Method Details
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) Callback for when a mouse button down event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseClickedin interfaceElement- Overrides:
mouseClickedin classClickableWidget- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mousebutton- the mouse button number- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named mouseClickedLnet/minecraft/client/gui/Element;mouseClicked(DDI)Zintermediary method_25402Lnet/minecraft/class_364;method_25402(DDI)Zofficial aLfjc;a(DDI)Z
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) Callback for when a mouse button release event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseReleasedin interfaceElement- Overrides:
mouseReleasedin classClickableWidget- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mousebutton- the mouse button number- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named mouseReleasedLnet/minecraft/client/gui/Element;mouseReleased(DDI)Zintermediary method_25406Lnet/minecraft/class_364;method_25406(DDI)Zofficial bLfjc;b(DDI)Z
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) Callback for when a mouse button drag event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseDraggedin interfaceElement- Overrides:
mouseDraggedin classClickableWidget- Parameters:
mouseX- the current X coordinate of the mousemouseY- the current Y coordinate of the mousebutton- the mouse button numberdeltaX- the difference of the current X with the previous X coordinatedeltaY- the difference of the current Y with the previous Y coordinate- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named mouseDraggedLnet/minecraft/client/gui/Element;mouseDragged(DDIDD)Zintermediary method_25403Lnet/minecraft/class_364;method_25403(DDIDD)Zofficial aLfjc;a(DDIDD)Z
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) Callback for when a mouse button scroll event has been captured.- Specified by:
mouseScrolledin interfaceElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mousehorizontalAmount- the horizontal scroll amountverticalAmount- the vertical scroll amount- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named mouseScrolledLnet/minecraft/client/gui/Element;mouseScrolled(DDDD)Zintermediary method_25401Lnet/minecraft/class_364;method_25401(DDDD)Zofficial aLfjc;a(DDDD)Z
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) Callback for when a key down event has been captured. The key code is identified by the constants inGLFWclass.- Specified by:
keyPressedin interfaceElement- Parameters:
keyCode- the named key code of the event as described in theGLFWclassscanCode- the unique/platform-specific scan code of the keyboard inputmodifiers- a GLFW bitfield describing the modifier keys that are held down (see GLFW Modifier key flags)- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named keyPressedLnet/minecraft/client/gui/Element;keyPressed(III)Zintermediary method_25404Lnet/minecraft/class_364;method_25404(III)Zofficial aLfjc;a(III)Z
-
renderWidget
- Specified by:
renderWidgetin classClickableWidget- Mappings:
Namespace Name Mixin selector named renderWidgetLnet/minecraft/client/gui/widget/ClickableWidget;renderWidget(Lnet/minecraft/client/gui/DrawContext;IIF)Vintermediary method_48579Lnet/minecraft/class_339;method_48579(Lnet/minecraft/class_332;IIF)Vofficial bLfhe;b(Lfgt;IIF)V
-
getScrollbarThumbHeight
private int getScrollbarThumbHeight()- Mappings:
Namespace Name Mixin selector named getScrollbarThumbHeightLnet/minecraft/client/gui/widget/ScrollableWidget;getScrollbarThumbHeight()Iintermediary method_44394Lnet/minecraft/class_7528;method_44394()Iofficial jLfha;j()I
-
renderOverlay
Renders overlays that are not scrolled but part of the widget.This renders the scrollbar by default. Subclasses can override this to render other overlays, but
supercall is necessary to make sure the scrollbar renders when it should.- Mappings:
Namespace Name Mixin selector named renderOverlayLnet/minecraft/client/gui/widget/ScrollableWidget;renderOverlay(Lnet/minecraft/client/gui/DrawContext;)Vintermediary method_44384Lnet/minecraft/class_7528;method_44384(Lnet/minecraft/class_332;)Vofficial aLfha;a(Lfgt;)V
-
getPadding
protected int getPadding()- Mappings:
Namespace Name Mixin selector named getPaddingLnet/minecraft/client/gui/widget/ScrollableWidget;getPadding()Iintermediary method_44381Lnet/minecraft/class_7528;method_44381()Iofficial aLfha;a()I
-
getPaddingDoubled
protected int getPaddingDoubled()- Mappings:
Namespace Name Mixin selector named getPaddingDoubledLnet/minecraft/client/gui/widget/ScrollableWidget;getPaddingDoubled()Iintermediary method_44385Lnet/minecraft/class_7528;method_44385()Iofficial bLfha;b()I
-
getScrollY
protected double getScrollY()- Mappings:
Namespace Name Mixin selector named getScrollYLnet/minecraft/client/gui/widget/ScrollableWidget;getScrollY()Dintermediary method_44387Lnet/minecraft/class_7528;method_44387()Dofficial cLfha;c()D
-
setScrollY
protected void setScrollY(double scrollY) - Mappings:
Namespace Name Mixin selector named setScrollYLnet/minecraft/client/gui/widget/ScrollableWidget;setScrollY(D)Vintermediary method_44382Lnet/minecraft/class_7528;method_44382(D)Vofficial aLfha;a(D)V
-
getMaxScrollY
protected int getMaxScrollY()- Mappings:
Namespace Name Mixin selector named getMaxScrollYLnet/minecraft/client/gui/widget/ScrollableWidget;getMaxScrollY()Iintermediary method_44390Lnet/minecraft/class_7528;method_44390()Iofficial dLfha;d()I
-
getContentsHeightWithPadding
private int getContentsHeightWithPadding()- Mappings:
Namespace Name Mixin selector named getContentsHeightWithPaddingLnet/minecraft/client/gui/widget/ScrollableWidget;getContentsHeightWithPadding()Iintermediary method_44395Lnet/minecraft/class_7528;method_44395()Iofficial kLfha;k()I
-
drawBox
Draws the box that the contents are rendered over, including its borders.- Mappings:
Namespace Name Mixin selector named drawBoxLnet/minecraft/client/gui/widget/ScrollableWidget;drawBox(Lnet/minecraft/client/gui/DrawContext;)Vintermediary method_44386Lnet/minecraft/class_7528;method_44386(Lnet/minecraft/class_332;)Vofficial bLfha;b(Lfgt;)V
-
drawBox
- Mappings:
Namespace Name Mixin selector named drawBoxLnet/minecraft/client/gui/widget/ScrollableWidget;drawBox(Lnet/minecraft/client/gui/DrawContext;IIII)Vintermediary method_52233Lnet/minecraft/class_7528;method_52233(Lnet/minecraft/class_332;IIII)Vofficial aLfha;a(Lfgt;IIII)V
-
drawScrollbar
- Mappings:
Namespace Name Mixin selector named drawScrollbarLnet/minecraft/client/gui/widget/ScrollableWidget;drawScrollbar(Lnet/minecraft/client/gui/DrawContext;)Vintermediary method_44396Lnet/minecraft/class_7528;method_44396(Lnet/minecraft/class_332;)Vofficial cLfha;c(Lfgt;)V
-
isVisible
protected boolean isVisible(int top, int bottom) - Mappings:
Namespace Name Mixin selector named isVisibleLnet/minecraft/client/gui/widget/ScrollableWidget;isVisible(II)Zintermediary method_44383Lnet/minecraft/class_7528;method_44383(II)Zofficial aLfha;a(II)Z
-
isWithinBounds
protected boolean isWithinBounds(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector named isWithinBoundsLnet/minecraft/client/gui/widget/ScrollableWidget;isWithinBounds(DD)Zintermediary method_44388Lnet/minecraft/class_7528;method_44388(DD)Zofficial bLfha;b(DD)Z
-
overflows
protected boolean overflows()Returns whether the contents overflow and needs a scrollbar.- Returns:
- whether the contents overflow and needs a scrollbar
- Mappings:
Namespace Name Mixin selector named overflowsLnet/minecraft/client/gui/widget/ScrollableWidget;overflows()Zintermediary method_44392Lnet/minecraft/class_7528;method_44392()Zofficial eLfha;e()Z
-
getScrollerWidth
public int getScrollerWidth()- Mappings:
Namespace Name Mixin selector named getScrollerWidthLnet/minecraft/client/gui/widget/ScrollableWidget;getScrollerWidth()Iintermediary method_53532Lnet/minecraft/class_7528;method_53532()Iofficial fLfha;f()I
-
getContentsHeight
protected abstract int getContentsHeight()Returns the total height of the contents.- Returns:
- the total height of the contents
- Mappings:
Namespace Name Mixin selector named getContentsHeightLnet/minecraft/client/gui/widget/ScrollableWidget;getContentsHeight()Iintermediary method_44391Lnet/minecraft/class_7528;method_44391()Iofficial hLfha;h()I
-
getDeltaYPerScroll
protected abstract double getDeltaYPerScroll()- Mappings:
Namespace Name Mixin selector named getDeltaYPerScrollLnet/minecraft/client/gui/widget/ScrollableWidget;getDeltaYPerScroll()Dintermediary method_44393Lnet/minecraft/class_7528;method_44393()Dofficial iLfha;i()D
-
renderContents
Renders the scrolled contents. Subclasses must override this. The rendered contents may overflow; the caller should trim those usingDrawContext.enableScissor(int, int, int, int).- Mappings:
Namespace Name Mixin selector named renderContentsLnet/minecraft/client/gui/widget/ScrollableWidget;renderContents(Lnet/minecraft/client/gui/DrawContext;IIF)Vintermediary method_44389Lnet/minecraft/class_7528;method_44389(Lnet/minecraft/class_332;IIF)Vofficial cLfha;c(Lfgt;IIF)V
-