Class GuiTextList

All Implemented Interfaces:
ElementEvents, ForegroundRender, GuiParent<GuiTextList>, TooltipHandler<GuiTextList>

public class GuiTextList extends GuiElement<GuiTextList> implements ForegroundRender
Created by brandon3055 on 10/10/2023
  • Constructor Details

    • GuiTextList

      public GuiTextList(@NotNull @NotNull GuiParent<?> parent)
      Parameters:
      parent - parent GuiParent.
    • GuiTextList

      public GuiTextList(@NotNull @NotNull GuiParent<?> parent, List<? extends net.minecraft.network.chat.Component> text)
      Parameters:
      parent - parent GuiParent.
    • GuiTextList

      public GuiTextList(@NotNull @NotNull GuiParent<?> parent, @NotNull @NotNull Supplier<List<? extends net.minecraft.network.chat.Component>> text)
      Parameters:
      parent - parent GuiParent.
  • Method Details

    • autoHeight

      public GuiTextList autoHeight()
      Apply a dynamic height constraint that sets the height based on text height (accounting for wrapping)
    • setTextSupplier

      public GuiTextList setTextSupplier(@NotNull @NotNull Supplier<List<? extends net.minecraft.network.chat.Component>> textSupplier)
    • setText

      public GuiTextList setText(List<? extends net.minecraft.network.chat.Component> text)
    • getText

      public List<? extends net.minecraft.network.chat.Component> getText()
    • setHorizontalAlign

      public GuiTextList setHorizontalAlign(Align horizontalAlign)
    • setVerticalAlign

      public GuiTextList setVerticalAlign(Align verticalAlign)
    • getHorizontalAlign

      public Align getHorizontalAlign()
    • getVerticalAlign

      public Align getVerticalAlign()
    • setLineSpacing

      public GuiTextList setLineSpacing(int lineSpacing)
    • getLineSpacing

      public int getLineSpacing()
    • setScroll

      public GuiTextList setScroll(boolean scroll)
      Set to true the text scroll using the same logic as vanillas widgets if the text is too long to fit within the elements bounds Default enabled. Setting this to true will automatically disable trim and wrap ether are enabled.
    • getScroll

      public boolean getScroll()
    • setShadow

      public GuiTextList setShadow(@NotNull @NotNull Supplier<Boolean> shadow)
    • setShadow

      public GuiTextList setShadow(boolean shadow)
    • getShadow

      public boolean getShadow()
    • setTextColour

      public GuiTextList setTextColour(Supplier<Integer> textColour)
    • setTextColour

      public GuiTextList setTextColour(int textColour)
    • getTextColour

      public int getTextColour()
    • getForegroundDepth

      public double getForegroundDepth()
      Description copied from interface: ForegroundRender
      Specifies the z depth of the foreground content. Used when calculating the total depth of this gui element. Recommended minimum depth is 0.01 or 0.035 if this element renders text. (text shadows are rendered with a 0.03 offset)
      Specified by:
      getForegroundDepth in interface ForegroundRender
      Returns:
      the z height of the background content.
    • renderForeground

      public void renderForeground(GuiRender render, double mouseX, double mouseY, float partialTicks)
      Description copied from interface: ForegroundRender
      Used to render content in front of this elements child elements. When rendering element content, always use the PoseStack available via the provided GuiRender Where applicable, always use push/pop to ensure the stack is returned to its original state after your rendering is complete.
      Specified by:
      renderForeground in interface ForegroundRender
      Parameters:
      render - Contains gui context information as well as essential render methods/utils including the PoseStack.