Package net.minecraft.client.gui.widget
Class AbstractButtonWidget
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.widget.AbstractButtonWidget
- Direct Known Subclasses:
AbstractPressableButtonWidget,AnimatedResultButton,GameModeSelectionScreen.ButtonWidget,RecipeAlternativesWidget.AlternativeButtonWidget,SliderWidget,TextFieldWidget,ToggleButtonWidget
@Environment(CLIENT) public abstract class AbstractButtonWidget extends DrawableHelper implements Drawable, Element
- Mappings:
Namespace Name official dtmintermediary net/minecraft/class_339named net/minecraft/client/gui/widget/AbstractButtonWidget
-
Field Summary
Fields Modifier and Type Field Description booleanactiveprotected floatalphaprivate booleanfocusedprotected intheightprotected booleanhoveredprivate Textmessageprotected longnextNarrationbooleanvisibleprivate booleanwasHoveredstatic IdentifierWIDGETS_LOCATIONprotected intwidthintxintyFields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE -
Constructor Summary
Constructors Constructor Description AbstractButtonWidget(int x, int y, int width, int height, Text message) -
Method Summary
Modifier and Type Method Description booleanchangeFocus(boolean lookForwards)Changes the focusing element by cycling to the next/previous element.protected booleanclicked(double mouseX, double mouseY)intgetHeight()TextgetMessage()protected MutableTextgetNarrationMessage()static MutableTextgetNarrationMessage(Text message)intgetWidth()protected intgetYImage(boolean hovered)booleanisFocused()booleanisHovered()booleanisMouseOver(double mouseX, double mouseY)Checks if the mouse position is within the bound of the element.protected 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.protected voidnarrate()voidonClick(double mouseX, double mouseY)protected voidonDrag(double mouseX, double mouseY, double deltaX, double deltaY)protected voidonFocusedChanged(boolean bool)voidonRelease(double mouseX, double mouseY)voidplayDownSound(SoundManager soundManager)voidqueueNarration(int delay)voidrender(MatrixStack matrices, int mouseX, int mouseY, float delta)protected voidrenderBg(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY)voidrenderButton(MatrixStack matrices, int mouseX, int mouseY, float delta)voidrenderToolTip(MatrixStack matrices, int mouseX, int mouseY)voidsetAlpha(float value)protected voidsetFocused(boolean focused)voidsetMessage(Text message)voidsetWidth(int value)Methods inherited from class net.minecraft.client.gui.DrawableHelper
drawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, method_33284, setZOffsetMethods 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, keyPressed, keyReleased, mouseMoved, mouseScrolled
-
Field Details
-
WIDGETS_LOCATION
- Mappings:
Namespace Name Mixin selector official iLdtm;i:Lwl;intermediary field_22757Lnet/minecraft/class_339;field_22757:Lnet/minecraft/class_2960;named WIDGETS_LOCATIONLnet/minecraft/client/gui/widget/AbstractButtonWidget;WIDGETS_LOCATION:Lnet/minecraft/util/Identifier;
-
width
protected int width- Mappings:
Namespace Name Mixin selector official jLdtm;j:Iintermediary field_22758Lnet/minecraft/class_339;field_22758:Inamed widthLnet/minecraft/client/gui/widget/AbstractButtonWidget;width:I
-
height
protected int height- Mappings:
Namespace Name Mixin selector official kLdtm;k:Iintermediary field_22759Lnet/minecraft/class_339;field_22759:Inamed heightLnet/minecraft/client/gui/widget/AbstractButtonWidget;height:I
-
x
public int x- Mappings:
Namespace Name Mixin selector official lLdtm;l:Iintermediary field_22760Lnet/minecraft/class_339;field_22760:Inamed xLnet/minecraft/client/gui/widget/AbstractButtonWidget;x:I
-
y
public int y- Mappings:
Namespace Name Mixin selector official mLdtm;m:Iintermediary field_22761Lnet/minecraft/class_339;field_22761:Inamed yLnet/minecraft/client/gui/widget/AbstractButtonWidget;y:I
-
message
- Mappings:
Namespace Name Mixin selector official aLdtm;a:Loj;intermediary field_22754Lnet/minecraft/class_339;field_22754:Lnet/minecraft/class_2561;named messageLnet/minecraft/client/gui/widget/AbstractButtonWidget;message:Lnet/minecraft/text/Text;
-
wasHovered
private boolean wasHovered- Mappings:
Namespace Name Mixin selector official bLdtm;b:Zintermediary field_22755Lnet/minecraft/class_339;field_22755:Znamed wasHoveredLnet/minecraft/client/gui/widget/AbstractButtonWidget;wasHovered:Z
-
hovered
protected boolean hovered- Mappings:
Namespace Name Mixin selector official nLdtm;n:Zintermediary field_22762Lnet/minecraft/class_339;field_22762:Znamed hoveredLnet/minecraft/client/gui/widget/AbstractButtonWidget;hovered:Z
-
active
public boolean active- Mappings:
Namespace Name Mixin selector official oLdtm;o:Zintermediary field_22763Lnet/minecraft/class_339;field_22763:Znamed activeLnet/minecraft/client/gui/widget/AbstractButtonWidget;active:Z
-
visible
public boolean visible- Mappings:
Namespace Name Mixin selector official pLdtm;p:Zintermediary field_22764Lnet/minecraft/class_339;field_22764:Znamed visibleLnet/minecraft/client/gui/widget/AbstractButtonWidget;visible:Z
-
alpha
protected float alpha- Mappings:
Namespace Name Mixin selector official qLdtm;q:Fintermediary field_22765Lnet/minecraft/class_339;field_22765:Fnamed alphaLnet/minecraft/client/gui/widget/AbstractButtonWidget;alpha:F
-
nextNarration
protected long nextNarration- Mappings:
Namespace Name Mixin selector official rLdtm;r:Jintermediary field_22766Lnet/minecraft/class_339;field_22766:Jnamed nextNarrationLnet/minecraft/client/gui/widget/AbstractButtonWidget;nextNarration:J
-
focused
private boolean focused- Mappings:
Namespace Name Mixin selector official cLdtm;c:Zintermediary field_22756Lnet/minecraft/class_339;field_22756:Znamed focusedLnet/minecraft/client/gui/widget/AbstractButtonWidget;focused:Z
-
-
Constructor Details
-
AbstractButtonWidget
- Mappings:
Namespace Name Mixin selector official <init>Ldtm;<init>(IIIILoj;)Vintermediary <init>Lnet/minecraft/class_339;<init>(IIIILnet/minecraft/class_2561;)Vnamed <init>Lnet/minecraft/client/gui/widget/AbstractButtonWidget;<init>(IIIILnet/minecraft/text/Text;)V
-
-
Method Details
-
getHeight
public int getHeight()- Mappings:
Namespace Name Mixin selector official eLdtm;e()Iintermediary method_25364Lnet/minecraft/class_339;method_25364()Inamed getHeightLnet/minecraft/client/gui/widget/AbstractButtonWidget;getHeight()I
-
getYImage
protected int getYImage(boolean hovered)- Mappings:
Namespace Name Mixin selector official aLdtm;a(Z)Iintermediary method_25356Lnet/minecraft/class_339;method_25356(Z)Inamed getYImageLnet/minecraft/client/gui/widget/AbstractButtonWidget;getYImage(Z)I
-
render
- Specified by:
renderin interfaceDrawable- Mappings:
Namespace Name Mixin selector official aLduk;a(Ldnl;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
-
narrate
protected void narrate()- Mappings:
Namespace Name Mixin selector official fLdtm;f()Vintermediary method_25366Lnet/minecraft/class_339;method_25366()Vnamed narrateLnet/minecraft/client/gui/widget/AbstractButtonWidget;narrate()V
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector official cLdtm;c()Lop;intermediary method_25360Lnet/minecraft/class_339;method_25360()Lnet/minecraft/class_5250;named getNarrationMessageLnet/minecraft/client/gui/widget/AbstractButtonWidget;getNarrationMessage()Lnet/minecraft/text/MutableText;
-
getNarrationMessage
- Mappings:
Namespace Name Mixin selector official aLdtm;a(Loj;)Lop;intermediary method_32602Lnet/minecraft/class_339;method_32602(Lnet/minecraft/class_2561;)Lnet/minecraft/class_5250;named getNarrationMessageLnet/minecraft/client/gui/widget/AbstractButtonWidget;getNarrationMessage(Lnet/minecraft/text/Text;)Lnet/minecraft/text/MutableText;
-
renderButton
- Mappings:
Namespace Name Mixin selector official bLdtm;b(Ldnl;IIF)Vintermediary method_25359Lnet/minecraft/class_339;method_25359(Lnet/minecraft/class_4587;IIF)Vnamed renderButtonLnet/minecraft/client/gui/widget/AbstractButtonWidget;renderButton(Lnet/minecraft/client/util/math/MatrixStack;IIF)V
-
renderBg
- Mappings:
Namespace Name Mixin selector official aLdtm;a(Ldnl;Ldse;II)Vintermediary method_25353Lnet/minecraft/class_339;method_25353(Lnet/minecraft/class_4587;Lnet/minecraft/class_310;II)Vnamed renderBgLnet/minecraft/client/gui/widget/AbstractButtonWidget;renderBg(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 aLdtm;a(DD)Vintermediary method_25348Lnet/minecraft/class_339;method_25348(DD)Vnamed onClickLnet/minecraft/client/gui/widget/AbstractButtonWidget;onClick(DD)V
-
onRelease
public void onRelease(double mouseX, double mouseY)- Mappings:
Namespace Name Mixin selector official a_Ldtm;a_(DD)Vintermediary method_25357Lnet/minecraft/class_339;method_25357(DD)Vnamed onReleaseLnet/minecraft/client/gui/widget/AbstractButtonWidget;onRelease(DD)V
-
onDrag
protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY)- Mappings:
Namespace Name Mixin selector official aLdtm;a(DDDD)Vintermediary method_25349Lnet/minecraft/class_339;method_25349(DDDD)Vnamed onDragLnet/minecraft/client/gui/widget/AbstractButtonWidget;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:
Mouse.onMouseButton(long, int, int, int),GLFW.GLFW_MOUSE_BUTTON_1- Mappings:
Namespace Name Mixin selector official aLdun;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:
Mouse.onMouseButton(long, int, int, int),GLFW.GLFW_MOUSE_BUTTON_1- Mappings:
Namespace Name Mixin selector official cLdun;c(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 aLdtm;a(I)Zintermediary method_25351Lnet/minecraft/class_339;method_25351(I)Znamed isValidClickButtonLnet/minecraft/client/gui/widget/AbstractButtonWidget;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:
Mouse.onCursorPos(long, double, double),GLFW.GLFW_MOUSE_BUTTON_1- Mappings:
Namespace Name Mixin selector official aLdun;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 cLdtm;c(DD)Zintermediary method_25361Lnet/minecraft/class_339;method_25361(DD)Znamed clickedLnet/minecraft/client/gui/widget/AbstractButtonWidget;clicked(DD)Z
-
isHovered
public boolean isHovered()- Mappings:
Namespace Name Mixin selector official gLdtm;g()Zintermediary method_25367Lnet/minecraft/class_339;method_25367()Znamed isHoveredLnet/minecraft/client/gui/widget/AbstractButtonWidget;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:
changeFocusin interfaceElement- Parameters:
lookForwards-trueto cycle forwards, otherwise cycle backwards- Returns:
trueto indicate that the event handling is successful/valid- Mappings:
Namespace Name Mixin selector official c_Ldun;c_(Z)Zintermediary method_25407Lnet/minecraft/class_364;method_25407(Z)Znamed changeFocusLnet/minecraft/client/gui/Element;changeFocus(Z)Z
-
onFocusedChanged
protected void onFocusedChanged(boolean bool)- Mappings:
Namespace Name Mixin selector official cLdtm;c(Z)Vintermediary method_25363Lnet/minecraft/class_339;method_25363(Z)Vnamed onFocusedChangedLnet/minecraft/client/gui/widget/AbstractButtonWidget;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:
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 bLdun;b(DD)Zintermediary method_25405Lnet/minecraft/class_364;method_25405(DD)Znamed isMouseOverLnet/minecraft/client/gui/Element;isMouseOver(DD)Z
-
renderToolTip
- Mappings:
Namespace Name Mixin selector official aLdtm;a(Ldnl;II)Vintermediary method_25352Lnet/minecraft/class_339;method_25352(Lnet/minecraft/class_4587;II)Vnamed renderToolTipLnet/minecraft/client/gui/widget/AbstractButtonWidget;renderToolTip(Lnet/minecraft/client/util/math/MatrixStack;II)V
-
playDownSound
- Mappings:
Namespace Name Mixin selector official aLdtm;a(Lexg;)Vintermediary method_25354Lnet/minecraft/class_339;method_25354(Lnet/minecraft/class_1144;)Vnamed playDownSoundLnet/minecraft/client/gui/widget/AbstractButtonWidget;playDownSound(Lnet/minecraft/client/sound/SoundManager;)V
-
getWidth
public int getWidth()- Mappings:
Namespace Name Mixin selector official hLdtm;h()Iintermediary method_25368Lnet/minecraft/class_339;method_25368()Inamed getWidthLnet/minecraft/client/gui/widget/AbstractButtonWidget;getWidth()I
-
setWidth
public void setWidth(int value)- Mappings:
Namespace Name Mixin selector official bLdtm;b(I)Vintermediary method_25358Lnet/minecraft/class_339;method_25358(I)Vnamed setWidthLnet/minecraft/client/gui/widget/AbstractButtonWidget;setWidth(I)V
-
setAlpha
public void setAlpha(float value)- Mappings:
Namespace Name Mixin selector official aLdtm;a(F)Vintermediary method_25350Lnet/minecraft/class_339;method_25350(F)Vnamed setAlphaLnet/minecraft/client/gui/widget/AbstractButtonWidget;setAlpha(F)V
-
setMessage
- Mappings:
Namespace Name Mixin selector official bLdtm;b(Loj;)Vintermediary method_25355Lnet/minecraft/class_339;method_25355(Lnet/minecraft/class_2561;)Vnamed setMessageLnet/minecraft/client/gui/widget/AbstractButtonWidget;setMessage(Lnet/minecraft/text/Text;)V
-
queueNarration
public void queueNarration(int delay)- Mappings:
Namespace Name Mixin selector official cLdtm;c(I)Vintermediary method_25362Lnet/minecraft/class_339;method_25362(I)Vnamed queueNarrationLnet/minecraft/client/gui/widget/AbstractButtonWidget;queueNarration(I)V
-
getMessage
- Mappings:
Namespace Name Mixin selector official iLdtm;i()Loj;intermediary method_25369Lnet/minecraft/class_339;method_25369()Lnet/minecraft/class_2561;named getMessageLnet/minecraft/client/gui/widget/AbstractButtonWidget;getMessage()Lnet/minecraft/text/Text;
-
isFocused
public boolean isFocused()- Mappings:
Namespace Name Mixin selector official jLdtm;j()Zintermediary method_25370Lnet/minecraft/class_339;method_25370()Znamed isFocusedLnet/minecraft/client/gui/widget/AbstractButtonWidget;isFocused()Z
-
setFocused
protected void setFocused(boolean focused)- Mappings:
Namespace Name Mixin selector official dLdtm;d(Z)Vintermediary method_25365Lnet/minecraft/class_339;method_25365(Z)Vnamed setFocusedLnet/minecraft/client/gui/widget/AbstractButtonWidget;setFocused(Z)V
-