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

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

      CommandSuggestions commandSuggestions
  • Constructor Details

    • ChatScreen

      public ChatScreen(String pInitial)
  • 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
    • removed

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

      private void onEdited(String p_95611_)
    • keyPressed

      public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers)
      Description copied from class: Screen
      Called when a keyboard key is pressed within the GUI element.

      Specified by:
      keyPressed in interface ContainerEventHandler
      Specified by:
      keyPressed in interface GuiEventListener
      Overrides:
      keyPressed in class Screen
      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.
    • mouseScrolled

      public boolean mouseScrolled(double pMouseX, double pMouseY, double pScrollX, double pScrollY)
    • mouseClicked

      public boolean mouseClicked(double pMouseX, double pMouseY, int pButton)
      Called when a mouse button is clicked within the GUI element.

      Parameters:
      pMouseX - the X coordinate of the mouse.
      pMouseY - the Y coordinate of the mouse.
      pButton - the button that was clicked.
      Returns:
      true if the event is consumed, false otherwise.
    • insertText

      protected 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.
    • render

      public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
      Renders the graphical user interface (GUI) element.
      Specified by:
      render in interface Renderable
      Overrides:
      render in class Screen
      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.
    • renderBackground

      public void renderBackground(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
      Overrides:
      renderBackground in class Screen
    • isPauseScreen

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

      private void setChatLine(String pChatLine)
    • updateNarrationState

      protected void updateNarrationState(NarrationElementOutput pOutput)
      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)