Class ChatScreen

All Implemented Interfaces:
ContainerEventHandler, GuiEventListener, Renderable, TabOrderedElement
Direct Known Subclasses:
InBedChatScreen

public class ChatScreen extends Screen
  • Field Details

    • MOUSE_SCROLL_SPEED

      public static final double MOUSE_SCROLL_SPEED
      See Also:
    • USAGE_TEXT

      private static final Component USAGE_TEXT
    • TOOLTIP_MAX_WIDTH

      private static final int TOOLTIP_MAX_WIDTH
      See Also:
    • historyBuffer

      private String historyBuffer
    • historyPos

      private int historyPos
      keeps position of which chat message you will select when you press up, (does not increase for duplicated messages sent immediately after each other)
    • input

      protected EditBox input
      Chat entry field
    • initial

      protected String initial
      is the text that appears when you press the chat key and the input box appears pre-filled
    • isDraft

      protected boolean isDraft
    • exitReason

      protected ChatScreen.ExitReason exitReason
    • commandSuggestions

      CommandSuggestions commandSuggestions
  • Constructor Details

    • ChatScreen

      public ChatScreen(String pInitial, boolean pIsDraft)
  • Method Details

    • init

      protected void init()
      Overrides:
      init in class Screen
    • setInitialFocus

      protected void setInitialFocus()
      Overrides:
      setInitialFocus in class Screen
    • resize

      public void resize(Minecraft pMinecraft, int pWidth, int pHeight)
      Overrides:
      resize in class Screen
    • onClose

      public void onClose()
      Overrides:
      onClose in class Screen
    • removed

      public void removed()
      Overrides:
      removed in class Screen
    • shouldDiscardDraft

      protected boolean shouldDiscardDraft()
    • onEdited

      private void onEdited(String pValue)
    • keyPressed

      public boolean keyPressed(KeyEvent p_446285_)
      Specified by:
      keyPressed in interface ContainerEventHandler
      Specified by:
      keyPressed in interface GuiEventListener
      Overrides:
      keyPressed in class Screen
    • mouseScrolled

      public boolean mouseScrolled(double p_95581_, double p_95582_, double p_95583_, double p_295977_)
    • mouseClicked

      public boolean mouseClicked(MouseButtonEvent p_446006_, boolean p_434924_)
    • insertText

      public void insertText(String pText, boolean pOverwrite)
      Overrides:
      insertText in class Screen
    • moveInHistory

      public void moveInHistory(int pMsgPos)
      Input is relative and is applied directly to the sentHistoryCursor so -1 is the previous message, 1 is the next message from the current cursor position.
    • formatChat

      @Nullable private FormattedCharSequence formatChat(String pText, int pDisplayPos)
    • render

      public void render(GuiGraphics p_282470_, int p_282674_, int p_282014_, float p_283132_)
      Description copied from interface: Renderable
      Renders the graphical user interface (GUI) element.
      Specified by:
      render in interface Renderable
      Overrides:
      render in class Screen
      Parameters:
      p_282470_ - the GuiGraphics object used for rendering.
      p_282674_ - the x-coordinate of the mouse cursor.
      p_282014_ - the y-coordinate of the mouse cursor.
      p_283132_ - the partial tick time.
    • renderBackground

      public void renderBackground(GuiGraphics p_295929_, int p_296130_, int p_296353_, float p_294668_)
      Overrides:
      renderBackground in class Screen
    • isPauseScreen

      public boolean isPauseScreen()
      Overrides:
      isPauseScreen in class Screen
    • isAllowedInPortal

      public boolean isAllowedInPortal()
      Overrides:
      isAllowedInPortal in class Screen
    • updateNarrationState

      protected void updateNarrationState(NarrationElementOutput p_169238_)
      Overrides:
      updateNarrationState in class Screen
    • getComponentStyleAt

      @Nullable private Style getComponentStyleAt(double pMouseX, double pMouseY)
    • handleChatInput

      public void handleChatInput(String pMessage, boolean pAddToRecentChat)
    • normalizeChatMessage

      public String normalizeChatMessage(String pMessage)