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
    • RESTRICTED_NARRATION_TEXT

      private static final Component RESTRICTED_NARRATION_TEXT
    • USAGE_BACKGROUND_COLOR

      public static final int USAGE_BACKGROUND_COLOR
      See Also:
    • closeOnSubmit

      private final boolean closeOnSubmit
    • 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
    • displayMode

      private final ChatComponent.DisplayMode displayMode
    • chatAbilities

      private final ChatAbilities chatAbilities
    • exitReason

      protected ChatScreen.ExitReason exitReason
    • commandSuggestions

      private CommandSuggestions commandSuggestions
  • Constructor Details

    • ChatScreen

      public ChatScreen(String initial, boolean isDraft, ChatAbilities chatAbilities)
    • ChatScreen

      public ChatScreen(String initial, boolean isDraft, ChatAbilities chatAbilities, boolean closeOnSubmit)
  • Method Details

    • init

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

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

      public void resize(int width, int height)
      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 value)
    • keyPressed

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

      public boolean mouseScrolled(double x, double y, double scrollX, double scrollY)
    • mouseClicked

      public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick)
    • insertionClickMode

      private boolean insertionClickMode()
    • handleComponentClicked

      private boolean handleComponentClicked(Style clicked, boolean allowInsertions)
    • insertText

      public void insertText(String text, boolean replace)
      Overrides:
      insertText in class Screen
    • moveInHistory

      public void moveInHistory(int dir)
      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

      private @Nullable FormattedCharSequence formatChat(String text, int offset)
    • 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
      Overrides:
      render in class Screen
      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.
    • renderBackground

      public void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float a)
      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 output)
      Overrides:
      updateNarrationState in class Screen
    • handleChatInput

      public void handleChatInput(String msg, boolean addToRecent)
    • normalizeChatMessage

      public String normalizeChatMessage(String message)