Class ChatComponent

java.lang.Object
net.minecraft.client.gui.components.ChatComponent

public class ChatComponent extends Object
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • MAX_CHAT_HISTORY

      private static final int MAX_CHAT_HISTORY
      See Also:
    • MESSAGE_INDENT

      private static final int MESSAGE_INDENT
      See Also:
    • BOTTOM_MARGIN

      private static final int BOTTOM_MARGIN
      See Also:
    • TOOLTIP_MAX_WIDTH

      private static final int TOOLTIP_MAX_WIDTH
      See Also:
    • TIME_BEFORE_MESSAGE_DELETION

      private static final int TIME_BEFORE_MESSAGE_DELETION
      See Also:
    • DELETED_CHAT_MESSAGE

      private static final Component DELETED_CHAT_MESSAGE
    • MESSAGE_BOTTOM_TO_MESSAGE_TOP

      public static final int MESSAGE_BOTTOM_TO_MESSAGE_TOP
      See Also:
    • QUEUE_EXPAND_ID

      public static final Identifier QUEUE_EXPAND_ID
    • QUEUE_EXPAND_TEXT_STYLE

      private static final Style QUEUE_EXPAND_TEXT_STYLE
    • GO_TO_RESTRICTIONS_SCREEN

      public static final Identifier GO_TO_RESTRICTIONS_SCREEN
    • RESTRICTED_CHAT_MESSAGE

      private static final Component RESTRICTED_CHAT_MESSAGE
    • minecraft

      private final Minecraft minecraft
    • recentChat

      private final ArrayListDeque<String> recentChat
      A list of messages previously sent through the chat GUI
    • allMessages

      private final List<GuiMessage> allMessages
      Chat lines to be displayed in the chat box
    • trimmedMessages

      private final List<GuiMessage.Line> trimmedMessages
      List of the ChatLines currently drawn
    • chatScrollbarPos

      private int chatScrollbarPos
    • newMessageSinceScroll

      private boolean newMessageSinceScroll
    • latestDraft

      private @Nullable ChatComponent.Draft latestDraft
    • preservedScreen

      private @Nullable ChatScreen preservedScreen
    • messageDeletionQueue

      private final List<ChatComponent.DelayedMessageDeletion> messageDeletionQueue
    • visibleMessageFilter

      private Predicate<GuiMessage> visibleMessageFilter
  • Constructor Details

    • ChatComponent

      public ChatComponent(Minecraft minecraft)
  • Method Details

    • tick

      public void tick()
    • setVisibleMessageFilter

      public void setVisibleMessageFilter(Predicate<GuiMessage> visibleMessageFilter)
    • forEachLine

      private int forEachLine(ChatComponent.AlphaCalculator alphaCalculator, ChatComponent.LineConsumer lineConsumer)
    • render

      public void render(GuiGraphics graphics, Font font, int ticks, int mouseX, int mouseY, ChatComponent.DisplayMode displayMode, boolean changeCursorOnInsertions)
    • captureClickableText

      public void captureClickableText(ActiveTextCollector activeTextCollector, int screenHeight, int ticks, ChatComponent.DisplayMode displayMode)
    • render

      private void render(ChatComponent.ChatGraphicsAccess graphics, int screenHeight, int ticks, ChatComponent.DisplayMode displayMode)
    • clearMessages

      public void clearMessages(boolean history)
      Clears the chat.
      Parameters:
      history - Whether to clear the user's sent message history
    • addClientSystemMessage

      public void addClientSystemMessage(Component message)
    • addServerSystemMessage

      public void addServerSystemMessage(Component message)
    • addPlayerMessage

      public void addPlayerMessage(Component message, @Nullable MessageSignature signature, @Nullable GuiMessageTag tag)
    • addMessage

      private void addMessage(Component contents, @Nullable MessageSignature signature, GuiMessageSource source, @Nullable GuiMessageTag tag)
    • logChatMessage

      private void logChatMessage(GuiMessage message)
    • addMessageToDisplayQueue

      private void addMessageToDisplayQueue(GuiMessage message)
    • addMessageToQueue

      private void addMessageToQueue(GuiMessage message)
    • processMessageDeletionQueue

      private void processMessageDeletionQueue()
    • deleteMessage

      public void deleteMessage(MessageSignature signature)
    • deleteMessageOrDelay

      private @Nullable ChatComponent.DelayedMessageDeletion deleteMessageOrDelay(MessageSignature signature)
    • createDeletedMarker

      private static GuiMessage createDeletedMarker(GuiMessage message)
    • rescaleChat

      public void rescaleChat()
    • refreshTrimmedMessages

      private void refreshTrimmedMessages()
    • getRecentChat

      public ArrayListDeque<String> getRecentChat()
    • addRecentChat

      public void addRecentChat(String message)
      Adds this string to the list of sent messages, for recall using the up/down arrow keys
    • resetChatScroll

      public void resetChatScroll()
    • scrollChat

      public void scrollChat(int dir)
    • isChatFocused

      public boolean isChatFocused()
    • getWidth

      private int getWidth()
    • getHeight

      private int getHeight()
    • getScale

      public double getScale()
    • getWidth

      public static int getWidth(double pct)
    • getHeight

      public static int getHeight(double pct)
    • defaultUnfocusedPct

      public static double defaultUnfocusedPct()
    • getLinesPerPage

      public int getLinesPerPage()
    • getLineHeight

      private int getLineHeight()
    • saveAsDraft

      public void saveAsDraft(String text)
    • discardDraft

      public void discardDraft()
    • createScreen

      public <T extends ChatScreen> T createScreen(ChatComponent.ChatMethod chatMethod, ChatAbilities chatAbilities, ChatScreen.ChatConstructor<T> chat)
    • openScreen

      public void openScreen(ChatComponent.ChatMethod chatMethod, ChatAbilities chatAbilities, ChatScreen.ChatConstructor<?> chat)
    • preserveCurrentChatScreen

      public void preserveCurrentChatScreen()
    • restoreChatScreen

      public @Nullable ChatScreen restoreChatScreen()
    • storeState

      public ChatComponent.State storeState()
    • restoreState

      public void restoreState(ChatComponent.State state)