Class TScreenWrapper<T extends TScreen>

java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
com.thecsdev.commonmc.api.client.gui.screen.TScreenWrapper<T>
All Implemented Interfaces:
net.minecraft.client.gui.components.events.ContainerEventHandler, net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.components.TabOrderedElement

@UnstableApi @Environment(CLIENT) @Virtual public class TScreenWrapper<T extends TScreen> extends net.minecraft.client.gui.screens.Screen
The TScreenWrapper serves as an adapter for the TScreen class. This class extends the game's Screen class and translates calls from the game's engine into calls on the TScreen instances.

The purpose of this class is to isolate TScreen from Minecraft's GUI code, making the mod more resilient to changes in the game's code. This isolation makes TScreen act like a Screen, but in a more controlled and independent way, similar to how custom rendering engines interact with rendering APIs.

This class should remain thin, serving only as a pass-through layer to TScreen. All interactions with the Screen class that the mod needs should be encapsulated within this class, keeping TScreen unaware of the game's GUI code.

API Note:
UnstableApi. Changes to the game's code, as well as the default TScreenWrapper implementation, may cause disruptions.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen

    net.minecraft.client.gui.screens.Screen.NarratableSearchResult
  • Field Summary

    Fields inherited from class net.minecraft.client.gui.screens.Screen

    FADE_IN_TIME, font, FOOTER_SEPARATOR, HEADER_SEPARATOR, height, INWORLD_FOOTER_SEPARATOR, INWORLD_HEADER_SEPARATOR, MENU_BACKGROUND, minecraft, narratorButton, screenExecutor, title, width
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    TScreenWrapper(T target)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
     
    final boolean
    charTyped(@NotNull net.minecraft.client.input.CharacterEvent e)
     
    final void
    extractRenderState(@NotNull net.minecraft.client.gui.GuiGraphicsExtractor context, int mouseX, int mouseY, float deltaTicks)
     
    final @NotNull net.minecraft.client.Minecraft
    Returns the Minecraft client instance that last opened this Screen, if any.
    final T
    Returns the target TScreen for this TScreenWrapper.
    protected final void
     
    final boolean
     
    final boolean
     
    final boolean
    keyPressed(@NotNull net.minecraft.client.input.KeyEvent e)
     
    final boolean
    keyReleased(@NotNull net.minecraft.client.input.KeyEvent e)
     
    final boolean
    mouseClicked(@NotNull net.minecraft.client.input.MouseButtonEvent e, boolean doubled)
     
    final boolean
    mouseDragged(@NotNull net.minecraft.client.input.MouseButtonEvent e, double deltaX, double deltaY)
     
    final void
    mouseMoved(double mouseX, double mouseY)
     
    final boolean
    mouseReleased(@NotNull net.minecraft.client.input.MouseButtonEvent e)
     
    final boolean
    mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount)
     
    final void
     
    final void
     
    final boolean
     
    final void
     
     

    Methods inherited from class net.minecraft.client.gui.screens.Screen

    addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, canInterruptWithAnotherScreen, changeFocus, children, clearFocus, clearWidgets, clickCommandAction, clickUrlAction, defaultHandleClickEvent, defaultHandleGameClickEvent, extractBackground, extractBlurredBackground, extractMenuBackground, extractMenuBackground, extractMenuBackgroundTexture, extractPanorama, extractRenderStateWithTooltipAndSubtitles, extractTransparentBackground, fadeWidgets, fillCrashDetails, findNarratableWidget, getBackgroundMusic, getFont, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleDelayedNarration, init, insertText, isAllowedInPortal, isInGameUi, isMouseOver, isValidCharacterForName, onFilesDrop, rebuildWidgets, removeWidget, repositionElements, resize, setInitialFocus, setInitialFocus, shouldNarrateNavigation, showsActiveEffects, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, updateNarratorStatus

    Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler

    getFocused, isDragging, setDragging, setFocused

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler

    getBorderForArrowNavigation, getChildAt, getCurrentFocusPath, isFocused, nextFocusPath, preeditUpdated, setFocused

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    shouldTakeFocusAfterInteraction

    Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement

    getTabOrderGroup
  • Constructor Details

    • TScreenWrapper

      protected TScreenWrapper(@NotNull T target)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTargetTScreen

      @NotNull public final T getTargetTScreen()
      Returns the target TScreen for this TScreenWrapper.
    • getClient

      @NotNull public final @NotNull net.minecraft.client.Minecraft getClient()
      Returns the Minecraft client instance that last opened this Screen, if any.
    • isAllowingInGameHud

      public final boolean isAllowingInGameHud()
      See Also:
    • shouldCloseOnEsc

      public final boolean shouldCloseOnEsc()
      Overrides:
      shouldCloseOnEsc in class net.minecraft.client.gui.screens.Screen
    • isPauseScreen

      public final boolean isPauseScreen()
      Overrides:
      isPauseScreen in class net.minecraft.client.gui.screens.Screen
    • onClose

      public final void onClose()
      Overrides:
      onClose in class net.minecraft.client.gui.screens.Screen
    • added

      public final void added()
      Overrides:
      added in class net.minecraft.client.gui.screens.Screen
    • init

      protected final void init()
      Overrides:
      init in class net.minecraft.client.gui.screens.Screen
    • removed

      public final void removed()
      Overrides:
      removed in class net.minecraft.client.gui.screens.Screen
    • tick

      public final void tick()
      Overrides:
      tick in class net.minecraft.client.gui.screens.Screen
    • extractRenderState

      public final void extractRenderState(@NotNull @NotNull net.minecraft.client.gui.GuiGraphicsExtractor context, int mouseX, int mouseY, float deltaTicks)
      Specified by:
      extractRenderState in interface net.minecraft.client.gui.components.Renderable
      Overrides:
      extractRenderState in class net.minecraft.client.gui.screens.Screen
    • keyPressed

      public final boolean keyPressed(@NotNull @NotNull net.minecraft.client.input.KeyEvent e)
      Specified by:
      keyPressed in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      keyPressed in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      keyPressed in class net.minecraft.client.gui.screens.Screen
    • keyReleased

      public final boolean keyReleased(@NotNull @NotNull net.minecraft.client.input.KeyEvent e)
    • charTyped

      public final boolean charTyped(@NotNull @NotNull net.minecraft.client.input.CharacterEvent e)
    • mouseClicked

      public final boolean mouseClicked(@NotNull @NotNull net.minecraft.client.input.MouseButtonEvent e, boolean doubled)
    • mouseReleased

      public final boolean mouseReleased(@NotNull @NotNull net.minecraft.client.input.MouseButtonEvent e)
    • mouseMoved

      public final void mouseMoved(double mouseX, double mouseY)
    • mouseScrolled

      public final boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount)
    • mouseDragged

      public final boolean mouseDragged(@NotNull @NotNull net.minecraft.client.input.MouseButtonEvent e, double deltaX, double deltaY)