Class TextListHUDElement

All Implemented Interfaces:
SettingContainer

public abstract class TextListHUDElement extends TextHUDElement
Base class for list-style HUD elements (potion timers, entity radar, item radar, visual range). Provides shared settings, config persistence helpers, editor state management, and utilities.
  • Field Details

  • Constructor Details

    • TextListHUDElement

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

    • registerListGroup

      protected void registerListGroup(Setting<?> animate, Setting<?> filter, Setting<?> maxEntries, Setting<?> sortBy)
      Registers the standard List group (Alignment, [Animate], [Filter], Gap, Indent, [Max Entries], Sorting{Order, [Sort By]}, Title). Null slots are omitted. Call from the element constructor AFTER its other groups so List lands last in the window.
    • migrateListKeys

      protected void migrateListKeys()
      Legacy shared list keys → the standard slug paths.
    • legacyIdList

      protected static Object legacyIdList(Object raw)
      Legacy selected-ids value (real yml list or comma-joined string) → a real string list.
    • migrateIconKeys

      protected void migrateIconKeys(String basePath, boolean defaultShown)
      Legacy icon keys (iconMode / showIcons+iconPosition / size / spacing) → basePath.
    • buildText

      protected String buildText()
      Description copied from class: TextHUDElement
      The text string to display. Called every frame.
      Specified by:
      buildText 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
    • key

      protected String key(String name)
    • effectiveLineGap

      protected int effectiveLineGap()
      Effective gap used for rendering (user value + 2).
    • sortDescending

      protected boolean sortDescending()
      Whether the active sort order reverses the comparator. Lists that always grow downward read AUTO as ascending; direction-aware lists override.
    • effectiveItemIndent

      protected int effectiveItemIndent()
      Returns the effective item indent (0 when centered).
    • iconsShown

      protected boolean iconsShown()
    • setInEditor

      public void setInEditor(boolean inEditor)
    • renderEditor

      public void renderEditor(net.minecraft.client.gui.GuiGraphics graphics, net.minecraft.client.gui.Font font, float textScale)
      Overrides:
      renderEditor in class HUDElement
    • render

      public void render(net.minecraft.client.gui.GuiGraphics graphics, net.minecraft.client.gui.Font font, float textScale)
      Overrides:
      render in class HUDElement
    • updateEditorSize

      public void updateEditorSize(net.minecraft.client.gui.Font font)
      Description copied from class: HUDElement
      Update width/height as the editor would see them (with placeholder content). Subclasses that report 0 size outside the editor should override this.
      Overrides:
      updateEditorSize in class HUDElement
    • resolveTitle

      protected abstract String resolveTitle()
    • resolveTitleComponent

      protected net.minecraft.network.chat.Component resolveTitleComponent()
    • resolveAlignment

      protected TextListHUDElement.Alignment resolveAlignment()
    • resolveAlignmentByScreenThirds

      protected TextListHUDElement.Alignment resolveAlignmentByScreenThirds()
      Legacy screen-third alignment fallback retained for list implementations that need it.
    • applyAlpha

      protected static int applyAlpha(int color, float alpha)