Package net.minecraft.client.gui.widget
Class ClickableWidget
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.widget.ClickableWidget
- All Implemented Interfaces:
class_8021,Drawable,Element,Narratable,Selectable
- Direct Known Subclasses:
AnimatedResultButton,GameModeSelectionScreen.ButtonWidget,MultilineTextWidget,PressableWidget,RecipeAlternativesWidget.AlternativeButtonWidget,ScrollableWidget,SliderWidget,TextFieldWidget,TextWidget,ToggleButtonWidget
@Environment(CLIENT)
public abstract class ClickableWidget
extends DrawableHelper
implements Drawable, Element, class_8021, 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 official eljintermediary net/minecraft/class_339named 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 TypeFieldDescriptionbooleanprotected floatprotected static final intprivate booleanprotected intprotected booleanprivate longprivate Textprivate intbooleanprivate booleanstatic final Identifierprotected intprivate intprivate intFields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTUREFields 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) intprotected MutableTextstatic MutableTextgetNarrationMessage(Text message) protected TooltipPositionergetType()intgetWidth()intgetX()intgetY()protected intbooleanbooleanbooleanisMouseOver(double mouseX, double mouseY) Checks if the mouse position is within the bound of the element.booleanprotected booleanisValidClickButton(int button) protected Identifiermethod_48205(class_8023 class_8023) voidmethod_48206(Consumer<ClickableWidget> consumer) 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(MatrixStack matrices, int mouseX, int mouseY, float delta) protected voidrenderBackground(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY) voidrenderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) voidsetAlpha(float alpha) voidsetFocused(boolean bool) voidsetMessage(Text message) voidsetTooltip(@Nullable Tooltip tooltip) voidsetTooltipDelay(int delay) voidsetWidth(int width) voidsetX(int int2) voidsetY(int int2) Methods inherited from class net.minecraft.client.gui.DrawableHelper
disableScissor, drawCenteredText, drawCenteredText, drawCenteredTextWithShadow, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, drawWithOutline, drawWithShadow, enableScissor, fill, fillGradient, fillGradient, fillGradient, getZOffset, method_48196, setZOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.class_8021
method_48229Methods inherited from interface net.minecraft.client.gui.Element
charTyped, keyPressed, keyReleased, method_48218, mouseMoved, mouseScrolled
-
Field Details
-
WIDGETS_TEXTURE
- Mappings:
Namespace Name Mixin selector official jLelj;j:Lacm;intermediary field_22757Lnet/minecraft/class_339;field_22757:Lnet/minecraft/class_2960;named WIDGETS_TEXTURELnet/minecraft/client/gui/widget/ClickableWidget;WIDGETS_TEXTURE:Lnet/minecraft/util/Identifier;
-
field_41797
protected static final int field_41797- See Also:
- Mappings:
Namespace Name Mixin selector official kLelj;k:Iintermediary field_41797Lnet/minecraft/class_339;field_41797:Inamed field_41797Lnet/minecraft/client/gui/widget/ClickableWidget;field_41797:I
-
width
protected int width- Mappings:
Namespace Name Mixin selector official lLelj;l:Iintermediary field_22758Lnet/minecraft/class_339;field_22758:Inamed widthLnet/minecraft/client/gui/widget/ClickableWidget;width:I
-
height
protected int height- Mappings:
Namespace Name Mixin selector official mLelj;m:Iintermediary field_22759Lnet/minecraft/class_339;field_22759:Inamed heightLnet/minecraft/client/gui/widget/ClickableWidget;height:I
-
x
private int x- Mappings:
Namespace Name Mixin selector official aLelj;a:Iintermediary field_22760Lnet/minecraft/class_339;field_22760:Inamed xLnet/minecraft/client/gui/widget/ClickableWidget;x:I
-
y
private int y- Mappings:
Namespace Name Mixin selector official bLelj;b:Iintermediary field_22761Lnet/minecraft/class_339;field_22761:Inamed yLnet/minecraft/client/gui/widget/ClickableWidget;y:I
-
message
- Mappings:
Namespace Name Mixin selector official cLelj;c:Lsu;intermediary field_22754Lnet/minecraft/class_339;field_22754:Lnet/minecraft/class_2561;named messageLnet/minecraft/client/gui/widget/ClickableWidget;message:Lnet/minecraft/text/Text;
-
hovered
protected boolean hovered- Mappings:
Namespace Name Mixin selector official nLelj;n:Zintermediary field_22762Lnet/minecraft/class_339;field_22762:Znamed hoveredLnet/minecraft/client/gui/widget/ClickableWidget;hovered:Z
-
active
public boolean active- Mappings:
Namespace Name Mixin selector official oLelj;o:Zintermediary field_22763Lnet/minecraft/class_339;field_22763:Znamed activeLnet/minecraft/client/gui/widget/ClickableWidget;active:Z
-
visible
public boolean visible- Mappings:
Namespace Name Mixin selector official pLelj;p:Zintermediary field_22764Lnet/minecraft/class_339;field_22764:Znamed visibleLnet/minecraft/client/gui/widget/ClickableWidget;visible:Z
-
alpha
protected float alpha- Mappings:
Namespace Name Mixin selector official qLelj;q:Fintermediary field_22765Lnet/minecraft/class_339;field_22765:Fnamed alphaLnet/minecraft/client/gui/widget/ClickableWidget;alpha:F
-
focused
private boolean focused- Mappings:
Namespace Name Mixin selector official dLelj;d:Zintermediary field_22756Lnet/minecraft/class_339;field_22756:Znamed focusedLnet/minecraft/client/gui/widget/ClickableWidget;focused:Z
-
tooltip
- Mappings:
Namespace Name Mixin selector official eLelj;e:Lemm;intermediary field_41095Lnet/minecraft/class_339;field_41095:Lnet/minecraft/class_7919;named tooltipLnet/minecraft/client/gui/widget/ClickableWidget;tooltip:Lnet/minecraft/client/gui/tooltip/Tooltip;
-
tooltipDelay
private int tooltipDelay- Mappings:
Namespace Name Mixin selector official fLelj;f:Iintermediary field_41096Lnet/minecraft/class_339;field_41096:Inamed tooltipDelayLnet/minecraft/client/gui/widget/ClickableWidget;tooltipDelay:I
-
lastHoveredTime
private long lastHoveredTime- Mappings:
Namespace Name Mixin selector official rLelj;r:Jintermediary field_41097Lnet/minecraft/class_339;field_41097:Jnamed lastHoveredTimeLnet/minecraft/client/gui/widget/ClickableWidget;lastHoveredTime:J
-
wasHovered
private boolean wasHovered- Mappings:
Namespace Name Mixin selector official sLelj;s:Zintermediary field_41098Lnet/minecraft/class_339;field_41098:Znamed wasHoveredLnet/minecraft/client/gui/widget/ClickableWidget;wasHovered:Z
-
-
Constructor Details
-
ClickableWidget
-
-
Method Details
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceclass_8021- Mappings:
Namespace Name Mixin selector official hLenv;h()Iintermediary method_25364Lnet/minecraft/class_8021;method_25364()Inamed getHeightLnet/minecraft/class_8021;getHeight()I
-
method_48203
- Mappings:
Namespace Name Mixin selector official ar_Lelj;ar_()Lacm;intermediary method_48203Lnet/minecraft/class_339;method_48203()Lnet/minecraft/class_2960;named method_48203Lnet/minecraft/client/gui/widget/ClickableWidget;method_48203()Lnet/minecraft/util/Identifier;
-
getYImage
protected int getYImage()- Mappings:
Namespace Name Mixin selector official as_Lelj;as_()Iintermediary method_25356Lnet/minecraft/class_339;method_25356()Inamed getYImageLnet/minecraft/client/gui/widget/ClickableWidget;getYImage()I
-
render
- Specified by:
renderin interfaceDrawable- Mappings:
Namespace Name Mixin selector official aLemj;a(Leer;IIF)Vintermediary method_25394Lnet/minecraft/class_4068;method_25394(Lnet/minecraft/class_4587;IIF)Vnamed renderLnet/minecraft/client/gui/Drawable;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V
-
applyTooltip
private void applyTooltip()- Mappings:
Namespace Name Mixin selector official aLelj;a()Vintermediary method_47401Lnet/minecraft/class_339;method_47401()Vnamed applyTooltipLnet/minecraft/client/gui/widget/ClickableWidget;applyTooltip()V
-
getTooltipPositioner
- Mappings:
Namespace Name Mixin selector official iLelj;i()Lesq;intermediary method_47937Lnet/minecraft/class_339;method_47937()Lnet/minecraft/class_8000;named getTooltipPositionerLnet/minecraft/client/gui/widget/ClickableWidget;getTooltipPositioner()Lnet/minecraft/client/gui/tooltip/TooltipPositioner;
-
setTooltip
- Mappings:
Namespace Name Mixin selector official aLelj;a(Lemm;)Vintermediary method_47400Lnet/minecraft/class_339;method_47400(Lnet/minecraft/class_7919;)Vnamed setTooltipLnet/minecraft/client/gui/widget/ClickableWidget;setTooltip(Lnet/minecraft/client/gui/tooltip/Tooltip;)V
-
setTooltipDelay
public void setTooltipDelay(int delay) - Mappings:
Namespace Name Mixin selector official h_Lelj;h_(I)Vintermediary method_47402Lnet/minecraft/class_339;method_47402(I)Vnamed setTooltipDelayLnet/minecraft/client/gui/widget/ClickableWidget;setTooltipDelay(I)V
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector official at_Lelj;at_()Lth;intermediary method_25360Lnet/minecraft/class_339;method_25360()Lnet/minecraft/class_5250;named getNarrationMessageLnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage()Lnet/minecraft/text/MutableText;
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector official aLelj;a(Lsu;)Lth;intermediary method_32602Lnet/minecraft/class_339;method_32602(Lnet/minecraft/class_2561;)Lnet/minecraft/class_5250;named getNarrationMessageLnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage(Lnet/minecraft/text/Text;)Lnet/minecraft/text/MutableText;
-
renderButton
- Mappings:
Namespace Name Mixin selector official bLelj;b(Leer;IIF)Vintermediary method_25359Lnet/minecraft/class_339;method_25359(Lnet/minecraft/class_4587;IIF)Vnamed renderButtonLnet/minecraft/client/gui/widget/ClickableWidget;renderButton(Lnet/minecraft/client/util/math/MatrixStack;IIF)V
-
renderBackground
protected void renderBackground(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY) - Mappings:
Namespace Name Mixin selector official aLelj;a(Leer;Lejt;II)Vintermediary method_25353Lnet/minecraft/class_339;method_25353(Lnet/minecraft/class_4587;Lnet/minecraft/class_310;II)Vnamed renderBackgroundLnet/minecraft/client/gui/widget/ClickableWidget;renderBackground(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/MinecraftClient;II)V
-
onClick
public void onClick(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector official aLelj;a(DD)Vintermediary method_25348Lnet/minecraft/class_339;method_25348(DD)Vnamed onClickLnet/minecraft/client/gui/widget/ClickableWidget;onClick(DD)V
-
onRelease
public void onRelease(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector official bLelj;b(DD)Vintermediary method_25357Lnet/minecraft/class_339;method_25357(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 official aLelj;a(DDDD)Vintermediary method_25349Lnet/minecraft/class_339;method_25349(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 official aLemq;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- 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 bLemq;b(DDI)Zintermediary method_25406Lnet/minecraft/class_364;method_25406(DDI)Znamed mouseReleasedLnet/minecraft/client/gui/Element;mouseReleased(DDI)Z
-
isValidClickButton
protected boolean isValidClickButton(int button) - Mappings:
Namespace Name Mixin selector official bLelj;b(I)Zintermediary method_25351Lnet/minecraft/class_339;method_25351(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 official aLemq;a(DDIDD)Zintermediary method_25403Lnet/minecraft/class_364;method_25403(DDIDD)Znamed mouseDraggedLnet/minecraft/client/gui/Element;mouseDragged(DDIDD)Z
-
clicked
protected boolean clicked(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector official dLelj;d(DD)Zintermediary method_25361Lnet/minecraft/class_339;method_25361(DD)Znamed clickedLnet/minecraft/client/gui/widget/ClickableWidget;clicked(DD)Z
-
isHovered
public boolean isHovered()- Mappings:
Namespace Name Mixin selector official jLelj;j()Zintermediary method_25367Lnet/minecraft/class_339;method_25367()Znamed isHoveredLnet/minecraft/client/gui/widget/ClickableWidget;isHovered()Z
-
method_48205
- Specified by:
method_48205in interfaceElement- Mappings:
Namespace Name Mixin selector official aLemq;a(Leoh;)Lekz;intermediary method_48205Lnet/minecraft/class_364;method_48205(Lnet/minecraft/class_8023;)Lnet/minecraft/class_8016;named method_48205Lnet/minecraft/client/gui/Element;method_48205(Lnet/minecraft/class_8023;)Lnet/minecraft/class_8016;
-
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 official a_Lemq;a_(DD)Zintermediary method_25405Lnet/minecraft/class_364;method_25405(DD)Znamed isMouseOverLnet/minecraft/client/gui/Element;isMouseOver(DD)Z
-
playDownSound
- Mappings:
Namespace Name Mixin selector official aLelj;a(Lftp;)Vintermediary method_25354Lnet/minecraft/class_339;method_25354(Lnet/minecraft/class_1144;)Vnamed playDownSoundLnet/minecraft/client/gui/widget/ClickableWidget;playDownSound(Lnet/minecraft/client/sound/SoundManager;)V
-
getWidth
public int getWidth()- Specified by:
getWidthin interfaceclass_8021- Mappings:
Namespace Name Mixin selector official kLenv;k()Iintermediary method_25368Lnet/minecraft/class_8021;method_25368()Inamed getWidthLnet/minecraft/class_8021;getWidth()I
-
setWidth
public void setWidth(int width) - Mappings:
Namespace Name Mixin selector official cLelj;c(I)Vintermediary method_25358Lnet/minecraft/class_339;method_25358(I)Vnamed setWidthLnet/minecraft/client/gui/widget/ClickableWidget;setWidth(I)V
-
setAlpha
public void setAlpha(float alpha) - Mappings:
Namespace Name Mixin selector official aLelj;a(F)Vintermediary method_25350Lnet/minecraft/class_339;method_25350(F)Vnamed setAlphaLnet/minecraft/client/gui/widget/ClickableWidget;setAlpha(F)V
-
setMessage
- Mappings:
Namespace Name Mixin selector official bLelj;b(Lsu;)Vintermediary method_25355Lnet/minecraft/class_339;method_25355(Lnet/minecraft/class_2561;)Vnamed setMessageLnet/minecraft/client/gui/widget/ClickableWidget;setMessage(Lnet/minecraft/text/Text;)V
-
getMessage
- Mappings:
Namespace Name Mixin selector official nLelj;n()Lsu;intermediary method_25369Lnet/minecraft/class_339;method_25369()Lnet/minecraft/class_2561;named getMessageLnet/minecraft/client/gui/widget/ClickableWidget;getMessage()Lnet/minecraft/text/Text;
-
isFocused
public boolean isFocused() -
isNarratable
public boolean isNarratable()- Specified by:
isNarratablein interfaceSelectable- Mappings:
Namespace Name Mixin selector official aq_Leoa;aq_()Zintermediary method_37303Lnet/minecraft/class_6379;method_37303()Znamed isNarratableLnet/minecraft/client/gui/Selectable;isNarratable()Z
-
setFocused
public void setFocused(boolean bool) - Specified by:
setFocusedin interfaceElement- Mappings:
Namespace Name Mixin selector official b_Lemq;b_(Z)Vintermediary method_25365Lnet/minecraft/class_364;method_25365(Z)Vnamed setFocusedLnet/minecraft/client/gui/Element;setFocused(Z)V
-
getType
- Specified by:
getTypein interfaceSelectable- Mappings:
Namespace Name Mixin selector official sLeoa;s()Leoa$a;intermediary method_37018Lnet/minecraft/class_6379;method_37018()Lnet/minecraft/class_6379$class_6380;named getTypeLnet/minecraft/client/gui/Selectable;getType()Lnet/minecraft/client/gui/Selectable$SelectionType;
-
appendNarrations
- Specified by:
appendNarrationsin interfaceNarratable- Mappings:
Namespace Name Mixin selector official bLeod;b(Leoc;)Vintermediary method_37020Lnet/minecraft/class_6383;method_37020(Lnet/minecraft/class_6382;)Vnamed appendNarrationsLnet/minecraft/client/gui/Narratable;appendNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V
-
appendClickableNarrations
- Mappings:
Namespace Name Mixin selector official aLelj;a(Leoc;)Vintermediary method_47399Lnet/minecraft/class_339;method_47399(Lnet/minecraft/class_6382;)Vnamed appendClickableNarrationsLnet/minecraft/client/gui/widget/ClickableWidget;appendClickableNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V
-
appendDefaultNarrations
- Mappings:
Namespace Name Mixin selector official cLelj;c(Leoc;)Vintermediary method_37021Lnet/minecraft/class_339;method_37021(Lnet/minecraft/class_6382;)Vnamed appendDefaultNarrationsLnet/minecraft/client/gui/widget/ClickableWidget;appendDefaultNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V
-
getX
public int getX()- Specified by:
getXin interfaceclass_8021- Mappings:
Namespace Name Mixin selector official pLenv;p()Iintermediary method_46426Lnet/minecraft/class_8021;method_46426()Inamed getXLnet/minecraft/class_8021;getX()I
-
setX
public void setX(int int2) - Specified by:
setXin interfaceclass_8021- Mappings:
Namespace Name Mixin selector official eLenv;e(I)Vintermediary method_46421Lnet/minecraft/class_8021;method_46421(I)Vnamed setXLnet/minecraft/class_8021;setX(I)V
-
getY
public int getY()- Specified by:
getYin interfaceclass_8021- Mappings:
Namespace Name Mixin selector official qLenv;q()Iintermediary method_46427Lnet/minecraft/class_8021;method_46427()Inamed getYLnet/minecraft/class_8021;getY()I
-
setY
public void setY(int int2) - Specified by:
setYin interfaceclass_8021- Mappings:
Namespace Name Mixin selector official fLenv;f(I)Vintermediary method_46419Lnet/minecraft/class_8021;method_46419(I)Vnamed setYLnet/minecraft/class_8021;setY(I)V
-
method_48206
- Specified by:
method_48206in interfaceclass_8021- Mappings:
Namespace Name Mixin selector official aLenv;a(Ljava/util/function/Consumer;)Vintermediary method_48206Lnet/minecraft/class_8021;method_48206(Ljava/util/function/Consumer;)Vnamed method_48206Lnet/minecraft/class_8021;method_48206(Ljava/util/function/Consumer;)V
-
method_48202
- Specified by:
method_48202in interfaceElement- Mappings:
Namespace Name Mixin selector official uLemq;u()Leol;intermediary method_48202Lnet/minecraft/class_364;method_48202()Lnet/minecraft/class_8030;named method_48202Lnet/minecraft/client/gui/Element;method_48202()Lnet/minecraft/class_8030;
-