Class ChatComponent
java.lang.Object
net.minecraft.client.gui.components.ChatComponent
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interfacestatic interfacestatic enum(package private) static class(package private) static final recordstatic final record(package private) static class(package private) static class(package private) static interfacestatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<GuiMessage> Chat lines to be displayed in the chat boxprivate static final intprivate intprivate static final Componentprivate @Nullable ChatComponent.Draftprivate static final org.slf4j.Loggerprivate static final intstatic final intprivate static final intprivate final List<ChatComponent.DelayedMessageDeletion> (package private) final Minecraftprivate booleanprivate @Nullable ChatScreenstatic final Identifierprivate static final Styleprivate final ArrayListDeque<String> A list of messages previously sent through the chat GUIprivate static final intprivate static final intprivate final List<GuiMessage.Line> List of the ChatLines currently drawn -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(Component message) voidaddMessage(Component message, @Nullable MessageSignature headerSignature, @Nullable GuiMessageTag tag) private voidaddMessageToDisplayQueue(GuiMessage message) private voidaddMessageToQueue(GuiMessage message) voidaddRecentChat(String message) Adds this string to the list of sent messages, for recall using the up/down arrow keysvoidcaptureClickableText(ActiveTextCollector activeTextCollector, int height, int tickCount, boolean focused) voidclearMessages(boolean clearSentMsgHistory) Clears the chat.private GuiMessagecreateDeletedMarker(GuiMessage message) <T extends ChatScreen>
TcreateScreen(ChatComponent.ChatMethod method, ChatScreen.ChatConstructor<T> constructor) static doublevoiddeleteMessage(MessageSignature messageSignature) private @Nullable ChatComponent.DelayedMessageDeletiondeleteMessageOrDelay(MessageSignature messageSignature) voidprivate intforEachLine(ChatComponent.AlphaCalculator alphaCalculator, ChatComponent.LineConsumer action) private intstatic intgetHeight(double height) private intintdoublegetScale()private intgetWidth()static intgetWidth(double width) booleanprivate booleanprivate voidlogChatMessage(GuiMessage message) voidopenScreen(ChatComponent.ChatMethod method, ChatScreen.ChatConstructor<?> constructor) voidprivate voidprivate voidprivate voidrender(ChatComponent.ChatGraphicsAccess chatGraphicsAccess, int height, int tickCount, boolean focused) voidrender(GuiGraphics graphics, Font font, int tickCount, int globalMouseX, int globalMouseY, boolean focused, boolean changeCursorOnInsertions) voidvoid@Nullable ChatScreenvoidrestoreState(ChatComponent.State state) voidsaveAsDraft(String text) voidscrollChat(int posInc) voidtick()
-
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
-
MESSAGE_BOTTOM_TO_MESSAGE_TOP
public static final int MESSAGE_BOTTOM_TO_MESSAGE_TOP- See Also:
-
QUEUE_EXPAND_ID
-
QUEUE_EXPAND_TEXT_STYLE
-
minecraft
-
recentChat
A list of messages previously sent through the chat GUI -
allMessages
Chat lines to be displayed in the chat box -
trimmedMessages
List of the ChatLines currently drawn -
chatScrollbarPos
private int chatScrollbarPos -
newMessageSinceScroll
private boolean newMessageSinceScroll -
latestDraft
-
preservedScreen
-
messageDeletionQueue
-
-
Constructor Details
-
ChatComponent
-
-
Method Details
-
tick
public void tick() -
forEachLine
private int forEachLine(ChatComponent.AlphaCalculator alphaCalculator, ChatComponent.LineConsumer action) -
render
public void render(GuiGraphics graphics, Font font, int tickCount, int globalMouseX, int globalMouseY, boolean focused, boolean changeCursorOnInsertions) -
captureClickableText
public void captureClickableText(ActiveTextCollector activeTextCollector, int height, int tickCount, boolean focused) -
render
private void render(ChatComponent.ChatGraphicsAccess chatGraphicsAccess, int height, int tickCount, boolean focused) -
isChatHidden
private boolean isChatHidden() -
clearMessages
public void clearMessages(boolean clearSentMsgHistory) Clears the chat.- Parameters:
clearSentMsgHistory- Whether to clear the user's sent message history
-
addMessage
-
addMessage
public void addMessage(Component message, @Nullable MessageSignature headerSignature, @Nullable GuiMessageTag tag) -
logChatMessage
-
addMessageToDisplayQueue
-
addMessageToQueue
-
processMessageDeletionQueue
private void processMessageDeletionQueue() -
deleteMessage
-
deleteMessageOrDelay
private @Nullable ChatComponent.DelayedMessageDeletion deleteMessageOrDelay(MessageSignature messageSignature) -
createDeletedMarker
-
rescaleChat
public void rescaleChat() -
refreshTrimmedMessages
private void refreshTrimmedMessages() -
getRecentChat
-
addRecentChat
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 posInc) -
isChatFocused
public boolean isChatFocused() -
getWidth
private int getWidth() -
getHeight
private int getHeight() -
getScale
public double getScale() -
getWidth
public static int getWidth(double width) -
getHeight
public static int getHeight(double height) -
defaultUnfocusedPct
public static double defaultUnfocusedPct() -
getLinesPerPage
public int getLinesPerPage() -
getLineHeight
private int getLineHeight() -
saveAsDraft
-
discardDraft
public void discardDraft() -
createScreen
public <T extends ChatScreen> T createScreen(ChatComponent.ChatMethod method, ChatScreen.ChatConstructor<T> constructor) -
openScreen
-
preserveCurrentChatScreen
public void preserveCurrentChatScreen() -
restoreChatScreen
-
storeState
-
restoreState
-