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,TelemetryEventWidget
@Environment(CLIENT)
public abstract class ScrollableWidget
extends ClickableWidget
implements Drawable, Element
A widget that can be focused and vertically scrolled.
- Mappings:
Namespace Name official eotintermediary net/minecraft/class_7528named net/minecraft/client/gui/widget/ScrollableWidget
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.Selectable
Selectable.SelectionType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate booleanprivate doubleprivate static final intFields inherited from class net.minecraft.client.gui.widget.ClickableWidget
ACCESSIBILITY_TEXTURE, active, alpha, height, hovered, visible, WIDGETS_TEXTURE, widthFields inherited from interface net.minecraft.client.gui.Element
MAX_DOUBLE_CLICK_INTERVAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddrawBox(DrawContext context) Draws the box that the contents are rendered over, including its borders.private voiddrawScrollbar(DrawContext context) protected abstract intReturns the total height of the contents.private intprotected abstract doubleprotected intprotected intprotected intprivate intprotected 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 amount) Callback for when a mouse button scroll event has been captured.protected abstract booleanReturns whether the contents overflow and needs a scrollbar.voidrenderButton(DrawContext context, int mouseX, int mouseY, float delta) 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.protected voidsetScrollY(double scrollY) Methods inherited from class net.minecraft.client.gui.widget.ClickableWidget
appendClickableNarrations, appendDefaultNarrations, appendNarrations, clicked, drawScrollableText, drawScrollableText, drawTexture, forEachChild, getHeight, getMessage, getNarrationMessage, getNarrationMessage, getNavigationFocus, getNavigationOrder, getNavigationPath, getTooltip, getTooltipPositioner, getType, getWidth, getX, getY, isFocused, isHovered, isMouseOver, isNarratable, isSelected, isValidClickButton, onClick, onDrag, onRelease, playDownSound, render, setAlpha, setFocused, 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
-
FOCUSED_BORDER_COLOR
private static final int FOCUSED_BORDER_COLOR- See Also:
- Mappings:
Namespace Name Mixin selector official aLeot;a:Iintermediary field_39493Lnet/minecraft/class_7528;field_39493:Inamed FOCUSED_BORDER_COLORLnet/minecraft/client/gui/widget/ScrollableWidget;FOCUSED_BORDER_COLOR:I
-
UNFOCUSED_BORDER_COLOR
private static final int UNFOCUSED_BORDER_COLOR- See Also:
- Mappings:
Namespace Name Mixin selector official bLeot;b:Iintermediary field_39494Lnet/minecraft/class_7528;field_39494:Inamed UNFOCUSED_BORDER_COLORLnet/minecraft/client/gui/widget/ScrollableWidget;UNFOCUSED_BORDER_COLOR:I
-
BOX_COLOR
private static final int BOX_COLOR- See Also:
- Mappings:
Namespace Name Mixin selector official cLeot;c:Iintermediary field_39495Lnet/minecraft/class_7528;field_39495:Inamed BOX_COLORLnet/minecraft/client/gui/widget/ScrollableWidget;BOX_COLOR:I
-
PADDING
private static final int PADDING- See Also:
- Mappings:
Namespace Name Mixin selector official dLeot;d:Iintermediary field_39496Lnet/minecraft/class_7528;field_39496:Inamed PADDINGLnet/minecraft/client/gui/widget/ScrollableWidget;PADDING:I
-
scrollY
private double scrollY- Mappings:
Namespace Name Mixin selector official eLeot;e:Dintermediary field_39497Lnet/minecraft/class_7528;field_39497:Dnamed scrollYLnet/minecraft/client/gui/widget/ScrollableWidget;scrollY:D
-
scrollbarDragged
private boolean scrollbarDragged- Mappings:
Namespace Name Mixin selector official fLeot;f:Zintermediary field_39498Lnet/minecraft/class_7528;field_39498:Znamed scrollbarDraggedLnet/minecraft/client/gui/widget/ScrollableWidget;scrollbarDragged:Z
-
-
Constructor Details
-
ScrollableWidget
- Mappings:
Namespace Name Mixin selector official <init>Leox;<init>(IIIILsw;)Vintermediary <init>Lnet/minecraft/class_339;<init>(IIIILnet/minecraft/class_2561;)Vnamed <init>Lnet/minecraft/client/gui/widget/ClickableWidget;<init>(IIIILnet/minecraft/text/Text;)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 official aLeqk;a(DDI)Zintermediary method_25402Lnet/minecraft/class_364;method_25402(DDI)Znamed mouseClickedLnet/minecraft/client/gui/Element;mouseClicked(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 official bLeqk;b(DDI)Zintermediary method_25406Lnet/minecraft/class_364;method_25406(DDI)Znamed mouseReleasedLnet/minecraft/client/gui/Element;mouseReleased(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 official aLeqk;a(DDIDD)Zintermediary method_25403Lnet/minecraft/class_364;method_25403(DDIDD)Znamed mouseDraggedLnet/minecraft/client/gui/Element;mouseDragged(DDIDD)Z
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double amount) 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 mouseamount- value is< 0if scrolled down,> 0if scrolled up- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector official aLeqk;a(DDD)Zintermediary method_25401Lnet/minecraft/class_364;method_25401(DDD)Znamed mouseScrolledLnet/minecraft/client/gui/Element;mouseScrolled(DDD)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 official aLeqk;a(III)Zintermediary method_25404Lnet/minecraft/class_364;method_25404(III)Znamed keyPressedLnet/minecraft/client/gui/Element;keyPressed(III)Z
-
renderButton
- Specified by:
renderButtonin classClickableWidget- Mappings:
Namespace Name Mixin selector official bLeox;b(Leop;IIF)Vintermediary method_48579Lnet/minecraft/class_339;method_48579(Lnet/minecraft/class_332;IIF)Vnamed renderButtonLnet/minecraft/client/gui/widget/ClickableWidget;renderButton(Lnet/minecraft/client/gui/DrawContext;IIF)V
-
getScrollbarThumbHeight
private int getScrollbarThumbHeight()- Mappings:
Namespace Name Mixin selector official vLeot;v()Iintermediary method_44394Lnet/minecraft/class_7528;method_44394()Inamed getScrollbarThumbHeightLnet/minecraft/client/gui/widget/ScrollableWidget;getScrollbarThumbHeight()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 official aLeot;a(Leop;)Vintermediary method_44384Lnet/minecraft/class_7528;method_44384(Lnet/minecraft/class_332;)Vnamed renderOverlayLnet/minecraft/client/gui/widget/ScrollableWidget;renderOverlay(Lnet/minecraft/client/gui/DrawContext;)V
-
getPadding
protected int getPadding()- Mappings:
Namespace Name Mixin selector official aLeot;a()Iintermediary method_44381Lnet/minecraft/class_7528;method_44381()Inamed getPaddingLnet/minecraft/client/gui/widget/ScrollableWidget;getPadding()I
-
getPaddingDoubled
protected int getPaddingDoubled()- Mappings:
Namespace Name Mixin selector official bLeot;b()Iintermediary method_44385Lnet/minecraft/class_7528;method_44385()Inamed getPaddingDoubledLnet/minecraft/client/gui/widget/ScrollableWidget;getPaddingDoubled()I
-
getScrollY
protected double getScrollY()- Mappings:
Namespace Name Mixin selector official cLeot;c()Dintermediary method_44387Lnet/minecraft/class_7528;method_44387()Dnamed getScrollYLnet/minecraft/client/gui/widget/ScrollableWidget;getScrollY()D
-
setScrollY
protected void setScrollY(double scrollY) - Mappings:
Namespace Name Mixin selector official aLeot;a(D)Vintermediary method_44382Lnet/minecraft/class_7528;method_44382(D)Vnamed setScrollYLnet/minecraft/client/gui/widget/ScrollableWidget;setScrollY(D)V
-
getMaxScrollY
protected int getMaxScrollY()- Mappings:
Namespace Name Mixin selector official dLeot;d()Iintermediary method_44390Lnet/minecraft/class_7528;method_44390()Inamed getMaxScrollYLnet/minecraft/client/gui/widget/ScrollableWidget;getMaxScrollY()I
-
getContentsHeightWithPadding
private int getContentsHeightWithPadding()- Mappings:
Namespace Name Mixin selector official wLeot;w()Iintermediary method_44395Lnet/minecraft/class_7528;method_44395()Inamed getContentsHeightWithPaddingLnet/minecraft/client/gui/widget/ScrollableWidget;getContentsHeightWithPadding()I
-
drawBox
Draws the box that the contents are rendered over, including its borders.- Mappings:
Namespace Name Mixin selector official bLeot;b(Leop;)Vintermediary method_44386Lnet/minecraft/class_7528;method_44386(Lnet/minecraft/class_332;)Vnamed drawBoxLnet/minecraft/client/gui/widget/ScrollableWidget;drawBox(Lnet/minecraft/client/gui/DrawContext;)V
-
drawScrollbar
- Mappings:
Namespace Name Mixin selector official cLeot;c(Leop;)Vintermediary method_44396Lnet/minecraft/class_7528;method_44396(Lnet/minecraft/class_332;)Vnamed drawScrollbarLnet/minecraft/client/gui/widget/ScrollableWidget;drawScrollbar(Lnet/minecraft/client/gui/DrawContext;)V
-
isVisible
protected boolean isVisible(int top, int bottom) - Mappings:
Namespace Name Mixin selector official aLeot;a(II)Zintermediary method_44383Lnet/minecraft/class_7528;method_44383(II)Znamed isVisibleLnet/minecraft/client/gui/widget/ScrollableWidget;isVisible(II)Z
-
isWithinBounds
protected boolean isWithinBounds(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector official cLeot;c(DD)Zintermediary method_44388Lnet/minecraft/class_7528;method_44388(DD)Znamed isWithinBoundsLnet/minecraft/client/gui/widget/ScrollableWidget;isWithinBounds(DD)Z
-
getContentsHeight
protected abstract int getContentsHeight()Returns the total height of the contents.- Returns:
- the total height of the contents
- Mappings:
Namespace Name Mixin selector official eLeot;e()Iintermediary method_44391Lnet/minecraft/class_7528;method_44391()Inamed getContentsHeightLnet/minecraft/client/gui/widget/ScrollableWidget;getContentsHeight()I
-
overflows
protected abstract 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 official fLeot;f()Zintermediary method_44392Lnet/minecraft/class_7528;method_44392()Znamed overflowsLnet/minecraft/client/gui/widget/ScrollableWidget;overflows()Z
-
getDeltaYPerScroll
protected abstract double getDeltaYPerScroll()- Mappings:
Namespace Name Mixin selector official gLeot;g()Dintermediary method_44393Lnet/minecraft/class_7528;method_44393()Dnamed getDeltaYPerScrollLnet/minecraft/client/gui/widget/ScrollableWidget;getDeltaYPerScroll()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 official cLeot;c(Leop;IIF)Vintermediary method_44389Lnet/minecraft/class_7528;method_44389(Lnet/minecraft/class_332;IIF)Vnamed renderContentsLnet/minecraft/client/gui/widget/ScrollableWidget;renderContents(Lnet/minecraft/client/gui/DrawContext;IIF)V
-