Class ClickableWidget

java.lang.Object
net.minecraft.src.Gui
emi.shims.java.net.minecraft.client.gui.widget.ClickableWidget
All Implemented Interfaces:
Drawable, Element
Direct Known Subclasses:
ButtonWidget, TextFieldWidget

@Environment(CLIENT) public abstract class ClickableWidget extends Gui implements Drawable, Element
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.
  • Field Details

    • WIDGETS_TEXTURE

      public static final ResourceLocation WIDGETS_TEXTURE
    • ACCESSIBILITY_TEXTURE

      public static final ResourceLocation 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

      public ClickableWidget(int x, int y, int width, int height, Text message)
  • Method Details

    • getHeight

      public int getHeight()
    • render

      public void render(DrawContext draw, int mouseX, int mouseY, float delta)
      Specified by:
      render in interface Drawable
    • getTooltipPositioner

      protected TooltipPositioner getTooltipPositioner()
    • setTooltip

      public void setTooltip(@Nullable @Nullable List<TooltipComponent> tooltip)
    • setTooltipDelay

      public void setTooltipDelay(int delay)
    • renderButton

      public abstract void renderButton(MatrixStack var1, int var2, int var3, float var4)
    • 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:
      mouseClicked in interface Element
    • mouseReleased

      public boolean mouseReleased(double mouseX, double mouseY, int button)
      Specified by:
      mouseReleased in interface Element
    • isValidClickButton

      protected boolean isValidClickButton(int button)
    • mouseDragged

      public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
      Specified by:
      mouseDragged in interface Element
    • clicked

      protected boolean clicked(double mouseX, double mouseY)
    • isMouseOver

      public boolean isMouseOver(double mouseX, double mouseY)
      Specified by:
      isMouseOver in interface Element
    • playDownSound

      public void playDownSound()
    • getWidth

      public int getWidth()
    • setWidth

      public void setWidth(int width)
    • setAlpha

      public void setAlpha(float alpha)
    • setMessage

      public void setMessage(Text message)
    • getMessage

      public Text getMessage()
    • isFocused

      public boolean isFocused()
      Specified by:
      isFocused in interface Element
    • isHovered

      public boolean isHovered()
    • isSelected

      public boolean isSelected()
    • isNarratable

      public boolean isNarratable()
    • setFocused

      public void setFocused(boolean focused)
      Specified by:
      setFocused in interface Element
    • getType

    • getX

      public int getX()
    • setX

      public void setX(int x)
    • getY

      public int getY()
    • setY

      public void setY(int y)
    • forEachChild

      public void forEachChild(Consumer<ClickableWidget> consumer)