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:
Drawable
,Element
,Narratable
,Selectable
- Direct Known Subclasses:
AnimatedResultButton
,GameModeSelectionScreen.ButtonWidget
,PressableWidget
,RecipeAlternativesWidget.AlternativeButtonWidget
,SliderWidget
,TextFieldWidget
,ToggleButtonWidget
@Environment(CLIENT)
public abstract class ClickableWidget
extends DrawableHelper
implements Drawable, Element, 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 dwx
intermediary net/minecraft/class_339
named net/minecraft/client/gui/widget/ClickableWidget
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.Selectable
Selectable.SelectionType
-
Field Summary
Modifier and TypeFieldDescriptionboolean
protected float
private boolean
protected int
protected boolean
private Text
boolean
static final Identifier
protected int
int
int
Fields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
changeFocus
(boolean lookForwards) Changes the focusing element by cycling to the next/previous element.protected boolean
clicked
(double mouseX, double mouseY) int
protected MutableText
static MutableText
getNarrationMessage
(Text message) getType()
int
getWidth()
protected int
getYImage
(boolean hovered) boolean
boolean
boolean
isMouseOver
(double mouseX, double mouseY) Checks if the mouse position is within the bound of the element.protected boolean
isValidClickButton
(int button) protected void
method_37021
(NarrationMessageBuilder narrationMessageBuilder) boolean
boolean
mouseClicked
(double mouseX, double mouseY, int button) Callback for when a mouse button down event has been captured.boolean
mouseDragged
(double mouseX, double mouseY, int button, double deltaX, double deltaY) Callback for when a mouse button drag event has been captured.boolean
mouseReleased
(double mouseX, double mouseY, int button) Callback for when a mouse button release event has been captured.void
onClick
(double mouseX, double mouseY) protected void
onDrag
(double mouseX, double mouseY, double deltaX, double deltaY) protected void
onFocusedChanged
(boolean newFocused) void
onRelease
(double mouseX, double mouseY) void
playDownSound
(SoundManager soundManager) void
render
(MatrixStack matrices, int mouseX, int mouseY, float delta) protected void
renderBackground
(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY) void
renderButton
(MatrixStack matrices, int mouseX, int mouseY, float delta) void
renderToolTip
(MatrixStack matrices, int mouseX, int mouseY) void
setAlpha
(float value) protected void
setFocused
(boolean focused) void
setMessage
(Text message) void
setWidth
(int value) Methods inherited from class net.minecraft.client.gui.DrawableHelper
drawCenteredText, drawCenteredText, drawCenteredTextWithShadow, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, drawWithOutline, drawWithShadow, fill, fillGradient, fillGradient, fillGradient, getZOffset, setZOffset
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.client.gui.Element
charTyped, keyPressed, keyReleased, mouseMoved, mouseScrolled
Methods inherited from interface net.minecraft.client.gui.Narratable
appendNarrations
-
Field Details
-
WIDGETS_TEXTURE
- Mappings:
Namespace Name Mixin selector official i
Ldwx;i:Lww;
intermediary field_22757
Lnet/minecraft/class_339;field_22757:Lnet/minecraft/class_2960;
named WIDGETS_TEXTURE
Lnet/minecraft/client/gui/widget/ClickableWidget;WIDGETS_TEXTURE:Lnet/minecraft/util/Identifier;
-
width
protected int width- Mappings:
Namespace Name Mixin selector official j
Ldwx;j:I
intermediary field_22758
Lnet/minecraft/class_339;field_22758:I
named width
Lnet/minecraft/client/gui/widget/ClickableWidget;width:I
-
height
protected int height- Mappings:
Namespace Name Mixin selector official k
Ldwx;k:I
intermediary field_22759
Lnet/minecraft/class_339;field_22759:I
named height
Lnet/minecraft/client/gui/widget/ClickableWidget;height:I
-
x
public int x- Mappings:
Namespace Name Mixin selector official l
Ldwx;l:I
intermediary field_22760
Lnet/minecraft/class_339;field_22760:I
named x
Lnet/minecraft/client/gui/widget/ClickableWidget;x:I
-
y
public int y- Mappings:
Namespace Name Mixin selector official m
Ldwx;m:I
intermediary field_22761
Lnet/minecraft/class_339;field_22761:I
named y
Lnet/minecraft/client/gui/widget/ClickableWidget;y:I
-
message
- Mappings:
Namespace Name Mixin selector official a
Ldwx;a:Los;
intermediary field_22754
Lnet/minecraft/class_339;field_22754:Lnet/minecraft/class_2561;
named message
Lnet/minecraft/client/gui/widget/ClickableWidget;message:Lnet/minecraft/text/Text;
-
hovered
protected boolean hovered- Mappings:
Namespace Name Mixin selector official n
Ldwx;n:Z
intermediary field_22762
Lnet/minecraft/class_339;field_22762:Z
named hovered
Lnet/minecraft/client/gui/widget/ClickableWidget;hovered:Z
-
active
public boolean active- Mappings:
Namespace Name Mixin selector official o
Ldwx;o:Z
intermediary field_22763
Lnet/minecraft/class_339;field_22763:Z
named active
Lnet/minecraft/client/gui/widget/ClickableWidget;active:Z
-
visible
public boolean visible- Mappings:
Namespace Name Mixin selector official p
Ldwx;p:Z
intermediary field_22764
Lnet/minecraft/class_339;field_22764:Z
named visible
Lnet/minecraft/client/gui/widget/ClickableWidget;visible:Z
-
alpha
protected float alpha- Mappings:
Namespace Name Mixin selector official q
Ldwx;q:F
intermediary field_22765
Lnet/minecraft/class_339;field_22765:F
named alpha
Lnet/minecraft/client/gui/widget/ClickableWidget;alpha:F
-
focused
private boolean focused- Mappings:
Namespace Name Mixin selector official b
Ldwx;b:Z
intermediary field_22756
Lnet/minecraft/class_339;field_22756:Z
named focused
Lnet/minecraft/client/gui/widget/ClickableWidget;focused:Z
-
-
Constructor Details
-
ClickableWidget
- Mappings:
Namespace Name Mixin selector official <init>
Ldwx;<init>(IIIILos;)V
intermediary <init>
Lnet/minecraft/class_339;<init>(IIIILnet/minecraft/class_2561;)V
named <init>
Lnet/minecraft/client/gui/widget/ClickableWidget;<init>(IIIILnet/minecraft/text/Text;)V
-
-
Method Details
-
getHeight
public int getHeight()- Mappings:
Namespace Name Mixin selector official d
Ldwx;d()I
intermediary method_25364
Lnet/minecraft/class_339;method_25364()I
named getHeight
Lnet/minecraft/client/gui/widget/ClickableWidget;getHeight()I
-
getYImage
protected int getYImage(boolean hovered) - Mappings:
Namespace Name Mixin selector official a
Ldwx;a(Z)I
intermediary method_25356
Lnet/minecraft/class_339;method_25356(Z)I
named getYImage
Lnet/minecraft/client/gui/widget/ClickableWidget;getYImage(Z)I
-
render
- Specified by:
render
in interfaceDrawable
- Mappings:
Namespace Name Mixin selector official a
Ldxu;a(Ldqk;IIF)V
intermediary method_25394
Lnet/minecraft/class_4068;method_25394(Lnet/minecraft/class_4587;IIF)V
named render
Lnet/minecraft/client/gui/Drawable;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector official ak_
Ldwx;ak_()Loy;
intermediary method_25360
Lnet/minecraft/class_339;method_25360()Lnet/minecraft/class_5250;
named getNarrationMessage
Lnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage()Lnet/minecraft/text/MutableText;
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector official a
Ldwx;a(Los;)Loy;
intermediary method_32602
Lnet/minecraft/class_339;method_32602(Lnet/minecraft/class_2561;)Lnet/minecraft/class_5250;
named getNarrationMessage
Lnet/minecraft/client/gui/widget/ClickableWidget;getNarrationMessage(Lnet/minecraft/text/Text;)Lnet/minecraft/text/MutableText;
-
renderButton
- Mappings:
Namespace Name Mixin selector official b
Ldwx;b(Ldqk;IIF)V
intermediary method_25359
Lnet/minecraft/class_339;method_25359(Lnet/minecraft/class_4587;IIF)V
named renderButton
Lnet/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 a
Ldwx;a(Ldqk;Ldvo;II)V
intermediary method_25353
Lnet/minecraft/class_339;method_25353(Lnet/minecraft/class_4587;Lnet/minecraft/class_310;II)V
named renderBackground
Lnet/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 a
Ldwx;a(DD)V
intermediary method_25348
Lnet/minecraft/class_339;method_25348(DD)V
named onClick
Lnet/minecraft/client/gui/widget/ClickableWidget;onClick(DD)V
-
onRelease
public void onRelease(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector official b
Ldwx;b(DD)V
intermediary method_25357
Lnet/minecraft/class_339;method_25357(DD)V
named onRelease
Lnet/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 a
Ldwx;a(DDDD)V
intermediary method_25349
Lnet/minecraft/class_339;method_25349(DDDD)V
named onDrag
Lnet/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 inGLFW
class.- Specified by:
mouseClicked
in interfaceElement
- Parameters:
mouseX
- the X coordinate of the mousemouseY
- the Y coordinate of the mousebutton
- the mouse button number- Returns:
true
to indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector official a
Ldxx;a(DDI)Z
intermediary method_25402
Lnet/minecraft/class_364;method_25402(DDI)Z
named mouseClicked
Lnet/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 inGLFW
class.- Specified by:
mouseReleased
in interfaceElement
- Parameters:
mouseX
- the X coordinate of the mousemouseY
- the Y coordinate of the mousebutton
- the mouse button number- Returns:
true
to indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector official c
Ldxx;c(DDI)Z
intermediary method_25406
Lnet/minecraft/class_364;method_25406(DDI)Z
named mouseReleased
Lnet/minecraft/client/gui/Element;mouseReleased(DDI)Z
-
isValidClickButton
protected boolean isValidClickButton(int button) - Mappings:
Namespace Name Mixin selector official d_
Ldwx;d_(I)Z
intermediary method_25351
Lnet/minecraft/class_339;method_25351(I)Z
named isValidClickButton
Lnet/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 inGLFW
class.- Specified by:
mouseDragged
in 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:
true
to indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector official a
Ldxx;a(DDIDD)Z
intermediary method_25403
Lnet/minecraft/class_364;method_25403(DDIDD)Z
named mouseDragged
Lnet/minecraft/client/gui/Element;mouseDragged(DDIDD)Z
-
clicked
protected boolean clicked(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector official c
Ldwx;c(DD)Z
intermediary method_25361
Lnet/minecraft/class_339;method_25361(DD)Z
named clicked
Lnet/minecraft/client/gui/widget/ClickableWidget;clicked(DD)Z
-
isHovered
public boolean isHovered()- Mappings:
Namespace Name Mixin selector official e
Ldwx;e()Z
intermediary method_25367
Lnet/minecraft/class_339;method_25367()Z
named isHovered
Lnet/minecraft/client/gui/widget/ClickableWidget;isHovered()Z
-
changeFocus
public boolean changeFocus(boolean lookForwards) Changes the focusing element by cycling to the next/previous element. This action is done typically when the user has pressed the 'Tab' or 'Ctrl+Tab' key.- Specified by:
changeFocus
in interfaceElement
- Parameters:
lookForwards
-true
to cycle forwards, otherwise cycle backwards- Returns:
true
to indicate that the event handling is successful/valid- Mappings:
Namespace Name Mixin selector official b
Ldxx;b(Z)Z
intermediary method_25407
Lnet/minecraft/class_364;method_25407(Z)Z
named changeFocus
Lnet/minecraft/client/gui/Element;changeFocus(Z)Z
-
onFocusedChanged
protected void onFocusedChanged(boolean newFocused) - Mappings:
Namespace Name Mixin selector official c
Ldwx;c(Z)V
intermediary method_25363
Lnet/minecraft/class_339;method_25363(Z)V
named onFocusedChanged
Lnet/minecraft/client/gui/widget/ClickableWidget;onFocusedChanged(Z)V
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) Checks if the mouse position is within the bound of the element.- Specified by:
isMouseOver
in interfaceElement
- Parameters:
mouseX
- the X coordinate of the mousemouseY
- the Y coordinate of the mouse- Returns:
true
if the mouse is within the bound of the element, otherwisefalse
- Mappings:
Namespace Name Mixin selector official a_
Ldxx;a_(DD)Z
intermediary method_25405
Lnet/minecraft/class_364;method_25405(DD)Z
named isMouseOver
Lnet/minecraft/client/gui/Element;isMouseOver(DD)Z
-
renderToolTip
- Mappings:
Namespace Name Mixin selector official a
Ldwx;a(Ldqk;II)V
intermediary method_25352
Lnet/minecraft/class_339;method_25352(Lnet/minecraft/class_4587;II)V
named renderToolTip
Lnet/minecraft/client/gui/widget/ClickableWidget;renderToolTip(Lnet/minecraft/client/util/math/MatrixStack;II)V
-
playDownSound
- Mappings:
Namespace Name Mixin selector official a
Ldwx;a(Lfbc;)V
intermediary method_25354
Lnet/minecraft/class_339;method_25354(Lnet/minecraft/class_1144;)V
named playDownSound
Lnet/minecraft/client/gui/widget/ClickableWidget;playDownSound(Lnet/minecraft/client/sound/SoundManager;)V
-
getWidth
public int getWidth()- Mappings:
Namespace Name Mixin selector official f
Ldwx;f()I
intermediary method_25368
Lnet/minecraft/class_339;method_25368()I
named getWidth
Lnet/minecraft/client/gui/widget/ClickableWidget;getWidth()I
-
setWidth
public void setWidth(int value) - Mappings:
Namespace Name Mixin selector official b
Ldwx;b(I)V
intermediary method_25358
Lnet/minecraft/class_339;method_25358(I)V
named setWidth
Lnet/minecraft/client/gui/widget/ClickableWidget;setWidth(I)V
-
setAlpha
public void setAlpha(float value) - Mappings:
Namespace Name Mixin selector official a
Ldwx;a(F)V
intermediary method_25350
Lnet/minecraft/class_339;method_25350(F)V
named setAlpha
Lnet/minecraft/client/gui/widget/ClickableWidget;setAlpha(F)V
-
setMessage
- Mappings:
Namespace Name Mixin selector official b
Ldwx;b(Los;)V
intermediary method_25355
Lnet/minecraft/class_339;method_25355(Lnet/minecraft/class_2561;)V
named setMessage
Lnet/minecraft/client/gui/widget/ClickableWidget;setMessage(Lnet/minecraft/text/Text;)V
-
getMessage
- Mappings:
Namespace Name Mixin selector official g
Ldwx;g()Los;
intermediary method_25369
Lnet/minecraft/class_339;method_25369()Lnet/minecraft/class_2561;
named getMessage
Lnet/minecraft/client/gui/widget/ClickableWidget;getMessage()Lnet/minecraft/text/Text;
-
isFocused
public boolean isFocused()- Mappings:
Namespace Name Mixin selector official h
Ldwx;h()Z
intermediary method_25370
Lnet/minecraft/class_339;method_25370()Z
named isFocused
Lnet/minecraft/client/gui/widget/ClickableWidget;isFocused()Z
-
method_37303
public boolean method_37303()- Specified by:
method_37303
in interfaceSelectable
- Mappings:
Namespace Name Mixin selector official al_
Ldza;al_()Z
intermediary method_37303
Lnet/minecraft/class_6379;method_37303()Z
named method_37303
Lnet/minecraft/client/gui/Selectable;method_37303()Z
-
setFocused
protected void setFocused(boolean focused) - Mappings:
Namespace Name Mixin selector official d
Ldwx;d(Z)V
intermediary method_25365
Lnet/minecraft/class_339;method_25365(Z)V
named setFocused
Lnet/minecraft/client/gui/widget/ClickableWidget;setFocused(Z)V
-
getType
- Specified by:
getType
in interfaceSelectable
- Mappings:
Namespace Name Mixin selector official t
Ldza;t()Ldza$a;
intermediary method_37018
Lnet/minecraft/class_6379;method_37018()Lnet/minecraft/class_6379$class_6380;
named getType
Lnet/minecraft/client/gui/Selectable;getType()Lnet/minecraft/client/gui/Selectable$SelectionType;
-
method_37021
- Mappings:
Namespace Name Mixin selector official b
Ldwx;b(Ldzc;)V
intermediary method_37021
Lnet/minecraft/class_339;method_37021(Lnet/minecraft/class_6382;)V
named method_37021
Lnet/minecraft/client/gui/widget/ClickableWidget;method_37021(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V
-