Class TextHUDElement

java.lang.Object
me.hackware.api.hud.HUDElement
me.hackware.api.hud.TextHUDElement
All Implemented Interfaces:
SettingContainer
Direct Known Subclasses:
TemplateTextHud, TextListHUDElement

public abstract class TextHUDElement extends HUDElement
Base class for simple single-line text HUD elements. Subclasses only need to provide buildText() and getColor().
  • Field Details

  • Constructor Details

    • TextHUDElement

      protected TextHUDElement(String id, int defaultX, int defaultY)
  • Method Details

    • buildText

      protected abstract String buildText()
      The text string to display. Called every frame.
    • getColor

      protected abstract int getColor()
      The ARGB color for the text. Called every frame.
    • buildDisplayText

      protected net.minecraft.network.chat.Component buildDisplayText()
    • buildSizingText

      protected net.minecraft.network.chat.Component buildSizingText()
      Text the box is measured against. Defaults to what's drawn; elements whose drawn text animates (typewriter) return the full string here so the box doesn't breathe frame to frame.
    • updateSize

      protected void updateSize(net.minecraft.client.gui.Font font)
      Specified by:
      updateSize in class HUDElement
    • textX

      protected int textX(net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text)
      Where the drawn text starts inside the box. Only matters when the drawn text can be narrower than the box the sizing text reserved — see the typewriter in TemplateTextHud, which aligns the partial text to the element's resolved expand anchor.
    • renderContent

      protected void renderContent(net.minecraft.client.gui.GuiGraphics graphics, net.minecraft.client.gui.Font font)
      Specified by:
      renderContent in class HUDElement