Class AbstractWidget

java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
All Implemented Interfaces:
GuiEventListener, Renderable, TabOrderedElement, LayoutElement, NarratableEntry, NarrationSupplier
Direct Known Subclasses:
AbstractButton, AbstractContainerWidget, AbstractScrollWidget, AbstractSliderButton, AbstractStringWidget, EditBox, GameModeSwitcherScreen.GameModeSlot, ImageWidget, LoadingDotsWidget, OverlayRecipeComponent.OverlayRecipeButton, PlayerSkinWidget, RecipeButton, StateSwitchingButton, TabButton

public abstract class AbstractWidget extends Object implements Renderable, GuiEventListener, LayoutElement, NarratableEntry
  • Field Details

    • PERIOD_PER_SCROLLED_PIXEL

      private static final double PERIOD_PER_SCROLLED_PIXEL
      See Also:
    • MIN_SCROLL_PERIOD

      private static final double MIN_SCROLL_PERIOD
      See Also:
    • width

      protected int width
    • height

      protected int height
    • x

      private int x
    • y

      private int y
    • message

      private Component message
    • isHovered

      protected boolean isHovered
    • active

      public boolean active
    • visible

      public boolean visible
    • alpha

      protected float alpha
    • tabOrderGroup

      private int tabOrderGroup
    • focused

      private boolean focused
    • tooltip

      private final WidgetTooltipHolder tooltip
    • UNSET_FG_COLOR

      public static final int UNSET_FG_COLOR
      See Also:
    • packedFGColor

      protected int packedFGColor
  • Constructor Details

    • AbstractWidget

      public AbstractWidget(int p_93629_, int p_93630_, int p_93631_, int p_93632_, Component p_93633_)
  • Method Details

    • getHeight

      public int getHeight()
      Specified by:
      getHeight in interface LayoutElement
    • render

      public final void render(GuiGraphics p_282421_, int p_93658_, int p_93659_, float p_93660_)
      Specified by:
      render in interface Renderable
    • setTooltip

      public void setTooltip(@Nullable Tooltip p_259796_)
    • getTooltip

      @Nullable public Tooltip getTooltip()
    • setTooltipDelay

      public void setTooltipDelay(Duration p_334848_)
    • createNarrationMessage

      protected MutableComponent createNarrationMessage()
    • wrapDefaultNarrationMessage

      public static MutableComponent wrapDefaultNarrationMessage(Component p_168800_)
    • renderWidget

      protected abstract void renderWidget(GuiGraphics p_282139_, int p_268034_, int p_268009_, float p_268085_)
    • renderScrollingString

      protected static void renderScrollingString(GuiGraphics p_281620_, Font p_282651_, Component p_281467_, int p_283621_, int p_282084_, int p_283398_, int p_281938_, int p_283471_)
    • renderScrollingString

      protected static void renderScrollingString(GuiGraphics p_298878_, Font p_301352_, Component p_297799_, int p_300294_, int p_297733_, int p_298903_, int p_300338_, int p_297281_, int p_299081_)
    • renderScrollingString

      protected void renderScrollingString(GuiGraphics p_281857_, Font p_282790_, int p_282664_, int p_282944_)
    • onClick

      public void onClick(double p_93634_, double p_93635_)
    • onRelease

      public void onRelease(double p_93669_, double p_93670_)
    • onDrag

      protected void onDrag(double p_93636_, double p_93637_, double p_93638_, double p_93639_)
    • mouseClicked

      public boolean mouseClicked(double p_93641_, double p_93642_, int p_93643_)
      Specified by:
      mouseClicked in interface GuiEventListener
    • mouseReleased

      public boolean mouseReleased(double p_93684_, double p_93685_, int p_93686_)
      Specified by:
      mouseReleased in interface GuiEventListener
    • isValidClickButton

      protected boolean isValidClickButton(int p_93652_)
    • mouseDragged

      public boolean mouseDragged(double p_93645_, double p_93646_, int p_93647_, double p_93648_, double p_93649_)
      Specified by:
      mouseDragged in interface GuiEventListener
    • clicked

      protected boolean clicked(double p_93681_, double p_93682_)
    • nextFocusPath

      @Nullable public ComponentPath nextFocusPath(FocusNavigationEvent p_265640_)
      Specified by:
      nextFocusPath in interface GuiEventListener
    • isMouseOver

      public boolean isMouseOver(double p_93672_, double p_93673_)
      Specified by:
      isMouseOver in interface GuiEventListener
    • playDownSound

      public void playDownSound(SoundManager p_93665_)
    • getWidth

      public int getWidth()
      Specified by:
      getWidth in interface LayoutElement
    • setWidth

      public void setWidth(int p_93675_)
    • setHeight

      public void setHeight(int p_298443_)
    • setAlpha

      public void setAlpha(float p_93651_)
    • setMessage

      public void setMessage(Component p_93667_)
    • getMessage

      public Component getMessage()
    • isFocused

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

      public boolean isHovered()
    • isHoveredOrFocused

      public boolean isHoveredOrFocused()
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface NarratableEntry
    • setFocused

      public void setFocused(boolean p_93693_)
      Specified by:
      setFocused in interface GuiEventListener
    • getFGColor

      public int getFGColor()
    • setFGColor

      public void setFGColor(int color)
    • clearFGColor

      public void clearFGColor()
    • narrationPriority

      public NarratableEntry.NarrationPriority narrationPriority()
      Specified by:
      narrationPriority in interface NarratableEntry
    • updateNarration

      public final void updateNarration(NarrationElementOutput p_259921_)
      Specified by:
      updateNarration in interface NarrationSupplier
    • updateWidgetNarration

      protected abstract void updateWidgetNarration(NarrationElementOutput p_259858_)
    • defaultButtonNarrationText

      protected void defaultButtonNarrationText(NarrationElementOutput p_168803_)
    • getX

      public int getX()
      Specified by:
      getX in interface LayoutElement
    • setX

      public void setX(int p_254495_)
      Specified by:
      setX in interface LayoutElement
    • getY

      public int getY()
      Specified by:
      getY in interface LayoutElement
    • setY

      public void setY(int p_253718_)
      Specified by:
      setY in interface LayoutElement
    • getRight

      public int getRight()
    • getBottom

      public int getBottom()
    • visitWidgets

      public void visitWidgets(Consumer<AbstractWidget> p_265566_)
      Specified by:
      visitWidgets in interface LayoutElement
    • setSize

      public void setSize(int p_312975_, int p_312301_)
    • getRectangle

      public ScreenRectangle getRectangle()
      Specified by:
      getRectangle in interface GuiEventListener
      Specified by:
      getRectangle in interface LayoutElement
    • setRectangle

      public void setRectangle(int p_309908_, int p_310169_, int p_312247_, int p_310380_)
    • getTabOrderGroup

      public int getTabOrderGroup()
      Specified by:
      getTabOrderGroup in interface TabOrderedElement
    • setTabOrderGroup

      public void setTabOrderGroup(int p_268123_)