java.lang.Object
io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreen
All Implemented Interfaces:
TParentElement, IEnableStateProvider
Direct Known Subclasses:
TScreenPlus, TStackTraceScreen, TWidgetHudScreen

public abstract class TScreen extends Object implements TParentElement
  • Field Details

    • client

      @Nullable protected @Nullable net.minecraft.client.MinecraftClient client
    • children

      protected final TElementList children
    • title

      @Nullable protected @Nullable net.minecraft.text.Text title
  • Constructor Details

    • TScreen

      public TScreen(net.minecraft.text.Text title)
  • Method Details

    • createScreenWrapper

      protected TScreenWrapper<?> createScreenWrapper()
    • getAsScreen

      public final net.minecraft.client.gui.screen.Screen getAsScreen()
    • getClient

      @Nullable public final @Nullable net.minecraft.client.MinecraftClient getClient()
    • getTextRenderer

      public final net.minecraft.client.font.TextRenderer getTextRenderer()
    • getItemRenderer

      public final net.minecraft.client.render.item.ItemRenderer getItemRenderer()
    • getTitle

      public final net.minecraft.text.Text getTitle()
    • isEnabled

      public final boolean isEnabled()
      Description copied from interface: TParentElement
      Returns true if TParentElement.getEnabled() returns true, and TParentElement.getParent()'s TParentElement.isEnabled() also returns true.

      In other words, this will return true if both this element and all of its TParentElements are enabled.

      Specified by:
      isEnabled in interface TParentElement
    • getEnabled

      public final boolean getEnabled()
      Description copied from interface: IEnableStateProvider
      Returns true if this Object is enabled.
      Specified by:
      getEnabled in interface IEnableStateProvider
      Specified by:
      getEnabled in interface TParentElement
    • close

      public void close()
    • onOpened

      protected void onOpened()
    • onClosed

      protected void onClosed()
    • shouldPause

      public boolean shouldPause()
    • shouldCloseOnEsc

      public boolean shouldCloseOnEsc()
    • shouldRenderInGameHud

      public boolean shouldRenderInGameHud()
    • isOpen

      public final boolean isOpen()
    • getMousePosition

      public final Point getMousePosition()
    • getParent

      @Nullable public final @Nullable TParentElement getParent()
      Specified by:
      getParent in interface TParentElement
    • getChildren

      public final TElementList getChildren()
      Specified by:
      getChildren in interface TParentElement
    • getX

      public final int getX()
      Specified by:
      getX in interface TParentElement
    • getY

      public final int getY()
      Specified by:
      getY in interface TParentElement
    • getWidth

      public final int getWidth()
      Specified by:
      getWidth in interface TParentElement
    • getHeight

      public final int getHeight()
      Specified by:
      getHeight in interface TParentElement
    • getDraggingElement

      @Nullable public final @Nullable TElement getDraggingElement()
    • getHoveredElement

      @Nullable public final @Nullable TElement getHoveredElement()
    • getFocusedElement

      @Nullable public final @Nullable TElement getFocusedElement()
    • setFocusedElement

      public final boolean setFocusedElement(TElement child)
    • setFocusedElement

      public final boolean setFocusedElement(TElement child, boolean askToFocus)
    • init

      protected abstract void init()
      Initializes this TScreen.
      Add TElements to this TScreen here.
    • tick

      protected void tick()
      Invoked whenever this TScreen ticks.

      Same as Screen.tick().

      See Also:
      • Screen.tick()
    • getZIndex

      public final float getZIndex()
      There's no need for a z-index for TScreens, so here it returns 0.
      Specified by:
      getZIndex in interface TParentElement
    • render

      public void render(TDrawContext pencil)
      Renders this TScreen.

      This is where the background and the children are drawn.

      Specified by:
      render in interface TParentElement
      Parameters:
      pencil - The TDrawContext.
    • renderBackground

      public void renderBackground(TDrawContext pencil)
      Renders this TScreen's background.

      Should be called before rendering children in render(TDrawContext).

      Parameters:
      pencil - The TDrawContext.
      See Also:
    • renderChildren

      protected final void renderChildren(TDrawContext pencil)
      Renders all children elements of this TScreen.
    • renderTooltip

      protected final void renderTooltip(TDrawContext pencil)
      Renders the Tooltip for the currently selected or hovered TElement.
      See Also:
    • input

      public boolean input(TInputContext inputContext)
      Description copied from interface: TParentElement
      An input handler that handles inputs on the TInputContext.InputDiscoveryPhase.MAIN input phase.
      Specified by:
      input in interface TParentElement
      Parameters:
      inputContext - The TInputContext containing information about a given input.
      See Also:
    • inputTabNavigation

      protected final boolean inputTabNavigation(boolean reverse)
      Used for handling "tab navigation". Call this to manually trigger tab navigation in a given direction.
      Parameters:
      reverse - When 'false', the tab-navigation will focus on the next element, and the previous element when 'true'.
    • __postTabNavigation

      @UnstableApi @Internal protected final void __postTabNavigation()
      Temporary workaround code for assisting the TParentElement and TContextMenuPanel element's behaviors. Call this after the user performs any form of GUI tab navigation.
    • filesDragged

      public boolean filesDragged(Collection<Path> files)
      Invoked when the user drags files onto the currently opened TScreen.
      Parameters:
      files - The Path Collection of the files that were dragged.
      Returns:
      True if the event was handled, and false otherwise.
    • hasKeyDown

      public static boolean hasKeyDown(int keyCode)
    • hasWndDown

      public static boolean hasWndDown()