Class AbstractSectionWithTitle<T extends AbstractSectionWithTitle<T>>

java.lang.Object
net.mcexpanded.fancytabsections.Section.AbstractSectionWithTitle<T>
All Implemented Interfaces:
Section<T>, StickySection
Direct Known Subclasses:
SectionColored, SectionTextured

public abstract class AbstractSectionWithTitle<T extends AbstractSectionWithTitle<T>> extends Object implements Section<T>, StickySection
Since:
4.0
  • Field Details

    • title

      public net.minecraft.network.chat.Component title
    • renderTitle

      public boolean renderTitle
    • titleOffsetX

      public int titleOffsetX
    • titleOffsetY

      public int titleOffsetY
    • textColor

      public int textColor
    • textOutline

      public int textOutline
    • textShadow

      public boolean textShadow
  • Constructor Details

    • AbstractSectionWithTitle

      public AbstractSectionWithTitle(net.minecraft.resources.ResourceLocation id)
  • Method Details

    • render

      public void render(net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.client.gui.Font font, int topLeftX, int topLeftY)
      Specified by:
      render in interface Section<T extends AbstractSectionWithTitle<T>>
    • renderTitle

      public void renderTitle(net.minecraft.client.gui.GuiGraphics guiGraphics, net.minecraft.client.gui.Font font, int topLeftX, int topLeftY)
    • setTitle

      public T setTitle(net.minecraft.network.chat.Component component)
    • setTitle

      public T setTitle(String title)
    • setRenderTitle

      public T setRenderTitle(boolean renderTitle)
      Sets whether the title should render.
      Since:
      6.0
    • setDisplayItem

      public T setDisplayItem(Function<net.minecraft.core.RegistryAccess,net.minecraft.world.item.ItemStack> item)
      Sets the display ItemStack.
      Since:
      6.0
    • onReload

      public void onReload(net.minecraft.core.RegistryAccess registryAccess)
      Triggers the displayItemFunction to set the ItemStack from RegistryAccess
      Specified by:
      onReload in interface Section<T extends AbstractSectionWithTitle<T>>
      Since:
      6.0
    • icon

      public net.minecraft.world.item.ItemStack icon()
      If a display item has been set, use that, otherwise pass to super
      Specified by:
      icon in interface Section<T extends AbstractSectionWithTitle<T>>
      Returns:
      A display icon for this section, to be used on the Section Index
      Since:
      6.0
    • setTitleOffset

      public T setTitleOffset(int x, int y)
      Adjusts the offset at which to render the Title. Default is (5, 5)
      Since:
      4.0
    • setCentered

      public T setCentered(boolean centered)
      Makes the title of the section centered in the middle + offset
      Since:
      5.0
    • setTextColor

      public T setTextColor(int textColor)
    • setTextOutline

      public T setTextOutline(int textOutline)
    • setTextShadow

      public T setTextShadow(boolean textShadow)
    • setCollapsible

      public T setCollapsible(boolean collapsible)
    • setItems

      public T setItems(ConglomerateOfItems items)
    • setSticky

      public T setSticky(boolean sticky)
      Adjusts the offset at which to render the Title. Default is (5, 5)
      Since:
      5.0
    • setOnRender

      public T setOnRender(Runnable onRender)
      Runs code each time Section.render(GuiGraphics, Font, int, int) is called for this Section.
      Since:
      5.0
    • setOnRenderConsumer

      public T setOnRenderConsumer(Consumer<T> onRenderSection)
      Sets a consumer to run at the start of Section.render(GuiGraphics, Font, int, int) is called for this Section.
      Since:
      6.0
    • id

      public net.minecraft.resources.ResourceLocation id()
      Specified by:
      id in interface Section<T extends AbstractSectionWithTitle<T>>
    • title

      public net.minecraft.network.chat.Component title()
      Specified by:
      title in interface Section<T extends AbstractSectionWithTitle<T>>
      Returns:
      A display title for this section, or null if it doesn't have one. Lets features that need a human-readable label (e.g. a jump list) work with any Section implementation, without needing to know its concrete type.
    • items

      public ConglomerateOfItems items()
      Specified by:
      items in interface Section<T extends AbstractSectionWithTitle<T>>
    • collapsible

      public boolean collapsible()
      Specified by:
      collapsible in interface Section<T extends AbstractSectionWithTitle<T>>
    • isSticky

      public boolean isSticky()
      Specified by:
      isSticky in interface StickySection