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,ClickableWidget.InactivityIndicatingWidget,GameModeSwitcherScreen.ButtonWidget,IconWidget,ItemStackWidget,LoadingWidget,PlayerSkinWidget,RecipeAlternativesWidget.AlternativeButtonWidget,ScrollableWidget,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 named net/minecraft/client/gui/widget/ClickableWidgetintermediary net/minecraft/class_339official ght
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.minecraft.client.gui.Selectable
Selectable.SelectionType -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidprotected voidfinal voidappendNarrations(NarrationMessageBuilder builder) protected voiddrawTextWithMargin(TextConsumer drawer, Text text, int marginX) voidforEachChild(Consumer<ClickableWidget> consumer) floatgetAlpha()intintprotected MutableTextstatic MutableTextgetNarrationMessage(Text message) int@Nullable GuiNavigationPathgetNavigationPath(GuiNavigation navigation) intgetRight()getType()intgetWidth()intgetX()intgetY()booleanbooleanprivate booleanisInBounds(double x, double y) booleanbooleanisMouseOver(double mouseX, double mouseY) Checks if the mouse position is within the bound of the element.booleanprotected booleanisValidClickButton(MouseInput input) booleanmouseClicked(Click click, boolean doubled) Callback for when a mouse button down event has been captured.booleanmouseDragged(Click click, double offsetX, double offsetY) Callback for when a mouse button drag event has been captured.booleanmouseReleased(Click click) Callback for when a mouse button release event has been captured.voidprotected voidvoidstatic voidplayClickSound(SoundManager soundManager) voidplayDownSound(SoundManager soundManager) final voidrender(DrawContext context, int mouseX, int mouseY, float deltaTicks) protected abstract voidrenderWidget(DrawContext context, int mouseX, int mouseY, float deltaTicks) voidsetAlpha(float alpha) protected voidsetCursor(DrawContext context) voidsetDimensions(int width, int height) voidsetDimensionsAndPosition(int width, int height, int x, int y) voidsetFocused(boolean focused) voidsetHeight(int height) voidsetMessage(Text message) voidsetNavigationOrder(int navigationOrder) voidsetTooltip(@Nullable Tooltip tooltip) voidsetTooltipDelay(Duration tooltipDelay) 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, getBorder, getFocusedPath, isClickable, keyPressed, keyReleased, mouseMoved, mouseScrolledMethods inherited from interface net.minecraft.client.gui.Selectable
getNarratedPartsMethods inherited from interface net.minecraft.client.gui.widget.Widget
setPosition
-
Field Details
-
width
protected int width- Mappings:
Namespace Name Mixin selector named widthLnet/minecraft/client/gui/widget/ClickableWidget;width:Iintermediary field_22758Lnet/minecraft/class_339;field_22758:Iofficial gLght;g:I
-
height
protected int height- Mappings:
Namespace Name Mixin selector named heightLnet/minecraft/client/gui/widget/ClickableWidget;height:Iintermediary field_22759Lnet/minecraft/class_339;field_22759:Iofficial hLght;h:I
-
x
private int x- Mappings:
Namespace Name Mixin selector named xLnet/minecraft/client/gui/widget/ClickableWidget;x:Iintermediary field_22760Lnet/minecraft/class_339;field_22760:Iofficial aLght;a:I
-
y
private int y- Mappings:
Namespace Name Mixin selector named yLnet/minecraft/client/gui/widget/ClickableWidget;y:Iintermediary field_22761Lnet/minecraft/class_339;field_22761:Iofficial bLght;b:I
-
message
- Mappings:
Namespace Name Mixin selector named messageLnet/minecraft/client/gui/widget/ClickableWidget;message:Lnet/minecraft/text/Text;intermediary field_22754Lnet/minecraft/class_339;field_22754:Lnet/minecraft/class_2561;official iLght;i:Lyh;
-
hovered
protected boolean hovered- Mappings:
Namespace Name Mixin selector named hoveredLnet/minecraft/client/gui/widget/ClickableWidget;hovered:Zintermediary field_22762Lnet/minecraft/class_339;field_22762:Zofficial jLght;j:Z
-
active
public boolean active- Mappings:
Namespace Name Mixin selector named activeLnet/minecraft/client/gui/widget/ClickableWidget;active:Zintermediary field_22763Lnet/minecraft/class_339;field_22763:Zofficial kLght;k:Z
-
visible
public boolean visible- Mappings:
Namespace Name Mixin selector named visibleLnet/minecraft/client/gui/widget/ClickableWidget;visible:Zintermediary field_22764Lnet/minecraft/class_339;field_22764:Zofficial lLght;l:Z
-
alpha
protected float alpha- Mappings:
Namespace Name Mixin selector named alphaLnet/minecraft/client/gui/widget/ClickableWidget;alpha:Fintermediary field_22765Lnet/minecraft/class_339;field_22765:Fofficial mLght;m:F
-
focused
private boolean focused- Mappings:
Namespace Name Mixin selector named focusedLnet/minecraft/client/gui/widget/ClickableWidget;focused:Zintermediary field_22756Lnet/minecraft/class_339;field_22756:Zofficial dLght;d:Z
-
tooltip
- Mappings:
Namespace Name Mixin selector named tooltipLnet/minecraft/client/gui/widget/ClickableWidget;tooltip:Lnet/minecraft/client/gui/tooltip/TooltipState;intermediary field_41095Lnet/minecraft/class_339;field_41095:Lnet/minecraft/class_9110;official eLght;e:Lgjn;
-
-
Constructor Details
-
ClickableWidget
- 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>Lght;<init>(IIIILyh;)V
-
-
Method Details
-
getHeight
public int getHeight() -
render
- Specified by:
renderin interfaceDrawable- Mappings:
Namespace Name Mixin selector named renderLnet/minecraft/client/gui/Drawable;render(Lnet/minecraft/client/gui/DrawContext;IIF)Vintermediary method_25394Lnet/minecraft/class_4068;method_25394(Lnet/minecraft/class_332;IIF)Vofficial aLgiz;a(Lghi;IIF)V
-
setCursor
- Mappings:
Namespace Name Mixin selector named setCursorLnet/minecraft/client/gui/widget/ClickableWidget;setCursor(Lnet/minecraft/client/gui/DrawContext;)Vintermediary method_76256Lnet/minecraft/class_339;method_76256(Lnet/minecraft/class_332;)Vofficial dLght;d(Lghi;)V
-
setTooltip
- Mappings:
Namespace Name Mixin selector named setTooltipLnet/minecraft/client/gui/widget/ClickableWidget;setTooltip(Lnet/minecraft/client/gui/tooltip/Tooltip;)Vintermediary method_47400Lnet/minecraft/class_339;method_47400(Lnet/minecraft/class_7919;)Vofficial aLght;a(Lgjk;)V
-
setTooltipDelay
- Mappings:
Namespace Name Mixin selector named setTooltipDelayLnet/minecraft/client/gui/widget/ClickableWidget;setTooltipDelay(Ljava/time/Duration;)Vintermediary method_47402Lnet/minecraft/class_339;method_47402(Ljava/time/Duration;)Vofficial aLght;a(Ljava/time/Duration;)V
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector named getNarrationMessageLnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage()Lnet/minecraft/text/MutableText;intermediary method_25360Lnet/minecraft/class_339;method_25360()Lnet/minecraft/class_5250;official fLght;f()Lyw;
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector named getNarrationMessageLnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage(Lnet/minecraft/text/Text;)Lnet/minecraft/text/MutableText;intermediary method_32602Lnet/minecraft/class_339;method_32602(Lnet/minecraft/class_2561;)Lnet/minecraft/class_5250;official bLght;b(Lyh;)Lyw;
-
renderWidget
- 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 a_Lght;a_(Lghi;IIF)V
-
drawTextWithMargin
- Mappings:
Namespace Name Mixin selector named drawTextWithMarginLnet/minecraft/client/gui/widget/ClickableWidget;drawTextWithMargin(Lnet/minecraft/client/font/TextConsumer;Lnet/minecraft/text/Text;I)Vintermediary method_75799Lnet/minecraft/class_339;method_75799(Lnet/minecraft/class_12225;Lnet/minecraft/class_2561;I)Vofficial aLght;a(Lghc;Lyh;I)V
-
onClick
- Mappings:
Namespace Name Mixin selector named onClickLnet/minecraft/client/gui/widget/ClickableWidget;onClick(Lnet/minecraft/client/gui/Click;Z)Vintermediary method_25348Lnet/minecraft/class_339;method_25348(Lnet/minecraft/class_11909;Z)Vofficial bLght;b(Lgxs;Z)V
-
onRelease
- Mappings:
Namespace Name Mixin selector named onReleaseLnet/minecraft/client/gui/widget/ClickableWidget;onRelease(Lnet/minecraft/client/gui/Click;)Vintermediary method_25357Lnet/minecraft/class_339;method_25357(Lnet/minecraft/class_11909;)Vofficial aLght;a(Lgxs;)V
-
onDrag
- Mappings:
Namespace Name Mixin selector named onDragLnet/minecraft/client/gui/widget/ClickableWidget;onDrag(Lnet/minecraft/client/gui/Click;DD)Vintermediary method_25349Lnet/minecraft/class_339;method_25349(Lnet/minecraft/class_11909;DD)Vofficial bLght;b(Lgxs;DD)V
-
mouseClicked
Callback for when a mouse button down event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseClickedin interfaceElement- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named mouseClickedLnet/minecraft/client/gui/Element;mouseClicked(Lnet/minecraft/client/gui/Click;Z)Zintermediary method_25402Lnet/minecraft/class_364;method_25402(Lnet/minecraft/class_11909;Z)Zofficial aLgle;a(Lgxs;Z)Z
-
mouseReleased
Callback for when a mouse button release event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseReleasedin interfaceElement- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named mouseReleasedLnet/minecraft/client/gui/Element;mouseReleased(Lnet/minecraft/client/gui/Click;)Zintermediary method_25406Lnet/minecraft/class_364;method_25406(Lnet/minecraft/class_11909;)Zofficial bLgle;b(Lgxs;)Z
-
isValidClickButton
- Mappings:
Namespace Name Mixin selector named isValidClickButtonLnet/minecraft/client/gui/widget/ClickableWidget;isValidClickButton(Lnet/minecraft/client/input/MouseInput;)Zintermediary method_25351Lnet/minecraft/class_339;method_25351(Lnet/minecraft/class_11910;)Zofficial aLght;a(Lgxt;)Z
-
mouseDragged
Callback for when a mouse button drag event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseDraggedin interfaceElement- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named mouseDraggedLnet/minecraft/client/gui/Element;mouseDragged(Lnet/minecraft/client/gui/Click;DD)Zintermediary method_25403Lnet/minecraft/class_364;method_25403(Lnet/minecraft/class_11909;DD)Zofficial aLgle;a(Lgxs;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 named isMouseOverLnet/minecraft/client/gui/Element;isMouseOver(DD)Zintermediary method_25405Lnet/minecraft/class_364;method_25405(DD)Zofficial a_Lgle;a_(DD)Z
-
playDownSound
- Mappings:
Namespace Name Mixin selector named playDownSoundLnet/minecraft/client/gui/widget/ClickableWidget;playDownSound(Lnet/minecraft/client/sound/SoundManager;)Vintermediary method_25354Lnet/minecraft/class_339;method_25354(Lnet/minecraft/class_1144;)Vofficial aLght;a(Limn;)V
-
playClickSound
- Mappings:
Namespace Name Mixin selector named playClickSoundLnet/minecraft/client/gui/widget/ClickableWidget;playClickSound(Lnet/minecraft/client/sound/SoundManager;)Vintermediary method_62888Lnet/minecraft/class_339;method_62888(Lnet/minecraft/class_1144;)Vofficial bLght;b(Limn;)V
-
getWidth
public int getWidth() -
setWidth
public void setWidth(int width) - Mappings:
Namespace Name Mixin selector named setWidthLnet/minecraft/client/gui/widget/ClickableWidget;setWidth(I)Vintermediary method_25358Lnet/minecraft/class_339;method_25358(I)Vofficial cLght;c(I)V
-
setHeight
public void setHeight(int height) - Mappings:
Namespace Name Mixin selector named setHeightLnet/minecraft/client/gui/widget/ClickableWidget;setHeight(I)Vintermediary method_53533Lnet/minecraft/class_339;method_53533(I)Vofficial dLght;d(I)V
-
setAlpha
public void setAlpha(float alpha) - Mappings:
Namespace Name Mixin selector named setAlphaLnet/minecraft/client/gui/widget/ClickableWidget;setAlpha(F)Vintermediary method_25350Lnet/minecraft/class_339;method_25350(F)Vofficial aLght;a(F)V
-
getAlpha
public float getAlpha()- Mappings:
Namespace Name Mixin selector named getAlphaLnet/minecraft/client/gui/widget/ClickableWidget;getAlpha()Fintermediary method_75798Lnet/minecraft/class_339;method_75798()Fofficial ALght;A()F
-
setMessage
- Mappings:
Namespace Name Mixin selector named setMessageLnet/minecraft/client/gui/widget/ClickableWidget;setMessage(Lnet/minecraft/text/Text;)Vintermediary method_25355Lnet/minecraft/class_339;method_25355(Lnet/minecraft/class_2561;)Vofficial a_Lght;a_(Lyh;)V
-
getMessage
- Mappings:
Namespace Name Mixin selector named getMessageLnet/minecraft/client/gui/widget/ClickableWidget;getMessage()Lnet/minecraft/text/Text;intermediary method_25369Lnet/minecraft/class_339;method_25369()Lnet/minecraft/class_2561;official BLght;B()Lyh;
-
isFocused
public boolean isFocused() -
isHovered
public boolean isHovered()- Mappings:
Namespace Name Mixin selector named isHoveredLnet/minecraft/client/gui/widget/ClickableWidget;isHovered()Zintermediary method_49606Lnet/minecraft/class_339;method_49606()Zofficial CLght;C()Z
-
isSelected
public boolean isSelected()- Mappings:
Namespace Name Mixin selector named isSelectedLnet/minecraft/client/gui/widget/ClickableWidget;isSelected()Zintermediary method_25367Lnet/minecraft/class_339;method_25367()Zofficial DLght;D()Z
-
isInteractable
public boolean isInteractable()- Specified by:
isInteractablein interfaceSelectable- Mappings:
Namespace Name Mixin selector named isInteractableLnet/minecraft/client/gui/Selectable;isInteractable()Zintermediary method_37303Lnet/minecraft/class_6379;method_37303()Zofficial bLgnt;b()Z
-
setFocused
public void setFocused(boolean focused) - Specified by:
setFocusedin interfaceElement- Mappings:
Namespace Name Mixin selector named setFocusedLnet/minecraft/client/gui/Element;setFocused(Z)Vintermediary method_25365Lnet/minecraft/class_364;method_25365(Z)Vofficial bLgle;b(Z)V
-
getType
- Specified by:
getTypein interfaceSelectable- Mappings:
Namespace Name Mixin selector named getTypeLnet/minecraft/client/gui/Selectable;getType()Lnet/minecraft/client/gui/Selectable$SelectionType;intermediary method_37018Lnet/minecraft/class_6379;method_37018()Lnet/minecraft/class_6379$class_6380;official yLgnt;y()Lgnt$a;
-
appendNarrations
- Specified by:
appendNarrationsin interfaceNarratable- Mappings:
Namespace Name Mixin selector named appendNarrationsLnet/minecraft/client/gui/Narratable;appendNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)Vintermediary method_37020Lnet/minecraft/class_6383;method_37020(Lnet/minecraft/class_6382;)Vofficial bLgnw;b(Lgnv;)V
-
appendClickableNarrations
- Mappings:
Namespace Name Mixin selector named appendClickableNarrationsLnet/minecraft/client/gui/widget/ClickableWidget;appendClickableNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)Vintermediary method_47399Lnet/minecraft/class_339;method_47399(Lnet/minecraft/class_6382;)Vofficial aLght;a(Lgnv;)V
-
appendDefaultNarrations
- Mappings:
Namespace Name Mixin selector named appendDefaultNarrationsLnet/minecraft/client/gui/widget/ClickableWidget;appendDefaultNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)Vintermediary method_37021Lnet/minecraft/class_339;method_37021(Lnet/minecraft/class_6382;)Vofficial cLght;c(Lgnv;)V
-
getX
public int getX() -
setX
public void setX(int x) -
getY
public int getY() -
setY
public void setY(int y) -
getRight
public int getRight()- Mappings:
Namespace Name Mixin selector named getRightLnet/minecraft/client/gui/widget/ClickableWidget;getRight()Iintermediary method_55442Lnet/minecraft/class_339;method_55442()Iofficial ELght;E()I
-
getBottom
public int getBottom()- Mappings:
Namespace Name Mixin selector named getBottomLnet/minecraft/client/gui/widget/ClickableWidget;getBottom()Iintermediary method_55443Lnet/minecraft/class_339;method_55443()Iofficial FLght;F()I
-
forEachChild
- Specified by:
forEachChildin interfaceWidget- Mappings:
Namespace Name Mixin selector named forEachChildLnet/minecraft/client/gui/widget/Widget;forEachChild(Ljava/util/function/Consumer;)Vintermediary method_48206Lnet/minecraft/class_8021;method_48206(Ljava/util/function/Consumer;)Vofficial aLgno;a(Ljava/util/function/Consumer;)V
-
setDimensions
public void setDimensions(int width, int height) - Mappings:
Namespace Name Mixin selector named setDimensionsLnet/minecraft/client/gui/widget/ClickableWidget;setDimensions(II)Vintermediary method_55445Lnet/minecraft/class_339;method_55445(II)Vofficial bLght;b(II)V
-
isInBounds
private boolean isInBounds(double x, double y) - Mappings:
Namespace Name Mixin selector named isInBoundsLnet/minecraft/client/gui/widget/ClickableWidget;isInBounds(DD)Zintermediary method_72102Lnet/minecraft/class_339;method_72102(DD)Zofficial bLght;b(DD)Z
-
setDimensionsAndPosition
public void setDimensionsAndPosition(int width, int height, int x, int y) - Mappings:
Namespace Name Mixin selector named setDimensionsAndPositionLnet/minecraft/client/gui/widget/ClickableWidget;setDimensionsAndPosition(IIII)Vintermediary method_55444Lnet/minecraft/class_339;method_55444(IIII)Vofficial bLght;b(IIII)V
-