Interface ILastScreenProvider
- All Known Implementing Classes:
TCompletableScreen, TFileChooserScreen, TTestScreen, TTextDialogScreen
@Environment(CLIENT)
public interface ILastScreenProvider
This
interface is implemented by TScreens that
can provide information about the last Screen instance
that was open before them.
This is generally used to open the previous screen when closing the current one.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ILastScreenProvidergetCurrent(@NotNull net.minecraft.client.Minecraft client) A utility method that retrieves the currentILastScreenProviderinstance for aMinecraftclient.@Nullable net.minecraft.client.gui.screens.ScreenReturns the lastScreeninstance that was open before this one.static @Nullable net.minecraft.client.gui.screens.ScreengetLastScreen(@Nullable TScreen screen) A utility method that retrieves the lastScreenfrom aTScreeninstance.static @Nullable net.minecraft.client.gui.screens.ScreengetLastScreen(@Nullable net.minecraft.client.gui.screens.Screen screen) A utility method that retrieves the lastScreenfrom aScreeninstance.
-
Method Details
-
getLastScreen
@Nullable @Nullable net.minecraft.client.gui.screens.Screen getLastScreen()Returns the lastScreeninstance that was open before this one. -
getLastScreen
-
getLastScreen
@Contract("null -> null; _ -> _") @Nullable static @Nullable net.minecraft.client.gui.screens.Screen getLastScreen(@Nullable @Nullable net.minecraft.client.gui.screens.Screen screen) A utility method that retrieves the lastScreenfrom aScreeninstance.- Parameters:
screen- TheScreeninstance.
-
getCurrent
@Nullable static @Nullable ILastScreenProvider getCurrent(@NotNull @NotNull net.minecraft.client.Minecraft client) throws NullPointerException A utility method that retrieves the currentILastScreenProviderinstance for aMinecraftclient.This method checks if the current screen is an instance of
ILastScreenProvider, and if not, it checks if it's an instance ofTScreenWrapperthat wraps anILastScreenProvider.- Parameters:
client- TheMinecraftclient.- Returns:
- Any
ILastScreenProviderassociated with the currentGui.screen(), if any. - Throws:
NullPointerException- If the argument isnull.
-