Class TemplateTextHud

All Implemented Interfaces:
SettingContainer

public class TemplateTextHud extends TextHUDElement
A HUD text element whose content is a user-editable template string. The template grammar (variables, functions, arithmetic) is evaluated by the
invalid reference
TemplateEngine
scripting package; this class only owns the element's persisted template + colour and wires evaluation into the HUD render path.
  • Field Details

  • Constructor Details

    • TemplateTextHud

      public TemplateTextHud(String id, int defaultX, int defaultY, String defaultTemplate)
  • Method Details

    • getScale

      public float getScale()
      The element scale rides the Scale setting (base slider is unused here).
      Overrides:
      getScale in class HUDElement
    • setScale

      public void setScale(float v)
      Description copied from class: HUDElement
      Set the per-element scale, snapping to the same GUI-scale-aware fraction stops as the Client tab.
      Overrides:
      setScale in class HUDElement
    • getTemplate

      public String getTemplate()
    • setTemplate

      public void setTemplate(String template)
    • getTextColor

      public int getTextColor()
    • buildText

      protected String buildText()
      Description copied from class: TextHUDElement
      The text string to display. Called every frame.
      Specified by:
      buildText in class TextHUDElement
    • buildSizingText

      protected net.minecraft.network.chat.Component buildSizingText()
      Measure against the full string so the box stays put while the text types/erases.
      Overrides:
      buildSizingText in class TextHUDElement
    • getColor

      protected int getColor()
      Description copied from class: TextHUDElement
      The ARGB color for the text. Called every frame.
      Specified by:
      getColor in class TextHUDElement
    • textX

      protected int textX(net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text)
      Aligns the partial text inside the box the full string reserved, following the element's resolved expand anchor — the same AUTO rule the editor uses, so an element parked on the right of the screen types against its right edge, one in the middle grows from the centre, and one on the left stays flush left. Without this the text would always hug the left edge of a box sized for the full string, leaving it visually detached from the edge it's anchored to.
      Overrides:
      textX in class TextHUDElement
    • evaluateTemplate

      protected String evaluateTemplate(String rawTemplate)