Class ChatComponent
java.lang.Object
net.minecraft.client.gui.components.ChatComponent
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum(package private) static final recordstatic final record(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 ChatComponent.Draftprivate static final org.slf4j.Loggerprivate static final intprivate static final intprivate static final intprivate static final intprivate final List<ChatComponent.DelayedMessageDeletion> private final Minecraftprivate booleanprivate ChatScreenprivate final ArrayListDeque<String> A list of messages previously sent through the chat GUIprivate static final intprivate final List<GuiMessage.Line> List of the ChatLines currently drawn -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(Component pChatComponent) voidaddMessage(Component pChatComponent, MessageSignature pHeaderSignature, GuiMessageTag pTag) private voidaddMessageToDisplayQueue(GuiMessage pMessage) private voidaddMessageToQueue(GuiMessage pMessage) voidaddRecentChat(String pMessage) Adds this string to the list of sent messages, for recall using the up/down arrow keysvoidclearMessages(boolean pClearSentMsgHistory) Clears the chat.private GuiMessagecreateDeletedMarker(GuiMessage pMessage) <T extends ChatScreen>
TcreateScreen(ChatComponent.ChatMethod pMethod, ChatScreen.ChatConstructor<T> pConstructor) static doublevoiddeleteMessage(MessageSignature pMessageSignature) deleteMessageOrDelay(MessageSignature pMessageSignature) voidprivate voiddrawTagIcon(GuiGraphics pGuiGraphics, int pLeft, int pBottom, GuiMessageTag.Icon pTagIcon) private intforEachLine(int pLinesPerPage, int pTickCount, boolean pFocused, int pBottomY, ChatComponent.LineConsumer pAction) getClickedComponentStyleAt(double pMouseX, double pMouseY) intstatic intgetHeight(double pHeight) private intintprivate intgetMessageEndIndexAt(double pMouseX, double pMouseY) private intgetMessageLineIndexAt(double pMouseX, double pMouseY) getMessageTagAt(double pMouseX, double pMouseY) doublegetScale()private intgetTagIconLeft(GuiMessage.Line pLine) private static doublegetTimeFactor(int pCounter) intgetWidth()static intgetWidth(double pWidth) booleanhandleChatQueueClicked(double pMouseX, double pMouseY) private booleanhasSelectedMessageTag(double pX, GuiMessage.Line pLine, GuiMessageTag pTag) booleanprivate booleanprivate voidlogChatMessage(GuiMessage pMessage) voidopenScreen(ChatComponent.ChatMethod pMethod, ChatScreen.ChatConstructor<?> pConstructor) voidprivate voidprivate voidvoidrender(GuiGraphics pGuiGraphics, int pTickCount, int pMouseX, int pMouseY, boolean pFocused) voidvoidvoidrestoreState(ChatComponent.State pState) voidsaveAsDraft(String pText) private doublescreenToChatX(double pX) private doublescreenToChatY(double pY) voidscrollChat(int pPosInc) voidtick()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
MAX_CHAT_HISTORY
private static final int MAX_CHAT_HISTORY- See Also:
-
MESSAGE_NOT_FOUND
private static final int MESSAGE_NOT_FOUND- See Also:
-
MESSAGE_INDENT
private static final int MESSAGE_INDENT- See Also:
-
MESSAGE_TAG_MARGIN_LEFT
private static final int MESSAGE_TAG_MARGIN_LEFT- See Also:
-
BOTTOM_MARGIN
private static final int BOTTOM_MARGIN- See Also:
-
TIME_BEFORE_MESSAGE_DELETION
private static final int TIME_BEFORE_MESSAGE_DELETION- See Also:
-
DELETED_CHAT_MESSAGE
-
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(int pLinesPerPage, int pTickCount, boolean pFocused, int pBottomY, ChatComponent.LineConsumer pAction) -
render
public void render(GuiGraphics pGuiGraphics, int pTickCount, int pMouseX, int pMouseY, boolean pFocused) -
drawTagIcon
private void drawTagIcon(GuiGraphics pGuiGraphics, int pLeft, int pBottom, GuiMessageTag.Icon pTagIcon) -
getTagIconLeft
-
isChatHidden
private boolean isChatHidden() -
getTimeFactor
private static double getTimeFactor(int pCounter) -
clearMessages
public void clearMessages(boolean pClearSentMsgHistory) Clears the chat.- Parameters:
pClearSentMsgHistory- Whether to clear the user's sent message history
-
addMessage
-
addMessage
public void addMessage(Component pChatComponent, @Nullable MessageSignature pHeaderSignature, @Nullable GuiMessageTag pTag) -
logChatMessage
-
addMessageToDisplayQueue
-
addMessageToQueue
-
processMessageDeletionQueue
private void processMessageDeletionQueue() -
deleteMessage
-
deleteMessageOrDelay
@Nullable private ChatComponent.DelayedMessageDeletion deleteMessageOrDelay(MessageSignature pMessageSignature) -
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 pPosInc) -
handleChatQueueClicked
public boolean handleChatQueueClicked(double pMouseX, double pMouseY) -
getClickedComponentStyleAt
-
getMessageTagAt
-
hasSelectedMessageTag
-
screenToChatX
private double screenToChatX(double pX) -
screenToChatY
private double screenToChatY(double pY) -
getMessageEndIndexAt
private int getMessageEndIndexAt(double pMouseX, double pMouseY) -
getMessageLineIndexAt
private int getMessageLineIndexAt(double pMouseX, double pMouseY) -
isChatFocused
public boolean isChatFocused() -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getScale
public double getScale() -
getWidth
public static int getWidth(double pWidth) -
getHeight
public static int getHeight(double pHeight) -
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 pMethod, ChatScreen.ChatConstructor<T> pConstructor) -
openScreen
public void openScreen(ChatComponent.ChatMethod pMethod, ChatScreen.ChatConstructor<?> pConstructor) -
preserveCurrentChatScreen
public void preserveCurrentChatScreen() -
restoreChatScreen
-
storeState
-
restoreState
-