Class Screen

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Renderable, TabOrderedElement
Direct Known Subclasses:
AbstractCommandBlockEditScreen, AbstractContainerScreen, AbstractGameRulesScreen, AbstractReportScreen, AbstractSignEditScreen, AccessibilityOnboardingScreen, AdvancementsScreen, AlertScreen, BackupConfirmScreen, BookEditScreen, BookSignScreen, BookViewScreen, ChatScreen, ChatSelectionScreen, ConfirmExperimentalFeaturesScreen, ConfirmExperimentalFeaturesScreen.DetailsScreen, ConfirmScreen, ConnectScreen, CreateBuffetWorldScreen, CreateFlatWorldScreen, CreateWorldScreen, CreditsAndAttributionScreen, DatapackLoadFailureScreen, DeathScreen, DebugOptionsScreen, DialogScreen, DirectJoinServerScreen, DisconnectedScreen, EditWorldScreen, ErrorScreen, ExperimentsScreen, FileFixerAbortedScreen, FileFixerProgressScreen, GameModeSwitcherScreen, GenericMessageScreen, GenericWaitingScreen, JigsawBlockEditScreen, JoinMultiplayerScreen, LevelLoadingScreen, ManageServerScreen, ModListScreen, ModMismatchDisconnectedScreen, NoticeWithLinkScreen, OptimizeWorldScreen, OptionsScreen, OptionsSubScreen, OutOfMemoryScreen, PackSelectionScreen, PauseScreen, PauseScreen.FeedbackSubScreen, PopupScreen, PresetFlatWorldScreen, ProgressScreen, RealmsPreferredRegionSelectionScreen, RealmsScreen, RecoverWorldDataScreen, ReportPlayerScreen, ReportReasonSelectionScreen, RestrictionsScreen, SelectWorldScreen, ServerReconfigScreen, ShareToLanScreen, SocialInteractionsScreen, StatsScreen, StructureBlockEditScreen, TelemetryInfoScreen, TestBlockEditScreen, TestInstanceBlockEditScreen, TitleScreen, UnsupportedGraphicsWarningScreen, WaitingForResponseScreen, WarningScreen, WinScreen, WorldOptionsScreen

public abstract class Screen extends AbstractContainerEventHandler implements Renderable
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • SCREEN_USAGE_NARRATION

      private static final Component SCREEN_USAGE_NARRATION
    • HEADER_SEPARATOR

      public static final Identifier HEADER_SEPARATOR
    • INWORLD_MENU_BACKGROUND

      private static final Identifier INWORLD_MENU_BACKGROUND
    • INWORLD_HEADER_SEPARATOR

      public static final Identifier INWORLD_HEADER_SEPARATOR
    • FADE_IN_TIME

      protected static final float FADE_IN_TIME
      See Also:
    • title

      protected final Component title
    • children

      private final List<GuiEventListener> children
    • narratables

      private final List<NarratableEntry> narratables
    • minecraft

      protected final Minecraft minecraft
    • initialized

      private boolean initialized
    • width

      public int width
    • height

      public int height
    • renderables

      public final List<Renderable> renderables
    • font

      protected final 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

      protected @Nullable CycleButton<NarratorStatus> narratorButton
    • lastNarratable

      private @Nullable NarratableEntry lastNarratable
    • screenExecutor

      protected final Executor screenExecutor
  • Constructor Details

  • Method Details

    • getTitle

      public Component getTitle()
    • getNarrationMessage

      public Component getNarrationMessage()
    • renderWithTooltipAndSubtitles

      public final void renderWithTooltipAndSubtitles(GuiGraphics graphics, int mouseX, int mouseY, float a)
    • render

      public void render(GuiGraphics graphics, int mouseX, int mouseY, float a)
      Description copied from interface: Renderable
      Renders the graphical user interface (GUI) element.
      Specified by:
      render in interface Renderable
      Parameters:
      graphics - the GuiGraphics object used for rendering.
      mouseX - the x-coordinate of the mouse cursor.
      mouseY - the y-coordinate of the mouse cursor.
      a - the partial tick time.
    • keyPressed

      public boolean keyPressed(KeyEvent event)
      Specified by:
      keyPressed in interface ContainerEventHandler
      Specified by:
      keyPressed in interface GuiEventListener
    • createTabEvent

      private FocusNavigationEvent.TabNavigation createTabEvent(boolean forward)
    • createArrowEvent

      private FocusNavigationEvent.ArrowNavigation createArrowEvent(ScreenDirection direction)
    • setInitialFocus

      protected void setInitialFocus()
    • setInitialFocus

      protected void setInitialFocus(GuiEventListener target)
    • clearFocus

      public void clearFocus()
    • changeFocus

      protected void changeFocus(ComponentPath componentPath)
    • shouldCloseOnEsc

      public boolean shouldCloseOnEsc()
    • onClose

      public void onClose()
    • addRenderableWidget

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

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

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

      protected void removeWidget(GuiEventListener widget)
    • clearWidgets

      protected void clearWidgets()
    • getTooltipFromItem

      public static List<Component> getTooltipFromItem(Minecraft minecraft, ItemStack itemStack)
    • insertText

      protected void insertText(String text, boolean replace)
    • defaultHandleGameClickEvent

      protected static void defaultHandleGameClickEvent(ClickEvent event, Minecraft minecraft, @Nullable Screen activeScreen)
    • defaultHandleClickEvent

      protected static void defaultHandleClickEvent(ClickEvent event, Minecraft minecraft, @Nullable Screen activeScreen)
    • clickUrlAction

      protected static boolean clickUrlAction(Minecraft minecraft, @Nullable Screen screen, URI uri)
    • clickCommandAction

      protected static void clickCommandAction(LocalPlayer player, String command, @Nullable Screen screenAfterCommand)
    • init

      public final void init(int width, int height)
    • rebuildWidgets

      protected void rebuildWidgets()
    • fadeWidgets

      protected void fadeWidgets(float widgetFade)
    • 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 graphics, int mouseX, int mouseY, float a)
    • renderBlurredBackground

      protected void renderBlurredBackground(GuiGraphics graphics)
    • renderPanorama

      protected void renderPanorama(GuiGraphics graphics, float a)
    • renderMenuBackground

      protected void renderMenuBackground(GuiGraphics graphics)
    • renderMenuBackground

      protected void renderMenuBackground(GuiGraphics graphics, int x, int y, int width, int height)
    • renderMenuBackgroundTexture

      public static void renderMenuBackgroundTexture(GuiGraphics graphics, Identifier menuBackground, int x, int y, float u, float v, int width, int height)
    • renderTransparentBackground

      public void renderTransparentBackground(GuiGraphics graphics)
    • isPauseScreen

      public boolean isPauseScreen()
    • isInGameUi

      public boolean isInGameUi()
    • panoramaShouldSpin

      protected boolean panoramaShouldSpin()
    • isAllowedInPortal

      public boolean isAllowedInPortal()
    • repositionElements

      protected void repositionElements()
    • resize

      public void resize(int width, int height)
    • fillCrashDetails

      public void fillCrashDetails(CrashReport report)
    • isValidCharacterForName

      protected boolean isValidCharacterForName(String currentName, int newChar, int cursorPos)
    • isMouseOver

      public boolean isMouseOver(double mouseX, double mouseY)
      Description copied from interface: GuiEventListener
      Checks if the given mouse coordinates are over the GUI element.

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

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

      public Minecraft getMinecraft()
    • scheduleNarration

      private void scheduleNarration(long delay, boolean ignoreSuppression)
    • suppressNarration

      private void suppressNarration(long duration)
    • setNarrationSuppressTime

      private void setNarrationSuppressTime(long narrationSuppressTime)
    • 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 onlyChanged)
    • runNarration

      private void runNarration(boolean onlyChanged)
    • shouldNarrateNavigation

      protected boolean shouldNarrateNavigation()
    • updateNarrationState

      protected void updateNarrationState(NarrationElementOutput output)
    • updateNarratedWidget

      protected void updateNarratedWidget(NarrationElementOutput output)
    • getUsageNarration

      protected Component getUsageNarration()
    • findNarratableWidget

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

      public void updateNarratorStatus(boolean wasDisabled)
    • getFont

      public Font getFont()
    • showsActiveEffects

      public boolean showsActiveEffects()
    • canInterruptWithAnotherScreen

      public boolean canInterruptWithAnotherScreen()
    • getRectangle

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

      public @Nullable Music getBackgroundMusic()
    • addEventWidget

      private void addEventWidget(GuiEventListener b)