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 defaultTScreenWrapperimplementation, 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 -
Method Summary
Modifier and TypeMethodDescriptionfinal voidadded()final booleancharTyped(@NotNull net.minecraft.client.input.CharacterEvent e) final voidextractRenderState(@NotNull net.minecraft.client.gui.GuiGraphicsExtractor context, int mouseX, int mouseY, float deltaTicks) final @NotNull net.minecraft.client.MinecraftReturns theMinecraftclient instance that last opened thisScreen, if any.final Tprotected final voidinit()final booleanfinal booleanfinal booleankeyPressed(@NotNull net.minecraft.client.input.KeyEvent e) final booleankeyReleased(@NotNull net.minecraft.client.input.KeyEvent e) final booleanmouseClicked(@NotNull net.minecraft.client.input.MouseButtonEvent e, boolean doubled) final booleanmouseDragged(@NotNull net.minecraft.client.input.MouseButtonEvent e, double deltaX, double deltaY) final voidmouseMoved(double mouseX, double mouseY) final booleanmouseReleased(@NotNull net.minecraft.client.input.MouseButtonEvent e) final booleanmouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) final voidonClose()final voidremoved()final booleanfinal voidtick()toString()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, updateNarratorStatusMethods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocusedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
getBorderForArrowNavigation, getChildAt, getCurrentFocusPath, isFocused, nextFocusPath, preeditUpdated, setFocusedMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
shouldTakeFocusAfterInteractionMethods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Constructor Details
-
TScreenWrapper
-
-
Method Details
-
toString
-
getTargetTScreen
-
getClient
@NotNull public final @NotNull net.minecraft.client.Minecraft getClient()Returns theMinecraftclient instance that last opened thisScreen, if any. -
isAllowingInGameHud
public final boolean isAllowingInGameHud()- See Also:
-
shouldCloseOnEsc
public final boolean shouldCloseOnEsc()- Overrides:
shouldCloseOnEscin classnet.minecraft.client.gui.screens.Screen
-
isPauseScreen
public final boolean isPauseScreen()- Overrides:
isPauseScreenin classnet.minecraft.client.gui.screens.Screen
-
onClose
public final void onClose()- Overrides:
onClosein classnet.minecraft.client.gui.screens.Screen
-
added
public final void added()- Overrides:
addedin classnet.minecraft.client.gui.screens.Screen
-
init
protected final void init()- Overrides:
initin classnet.minecraft.client.gui.screens.Screen
-
removed
public final void removed()- Overrides:
removedin classnet.minecraft.client.gui.screens.Screen
-
tick
public final void tick()- Overrides:
tickin classnet.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:
extractRenderStatein interfacenet.minecraft.client.gui.components.Renderable- Overrides:
extractRenderStatein classnet.minecraft.client.gui.screens.Screen
-
keyPressed
public final boolean keyPressed(@NotNull @NotNull net.minecraft.client.input.KeyEvent e) - Specified by:
keyPressedin interfacenet.minecraft.client.gui.components.events.ContainerEventHandler- Specified by:
keyPressedin interfacenet.minecraft.client.gui.components.events.GuiEventListener- Overrides:
keyPressedin classnet.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)
-