Class ClickableWidget
java.lang.Object
net.minecraft.src.Gui
emi.shims.java.net.minecraft.client.gui.widget.ClickableWidget
- Direct Known Subclasses:
ButtonWidget,TextFieldWidget
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ResourceLocationbooleanprotected floatprotected intprotected booleanbooleanstatic final ResourceLocationprotected intintintFields inherited from class net.minecraft.src.Gui
icons, optionsBackground, statIcons, zLevel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanclicked(double mouseX, double mouseY) voiddrawTexture(MatrixStack matrices, ResourceLocation texture, int x, int y, int u, int v, int hoveredVOffset, int width, int height, int textureWidth, int textureHeight) voidforEachChild(Consumer<ClickableWidget> consumer) intprotected TooltipPositionergetType()intgetWidth()intgetX()intgetY()booleanbooleanbooleanisMouseOver(double mouseX, double mouseY) booleanbooleanprotected booleanisValidClickButton(int button) booleanmouseClicked(double mouseX, double mouseY, int button) booleanmouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) booleanmouseReleased(double mouseX, double mouseY, int button) voidonClick(double mouseX, double mouseY) protected voidonDrag(double mouseX, double mouseY, double deltaX, double deltaY) voidonRelease(double mouseX, double mouseY) voidvoidrender(DrawContext draw, int mouseX, int mouseY, float delta) abstract voidrenderButton(MatrixStack var1, int var2, int var3, float var4) voidsetAlpha(float alpha) voidsetFocused(boolean focused) voidsetMessage(Text message) voidsetTooltip(@Nullable List<TooltipComponent> tooltip) voidsetTooltipDelay(int delay) voidsetWidth(int width) voidsetX(int x) voidsetY(int y) Methods inherited from class net.minecraft.src.Gui
drawCenteredString, drawGradientRect, drawHorizontalLine, drawRect, drawString, drawTexturedModalRect, drawTexturedModelRectFromIcon, drawVerticalLineMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface emi.shims.java.net.minecraft.client.gui.Element
charTyped, keyPressed, keyReleased, mouseMoved, mouseScrolled
-
Field Details
-
WIDGETS_TEXTURE
-
ACCESSIBILITY_TEXTURE
-
width
protected int width -
height
protected int height -
x
public int x -
y
public int y -
hovered
protected boolean hovered -
active
public boolean active -
visible
public boolean visible -
alpha
protected float alpha
-
-
Constructor Details
-
ClickableWidget
-
-
Method Details
-
getHeight
public int getHeight() -
render
-
getTooltipPositioner
-
setTooltip
-
setTooltipDelay
public void setTooltipDelay(int delay) -
renderButton
-
drawTexture
public void drawTexture(MatrixStack matrices, ResourceLocation texture, int x, int y, int u, int v, int hoveredVOffset, int width, int height, int textureWidth, int textureHeight) -
onClick
public void onClick(double mouseX, double mouseY) -
onRelease
public void onRelease(double mouseX, double mouseY) -
onDrag
protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY) -
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) - Specified by:
mouseClickedin interfaceElement
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int button) - Specified by:
mouseReleasedin interfaceElement
-
isValidClickButton
protected boolean isValidClickButton(int button) -
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) - Specified by:
mouseDraggedin interfaceElement
-
clicked
protected boolean clicked(double mouseX, double mouseY) -
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) - Specified by:
isMouseOverin interfaceElement
-
playDownSound
public void playDownSound() -
getWidth
public int getWidth() -
setWidth
public void setWidth(int width) -
setAlpha
public void setAlpha(float alpha) -
setMessage
-
getMessage
-
isFocused
public boolean isFocused() -
isHovered
public boolean isHovered() -
isSelected
public boolean isSelected() -
isNarratable
public boolean isNarratable() -
setFocused
public void setFocused(boolean focused) - Specified by:
setFocusedin interfaceElement
-
getType
-
getX
public int getX() -
setX
public void setX(int x) -
getY
public int getY() -
setY
public void setY(int y) -
forEachChild
-