Class Screen

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Renderable, TabOrderedElement
Direct Known Subclasses:
AbstractCommandBlockEditScreen, AbstractContainerScreen, AbstractReportScreen, AbstractSignEditScreen, AbstractTestScreen, AccessibilityOnboardingScreen, AdvancementsScreen, AlertScreen, BackupConfirmScreen, BookEditScreen, BookViewScreen, ChatScreen, ChatSelectionScreen, ConfirmExperimentalFeaturesScreen, ConfirmExperimentalFeaturesScreen.DetailsScreen, ConfirmScreen, ConnectScreen, CreateBuffetWorldScreen, CreateFlatWorldScreen, CreateWorldScreen, CreditsAndAttributionScreen, CustomPresetEditorTest.SwampDesertScreen, CustomTooltipTest.TooltipTestScreen, DatapackLoadFailureScreen, DeathScreen, DemoIntroScreen, DirectJoinServerScreen, DisconnectedScreen, EditGameRulesScreen, EditServerScreen, EditWorldScreen, ErrorScreen, ExperimentsScreen, GameModeSwitcherScreen, GenericMessageScreen, GenericWaitingScreen, GuiTests.TestLayer, JigsawBlockEditScreen, JoinMultiplayerScreen, LevelLoadingScreen, ModListScreen, ModMismatchDisconnectedScreen, NoticeWithLinkScreen, OptimizeWorldScreen, OptionsScreen, OptionsSubScreen, OutOfMemoryScreen, PackSelectionScreen, PauseScreen, PauseScreen.FeedbackSubScreen, PopupScreen, PresetFlatWorldScreen, ProgressScreen, RealmsScreen, ReceivingLevelScreen, RecoverWorldDataScreen, ReportPlayerScreen, ReportReasonSelectionScreen, SelectWorldScreen, ServerLinksScreen, ServerReconfigScreen, ShareToLanScreen, SocialInteractionsScreen, StatsScreen, StructureBlockEditScreen, TelemetryInfoScreen, TestScreen, TitleScreen, UnsupportedGraphicsWarningScreen, WarningScreen, WinScreen

public abstract class Screen extends AbstractContainerEventHandler implements Renderable
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • USAGE_NARRATION

      private static final Component USAGE_NARRATION
    • CUBE_MAP

      protected static final CubeMap CUBE_MAP
    • PANORAMA

      protected static final PanoramaRenderer PANORAMA
    • HEADER_SEPARATOR

      public static final ResourceLocation HEADER_SEPARATOR
    • INWORLD_MENU_BACKGROUND

      private static final ResourceLocation INWORLD_MENU_BACKGROUND
    • INWORLD_HEADER_SEPARATOR

      public static final ResourceLocation INWORLD_HEADER_SEPARATOR
    • title

      protected final Component title
    • children

      private final List<GuiEventListener> children
    • narratables

      private final List<NarratableEntry> narratables
    • minecraft

      @Nullable protected Minecraft minecraft
    • initialized

      private boolean initialized
    • width

      public int width
    • height

      public int height
    • renderables

      public final List<Renderable> renderables
    • font

      protected Font font
    • NARRATE_SUPPRESS_AFTER_INIT_TIME

      private static final long NARRATE_SUPPRESS_AFTER_INIT_TIME
    • NARRATE_DELAY_NARRATOR_ENABLED

      private static final long NARRATE_DELAY_NARRATOR_ENABLED
    • NARRATE_DELAY_MOUSE_MOVE

      private static final long NARRATE_DELAY_MOUSE_MOVE
      See Also:
    • NARRATE_DELAY_MOUSE_ACTION

      private static final long NARRATE_DELAY_MOUSE_ACTION
      See Also:
    • NARRATE_DELAY_KEYBOARD_ACTION

      private static final long NARRATE_DELAY_KEYBOARD_ACTION
      See Also:
    • narrationState

      private final ScreenNarrationCollector narrationState
    • narrationSuppressTime

      private long narrationSuppressTime
    • nextNarrationTime

      private long nextNarrationTime
    • narratorButton

      @Nullable protected CycleButton<NarratorStatus> narratorButton
    • lastNarratable

      @Nullable private NarratableEntry lastNarratable
    • deferredTooltipRendering

      @Nullable private Screen.DeferredTooltipRendering deferredTooltipRendering
    • screenExecutor

      protected final Executor screenExecutor
  • Constructor Details

    • Screen

      protected Screen(Component pTitle)
  • Method Details

    • getTitle

      public Component getTitle()
    • getNarrationMessage

      public Component getNarrationMessage()
    • renderWithTooltip

      public final void renderWithTooltip(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
    • render

      public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
      Neo: mixins targeting this method won't fire for container screens as AbstractContainerScreen.render(net.minecraft.client.gui.GuiGraphics, int, int, float) replicates this method in place of a super call to insert an event

      Renders the graphical user interface (GUI) element.

      Specified by:
      render in interface Renderable
      Parameters:
      pGuiGraphics - the GuiGraphics object used for rendering.
      pMouseX - the x-coordinate of the mouse cursor.
      pMouseY - the y-coordinate of the mouse cursor.
      pPartialTick - the partial tick time.
    • keyPressed

      public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers)
      Called when a keyboard key is pressed within the GUI element.

      Specified by:
      keyPressed in interface ContainerEventHandler
      Specified by:
      keyPressed in interface GuiEventListener
      Parameters:
      pKeyCode - the key code of the pressed key.
      pScanCode - the scan code of the pressed key.
      pModifiers - the keyboard modifiers.
      Returns:
      true if the event is consumed, false otherwise.
    • createTabEvent

      private FocusNavigationEvent.TabNavigation createTabEvent()
    • createArrowEvent

      private FocusNavigationEvent.ArrowNavigation createArrowEvent(ScreenDirection pDirection)
    • setInitialFocus

      protected void setInitialFocus()
    • setInitialFocus

      protected void setInitialFocus(GuiEventListener pListener)
    • clearFocus

      public void clearFocus()
    • changeFocus

      protected void changeFocus(ComponentPath pPath)
    • shouldCloseOnEsc

      public boolean shouldCloseOnEsc()
    • onClose

      public void onClose()
    • addRenderableWidget

      protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T pWidget)
    • addRenderableOnly

      protected <T extends Renderable> T addRenderableOnly(T pRenderable)
    • addWidget

      protected <T extends GuiEventListener & NarratableEntry> T addWidget(T pListener)
    • removeWidget

      protected void removeWidget(GuiEventListener pListener)
    • clearWidgets

      protected void clearWidgets()
    • getTooltipFromItem

      public static List<Component> getTooltipFromItem(Minecraft pMinecraft, ItemStack pItem)
    • insertText

      protected void insertText(String pText, boolean pOverwrite)
    • handleComponentClicked

      public boolean handleComponentClicked(@Nullable Style pStyle)
    • init

      public final void init(Minecraft pMinecraft, int pWidth, int pHeight)
    • rebuildWidgets

      protected void rebuildWidgets()
    • children

      public List<? extends GuiEventListener> children()
      Specified by:
      children in interface ContainerEventHandler
    • init

      protected void init()
    • tick

      public void tick()
    • removed

      public void removed()
    • added

      public void added()
    • renderBackground

      public void renderBackground(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
    • renderBlurredBackground

      protected void renderBlurredBackground(float pPartialTick)
    • renderPanorama

      protected void renderPanorama(GuiGraphics pGuiGraphics, float pPartialTick)
    • renderMenuBackground

      protected void renderMenuBackground(GuiGraphics pPartialTick)
    • renderMenuBackground

      protected void renderMenuBackground(GuiGraphics pGuiGraphics, int pX, int pY, int pWidth, int pHeight)
    • renderMenuBackgroundTexture

      public static void renderMenuBackgroundTexture(GuiGraphics pGuiGraphics, ResourceLocation pTexture, int pX, int pY, float pUOffset, float pVOffset, int pWidth, int pHeight)
    • renderTransparentBackground

      public void renderTransparentBackground(GuiGraphics pGuiGraphics)
    • isPauseScreen

      public boolean isPauseScreen()
    • hasControlDown

      public static boolean hasControlDown()
    • hasShiftDown

      public static boolean hasShiftDown()
    • hasAltDown

      public static boolean hasAltDown()
    • isCut

      public static boolean isCut(int pKeyCode)
    • isPaste

      public static boolean isPaste(int pKeyCode)
    • isCopy

      public static boolean isCopy(int pKeyCode)
    • isSelectAll

      public static boolean isSelectAll(int pKeyCode)
    • repositionElements

      protected void repositionElements()
    • resize

      public void resize(Minecraft pMinecraft, int pWidth, int pHeight)
    • wrapScreenError

      public static void wrapScreenError(Runnable pAction, String pErrorDesc, String pScreenName)
    • isValidCharacterForName

      protected boolean isValidCharacterForName(String pText, char pCharTyped, int pCursorPos)
    • isMouseOver

      public boolean isMouseOver(double pMouseX, double pMouseY)
      Checks if the given mouse coordinates are over the GUI element.

      Specified by:
      isMouseOver in interface GuiEventListener
      Parameters:
      pMouseX - the X coordinate of the mouse.
      pMouseY - the Y coordinate of the mouse.
      Returns:
      true if the mouse is over the GUI element, false otherwise.
    • onFilesDrop

      public void onFilesDrop(List<Path> pPacks)
    • getMinecraft

      public Minecraft getMinecraft()
    • scheduleNarration

      private void scheduleNarration(long pDelay, boolean pStopSuppression)
    • suppressNarration

      private void suppressNarration(long pTime)
    • afterMouseMove

      public void afterMouseMove()
    • afterMouseAction

      public void afterMouseAction()
    • afterKeyboardAction

      public void afterKeyboardAction()
    • shouldRunNarration

      private boolean shouldRunNarration()
    • handleDelayedNarration

      public void handleDelayedNarration()
    • triggerImmediateNarration

      public void triggerImmediateNarration(boolean pOnlyNarrateNew)
    • runNarration

      private void runNarration(boolean pOnlyNarrateNew)
    • shouldNarrateNavigation

      protected boolean shouldNarrateNavigation()
    • updateNarrationState

      protected void updateNarrationState(NarrationElementOutput p_169396_)
    • updateNarratedWidget

      protected void updateNarratedWidget(NarrationElementOutput pNarrationElementOutput)
    • getUsageNarration

      protected Component getUsageNarration()
    • findNarratableWidget

      @Nullable public static Screen.NarratableSearchResult findNarratableWidget(List<? extends NarratableEntry> pEntries, @Nullable NarratableEntry pTarget)
    • updateNarratorStatus

      public void updateNarratorStatus(boolean pNarratorEnabled)
    • clearTooltipForNextRenderPass

      protected void clearTooltipForNextRenderPass()
    • setTooltipForNextRenderPass

      public void setTooltipForNextRenderPass(List<FormattedCharSequence> pTooltip)
    • setTooltipForNextRenderPass

      public void setTooltipForNextRenderPass(List<FormattedCharSequence> pTooltip, ClientTooltipPositioner pPositioner, boolean pOverride)
    • setTooltipForNextRenderPass

      public void setTooltipForNextRenderPass(Component pTooltip)
    • setTooltipForNextRenderPass

      public void setTooltipForNextRenderPass(Tooltip pTooltip, ClientTooltipPositioner pPositioner, boolean pOverride)
    • getRectangle

      public ScreenRectangle getRectangle()
      Specified by:
      getRectangle in interface GuiEventListener
    • getBackgroundMusic

      @Nullable public Music getBackgroundMusic()
    • addEventWidget

      private void addEventWidget(GuiEventListener b)