Package net.minecraft.client.gui.widget
Class ClickableWidget
java.lang.Object
net.minecraft.client.gui.widget.ClickableWidget
- All Implemented Interfaces:
Drawable,Element,Narratable,Navigable,Selectable,Widget
- Direct Known Subclasses:
AbstractTextWidget,AnimatedResultButton,GameModeSelectionScreen.ButtonWidget,IconWidget,PressableWidget,RecipeAlternativesWidget.AlternativeButtonWidget,ScrollableWidget,SliderWidget,TabButtonWidget,TextFieldWidget,ToggleButtonWidget
@Environment(CLIENT)
public abstract class ClickableWidget
extends Object
implements Drawable, Element, Widget, Selectable
A clickable widget is a GUI element that has many methods to handle different
mouse actions. In addition, it allows a message to be rendered on the widget
and narrated when the widget is selected.
- Mappings:
Namespace Name intermediary net/minecraft/class_339official eoxnamed net/minecraft/client/gui/widget/ClickableWidget
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.Selectable
Selectable.SelectionType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Identifierbooleanprotected floatprivate static final doubleprivate static final doubleprivate booleanprotected intprotected booleanprivate longprivate Textprivate intprivate intbooleanprivate booleanstatic final Identifierprotected intprivate intprivate intFields inherited from interface net.minecraft.client.gui.Element
MAX_DOUBLE_CLICK_INTERVAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidprotected voidfinal voidappendNarrations(NarrationMessageBuilder builder) private voidprotected booleanclicked(double mouseX, double mouseY) protected voiddrawScrollableText(DrawContext context, TextRenderer textRenderer, int xMargin, int color) protected static voiddrawScrollableText(DrawContext context, TextRenderer textRenderer, Text text, int left, int top, int right, int bottom, int color) voiddrawTexture(DrawContext context, Identifier texture, int x, int y, int u, int v, int hoveredVOffset, int width, int height, int textureWidth, int textureHeight) voidforEachChild(Consumer<ClickableWidget> consumer) intprotected MutableTextstatic MutableTextgetNarrationMessage(Text message) intgetNavigationPath(GuiNavigation navigation) protected TooltipPositionergetType()intgetWidth()intgetX()intgetY()booleanbooleanbooleanisMouseOver(double mouseX, double mouseY) Checks if the mouse position is within the bound of the element.booleanbooleanprotected booleanisValidClickButton(int button) 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.voidonClick(double mouseX, double mouseY) protected voidonDrag(double mouseX, double mouseY, double deltaX, double deltaY) voidonRelease(double mouseX, double mouseY) voidplayDownSound(SoundManager soundManager) voidrender(DrawContext context, int mouseX, int mouseY, float delta) abstract voidrenderButton(DrawContext context, int mouseX, int mouseY, float delta) voidsetAlpha(float alpha) voidsetFocused(boolean focused) voidsetMessage(Text message) voidsetNavigationOrder(int navigationOrder) voidsetTooltip(@Nullable Tooltip tooltip) voidsetTooltipDelay(int delay) voidsetWidth(int width) voidsetX(int x) voidsetY(int y) Methods 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, keyPressed, keyReleased, mouseMoved, mouseScrolledMethods inherited from interface net.minecraft.client.gui.widget.Widget
setPosition
-
Field Details
-
WIDGETS_TEXTURE
- Mappings:
Namespace Name Mixin selector intermediary field_22757Lnet/minecraft/class_339;field_22757:Lnet/minecraft/class_2960;official mLeox;m:Lacq;named WIDGETS_TEXTURELnet/minecraft/client/gui/widget/ClickableWidget;WIDGETS_TEXTURE:Lnet/minecraft/util/Identifier;
-
ACCESSIBILITY_TEXTURE
- Mappings:
Namespace Name Mixin selector intermediary field_42117Lnet/minecraft/class_339;field_42117:Lnet/minecraft/class_2960;official nLeox;n:Lacq;named ACCESSIBILITY_TEXTURELnet/minecraft/client/gui/widget/ClickableWidget;ACCESSIBILITY_TEXTURE:Lnet/minecraft/util/Identifier;
-
field_43055
private static final double field_43055- See Also:
- Mappings:
Namespace Name Mixin selector intermediary field_43055Lnet/minecraft/class_339;field_43055:Dofficial aLeox;a:Dnamed field_43055Lnet/minecraft/client/gui/widget/ClickableWidget;field_43055:D
-
field_43056
private static final double field_43056- See Also:
- Mappings:
Namespace Name Mixin selector intermediary field_43056Lnet/minecraft/class_339;field_43056:Dofficial bLeox;b:Dnamed field_43056Lnet/minecraft/client/gui/widget/ClickableWidget;field_43056:D
-
width
protected int width- Mappings:
Namespace Name Mixin selector intermediary field_22758Lnet/minecraft/class_339;field_22758:Iofficial oLeox;o:Inamed widthLnet/minecraft/client/gui/widget/ClickableWidget;width:I
-
height
protected int height- Mappings:
Namespace Name Mixin selector intermediary field_22759Lnet/minecraft/class_339;field_22759:Iofficial pLeox;p:Inamed heightLnet/minecraft/client/gui/widget/ClickableWidget;height:I
-
x
private int x- Mappings:
Namespace Name Mixin selector intermediary field_22760Lnet/minecraft/class_339;field_22760:Iofficial cLeox;c:Inamed xLnet/minecraft/client/gui/widget/ClickableWidget;x:I
-
y
private int y- Mappings:
Namespace Name Mixin selector intermediary field_22761Lnet/minecraft/class_339;field_22761:Iofficial dLeox;d:Inamed yLnet/minecraft/client/gui/widget/ClickableWidget;y:I
-
message
- Mappings:
Namespace Name Mixin selector intermediary field_22754Lnet/minecraft/class_339;field_22754:Lnet/minecraft/class_2561;official eLeox;e:Lsw;named messageLnet/minecraft/client/gui/widget/ClickableWidget;message:Lnet/minecraft/text/Text;
-
hovered
protected boolean hovered- Mappings:
Namespace Name Mixin selector intermediary field_22762Lnet/minecraft/class_339;field_22762:Zofficial qLeox;q:Znamed hoveredLnet/minecraft/client/gui/widget/ClickableWidget;hovered:Z
-
active
public boolean active- Mappings:
Namespace Name Mixin selector intermediary field_22763Lnet/minecraft/class_339;field_22763:Zofficial rLeox;r:Znamed activeLnet/minecraft/client/gui/widget/ClickableWidget;active:Z
-
visible
public boolean visible- Mappings:
Namespace Name Mixin selector intermediary field_22764Lnet/minecraft/class_339;field_22764:Zofficial sLeox;s:Znamed visibleLnet/minecraft/client/gui/widget/ClickableWidget;visible:Z
-
alpha
protected float alpha- Mappings:
Namespace Name Mixin selector intermediary field_22765Lnet/minecraft/class_339;field_22765:Fofficial tLeox;t:Fnamed alphaLnet/minecraft/client/gui/widget/ClickableWidget;alpha:F
-
focused
private boolean focused- Mappings:
Namespace Name Mixin selector intermediary field_22756Lnet/minecraft/class_339;field_22756:Zofficial gLeox;g:Znamed focusedLnet/minecraft/client/gui/widget/ClickableWidget;focused:Z
-
tooltip
- Mappings:
Namespace Name Mixin selector intermediary field_41095Lnet/minecraft/class_339;field_41095:Lnet/minecraft/class_7919;official hLeox;h:Leqg;named tooltipLnet/minecraft/client/gui/widget/ClickableWidget;tooltip:Lnet/minecraft/client/gui/tooltip/Tooltip;
-
tooltipDelay
private int tooltipDelay- Mappings:
Namespace Name Mixin selector intermediary field_41096Lnet/minecraft/class_339;field_41096:Iofficial iLeox;i:Inamed tooltipDelayLnet/minecraft/client/gui/widget/ClickableWidget;tooltipDelay:I
-
lastHoveredTime
private long lastHoveredTime- Mappings:
Namespace Name Mixin selector intermediary field_41097Lnet/minecraft/class_339;field_41097:Jofficial jLeox;j:Jnamed lastHoveredTimeLnet/minecraft/client/gui/widget/ClickableWidget;lastHoveredTime:J
-
wasHovered
private boolean wasHovered- Mappings:
Namespace Name Mixin selector intermediary field_41098Lnet/minecraft/class_339;field_41098:Zofficial kLeox;k:Znamed wasHoveredLnet/minecraft/client/gui/widget/ClickableWidget;wasHovered:Z
-
-
Constructor Details
-
ClickableWidget
- Mappings:
Namespace Name Mixin selector intermediary <init>Lnet/minecraft/class_339;<init>(IIIILnet/minecraft/class_2561;)Vofficial <init>Leox;<init>(IIIILsw;)Vnamed <init>Lnet/minecraft/client/gui/widget/ClickableWidget;<init>(IIIILnet/minecraft/text/Text;)V
-
-
Method Details
-
getHeight
public int getHeight() -
render
- Specified by:
renderin interfaceDrawable- Mappings:
Namespace Name Mixin selector intermediary method_25394Lnet/minecraft/class_4068;method_25394(Lnet/minecraft/class_332;IIF)Vofficial aLepy;a(Leop;IIF)Vnamed renderLnet/minecraft/client/gui/Drawable;render(Lnet/minecraft/client/gui/DrawContext;IIF)V
-
applyTooltip
private void applyTooltip()- Mappings:
Namespace Name Mixin selector intermediary method_47401Lnet/minecraft/class_339;method_47401()Vofficial aLeox;a()Vnamed applyTooltipLnet/minecraft/client/gui/widget/ClickableWidget;applyTooltip()V
-
getTooltipPositioner
- Mappings:
Namespace Name Mixin selector intermediary method_47937Lnet/minecraft/class_339;method_47937()Lnet/minecraft/class_8000;official iLeox;i()Lewx;named getTooltipPositionerLnet/minecraft/client/gui/widget/ClickableWidget;getTooltipPositioner()Lnet/minecraft/client/gui/tooltip/TooltipPositioner;
-
setTooltip
- Mappings:
Namespace Name Mixin selector intermediary method_47400Lnet/minecraft/class_339;method_47400(Lnet/minecraft/class_7919;)Vofficial aLeox;a(Leqg;)Vnamed setTooltipLnet/minecraft/client/gui/widget/ClickableWidget;setTooltip(Lnet/minecraft/client/gui/tooltip/Tooltip;)V
-
getTooltip
- Mappings:
Namespace Name Mixin selector intermediary method_51254Lnet/minecraft/class_339;method_51254()Lnet/minecraft/class_7919;official jLeox;j()Leqg;named getTooltipLnet/minecraft/client/gui/widget/ClickableWidget;getTooltip()Lnet/minecraft/client/gui/tooltip/Tooltip;
-
setTooltipDelay
public void setTooltipDelay(int delay) - Mappings:
Namespace Name Mixin selector intermediary method_47402Lnet/minecraft/class_339;method_47402(I)Vofficial bLeox;b(I)Vnamed setTooltipDelayLnet/minecraft/client/gui/widget/ClickableWidget;setTooltipDelay(I)V
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector intermediary method_25360Lnet/minecraft/class_339;method_25360()Lnet/minecraft/class_5250;official aE_Leox;aE_()Ltj;named getNarrationMessageLnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage()Lnet/minecraft/text/MutableText;
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector intermediary method_32602Lnet/minecraft/class_339;method_32602(Lnet/minecraft/class_2561;)Lnet/minecraft/class_5250;official aLeox;a(Lsw;)Ltj;named getNarrationMessageLnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage(Lnet/minecraft/text/Text;)Lnet/minecraft/text/MutableText;
-
renderButton
- Mappings:
Namespace Name Mixin selector intermediary method_48579Lnet/minecraft/class_339;method_48579(Lnet/minecraft/class_332;IIF)Vofficial bLeox;b(Leop;IIF)Vnamed renderButtonLnet/minecraft/client/gui/widget/ClickableWidget;renderButton(Lnet/minecraft/client/gui/DrawContext;IIF)V
-
drawScrollableText
protected static void drawScrollableText(DrawContext context, TextRenderer textRenderer, Text text, int left, int top, int right, int bottom, int color) - Mappings:
Namespace Name Mixin selector intermediary method_49605Lnet/minecraft/class_339;method_49605(Lnet/minecraft/class_332;Lnet/minecraft/class_327;Lnet/minecraft/class_2561;IIIII)Vofficial aLeox;a(Leop;Leon;Lsw;IIIII)Vnamed drawScrollableTextLnet/minecraft/client/gui/widget/ClickableWidget;drawScrollableText(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIII)V
-
drawScrollableText
protected void drawScrollableText(DrawContext context, TextRenderer textRenderer, int xMargin, int color) - Mappings:
Namespace Name Mixin selector intermediary method_49604Lnet/minecraft/class_339;method_49604(Lnet/minecraft/class_332;Lnet/minecraft/class_327;II)Vofficial aLeox;a(Leop;Leon;II)Vnamed drawScrollableTextLnet/minecraft/client/gui/widget/ClickableWidget;drawScrollableText(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/client/font/TextRenderer;II)V
-
drawTexture
public void drawTexture(DrawContext context, Identifier texture, int x, int y, int u, int v, int hoveredVOffset, int width, int height, int textureWidth, int textureHeight) - Mappings:
Namespace Name Mixin selector intermediary method_48588Lnet/minecraft/class_339;method_48588(Lnet/minecraft/class_332;Lnet/minecraft/class_2960;IIIIIIIII)Vofficial aLeox;a(Leop;Lacq;IIIIIIIII)Vnamed drawTextureLnet/minecraft/client/gui/widget/ClickableWidget;drawTexture(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/util/Identifier;IIIIIIIII)V
-
onClick
public void onClick(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector intermediary method_25348Lnet/minecraft/class_339;method_25348(DD)Vofficial aLeox;a(DD)Vnamed onClickLnet/minecraft/client/gui/widget/ClickableWidget;onClick(DD)V
-
onRelease
public void onRelease(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector intermediary method_25357Lnet/minecraft/class_339;method_25357(DD)Vofficial bLeox;b(DD)Vnamed onReleaseLnet/minecraft/client/gui/widget/ClickableWidget;onRelease(DD)V
-
onDrag
protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY) - Mappings:
Namespace Name Mixin selector intermediary method_25349Lnet/minecraft/class_339;method_25349(DDDD)Vofficial aLeox;a(DDDD)Vnamed onDragLnet/minecraft/client/gui/widget/ClickableWidget;onDrag(DDDD)V
-
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- 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 intermediary method_25402Lnet/minecraft/class_364;method_25402(DDI)Zofficial aLeqk;a(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- 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 intermediary method_25406Lnet/minecraft/class_364;method_25406(DDI)Zofficial bLeqk;b(DDI)Znamed mouseReleasedLnet/minecraft/client/gui/Element;mouseReleased(DDI)Z
-
isValidClickButton
protected boolean isValidClickButton(int button) - Mappings:
Namespace Name Mixin selector intermediary method_25351Lnet/minecraft/class_339;method_25351(I)Zofficial cLeox;c(I)Znamed isValidClickButtonLnet/minecraft/client/gui/widget/ClickableWidget;isValidClickButton(I)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- 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 intermediary method_25403Lnet/minecraft/class_364;method_25403(DDIDD)Zofficial aLeqk;a(DDIDD)Znamed mouseDraggedLnet/minecraft/client/gui/Element;mouseDragged(DDIDD)Z
-
clicked
protected boolean clicked(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector intermediary method_25361Lnet/minecraft/class_339;method_25361(DD)Zofficial dLeox;d(DD)Znamed clickedLnet/minecraft/client/gui/widget/ClickableWidget;clicked(DD)Z
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) Checks if the mouse position is within the bound of the element.- Specified by:
isMouseOverin interfaceElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mouse- Returns:
trueif the mouse is within the bound of the element, otherwisefalse- Mappings:
Namespace Name Mixin selector intermediary method_25405Lnet/minecraft/class_364;method_25405(DD)Zofficial a_Leqk;a_(DD)Znamed isMouseOverLnet/minecraft/client/gui/Element;isMouseOver(DD)Z
-
playDownSound
- Mappings:
Namespace Name Mixin selector intermediary method_25354Lnet/minecraft/class_339;method_25354(Lnet/minecraft/class_1144;)Vofficial aLeox;a(Lfyr;)Vnamed playDownSoundLnet/minecraft/client/gui/widget/ClickableWidget;playDownSound(Lnet/minecraft/client/sound/SoundManager;)V
-
getWidth
public int getWidth() -
setWidth
public void setWidth(int width) - Mappings:
Namespace Name Mixin selector intermediary method_25358Lnet/minecraft/class_339;method_25358(I)Vofficial dLeox;d(I)Vnamed setWidthLnet/minecraft/client/gui/widget/ClickableWidget;setWidth(I)V
-
setAlpha
public void setAlpha(float alpha) - Mappings:
Namespace Name Mixin selector intermediary method_25350Lnet/minecraft/class_339;method_25350(F)Vofficial aLeox;a(F)Vnamed setAlphaLnet/minecraft/client/gui/widget/ClickableWidget;setAlpha(F)V
-
setMessage
- Mappings:
Namespace Name Mixin selector intermediary method_25355Lnet/minecraft/class_339;method_25355(Lnet/minecraft/class_2561;)Vofficial bLeox;b(Lsw;)Vnamed setMessageLnet/minecraft/client/gui/widget/ClickableWidget;setMessage(Lnet/minecraft/text/Text;)V
-
getMessage
- Mappings:
Namespace Name Mixin selector intermediary method_25369Lnet/minecraft/class_339;method_25369()Lnet/minecraft/class_2561;official lLeox;l()Lsw;named getMessageLnet/minecraft/client/gui/widget/ClickableWidget;getMessage()Lnet/minecraft/text/Text;
-
isFocused
public boolean isFocused() -
isHovered
public boolean isHovered()- Mappings:
Namespace Name Mixin selector intermediary method_49606Lnet/minecraft/class_339;method_49606()Zofficial mLeox;m()Znamed isHoveredLnet/minecraft/client/gui/widget/ClickableWidget;isHovered()Z
-
isSelected
public boolean isSelected()- Mappings:
Namespace Name Mixin selector intermediary method_25367Lnet/minecraft/class_339;method_25367()Zofficial nLeox;n()Znamed isSelectedLnet/minecraft/client/gui/widget/ClickableWidget;isSelected()Z
-
isNarratable
public boolean isNarratable()- Specified by:
isNarratablein interfaceSelectable- Mappings:
Namespace Name Mixin selector intermediary method_37303Lnet/minecraft/class_6379;method_37303()Zofficial aD_Lese;aD_()Znamed isNarratableLnet/minecraft/client/gui/Selectable;isNarratable()Z
-
setFocused
public void setFocused(boolean focused) - Specified by:
setFocusedin interfaceElement- Mappings:
Namespace Name Mixin selector intermediary method_25365Lnet/minecraft/class_364;method_25365(Z)Vofficial b_Leqk;b_(Z)Vnamed setFocusedLnet/minecraft/client/gui/Element;setFocused(Z)V
-
getType
- Specified by:
getTypein interfaceSelectable- Mappings:
Namespace Name Mixin selector intermediary method_37018Lnet/minecraft/class_6379;method_37018()Lnet/minecraft/class_6379$class_6380;official qLese;q()Lese$a;named getTypeLnet/minecraft/client/gui/Selectable;getType()Lnet/minecraft/client/gui/Selectable$SelectionType;
-
appendNarrations
- Specified by:
appendNarrationsin interfaceNarratable- Mappings:
Namespace Name Mixin selector intermediary method_37020Lnet/minecraft/class_6383;method_37020(Lnet/minecraft/class_6382;)Vofficial bLesh;b(Lesg;)Vnamed appendNarrationsLnet/minecraft/client/gui/Narratable;appendNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V
-
appendClickableNarrations
- Mappings:
Namespace Name Mixin selector intermediary method_47399Lnet/minecraft/class_339;method_47399(Lnet/minecraft/class_6382;)Vofficial aLeox;a(Lesg;)Vnamed appendClickableNarrationsLnet/minecraft/client/gui/widget/ClickableWidget;appendClickableNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V
-
appendDefaultNarrations
- Mappings:
Namespace Name Mixin selector intermediary method_37021Lnet/minecraft/class_339;method_37021(Lnet/minecraft/class_6382;)Vofficial cLeox;c(Lesg;)Vnamed appendDefaultNarrationsLnet/minecraft/client/gui/widget/ClickableWidget;appendDefaultNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V
-
getX
public int getX() -
setX
public void setX(int x) -
getY
public int getY() -
setY
public void setY(int y) -
forEachChild
- Specified by:
forEachChildin interfaceWidget- Mappings:
Namespace Name Mixin selector intermediary method_48206Lnet/minecraft/class_8021;method_48206(Ljava/util/function/Consumer;)Vofficial aLerz;a(Ljava/util/function/Consumer;)Vnamed forEachChildLnet/minecraft/client/gui/widget/Widget;forEachChild(Ljava/util/function/Consumer;)V
-