Class ChatComponent
java.lang.Object
net.minecraft.client.gui.components.ChatComponent
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final record
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<GuiMessage> Chat lines to be displayed in the chat boxprivate static final int
private int
private static final Component
private static final org.slf4j.Logger
private static final int
private static final int
private static final int
private static final int
private final List
<ChatComponent.DelayedMessageDeletion> private final Minecraft
private boolean
private final ArrayListDeque
<String> A list of messages previously sent through the chat GUIprivate static final int
private final List
<GuiMessage.Line> List of the ChatLines currently drawn -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessage
(Component pChatComponent) void
addMessage
(Component pChatComponent, MessageSignature pHeaderSignature, GuiMessageTag pTag) private void
addMessageToDisplayQueue
(GuiMessage pMessage) private void
addMessageToQueue
(GuiMessage pMessage) void
addRecentChat
(String pMessage) Adds this string to the list of sent messages, for recall using the up/down arrow keysvoid
clearMessages
(boolean pClearSentMsgHistory) Clears the chat.private GuiMessage
createDeletedMarker
(GuiMessage pMessage) static double
void
deleteMessage
(MessageSignature pMessageSignature) deleteMessageOrDelay
(MessageSignature pMessageSignature) private void
drawTagIcon
(GuiGraphics pGuiGraphics, int pLeft, int pBottom, GuiMessageTag.Icon pTagIcon) getClickedComponentStyleAt
(double pMouseX, double pMouseY) int
static int
getHeight
(double pHeight) private int
int
private int
getMessageEndIndexAt
(double pMouseX, double pMouseY) private int
getMessageLineIndexAt
(double pMouseX, double pMouseY) getMessageTagAt
(double pMouseX, double pMouseY) double
getScale()
private int
getTagIconLeft
(GuiMessage.Line pLine) private static double
getTimeFactor
(int pCounter) int
getWidth()
static int
getWidth
(double pWidth) boolean
handleChatQueueClicked
(double pMouseX, double pMouseY) private boolean
hasSelectedMessageTag
(double pX, GuiMessage.Line pLine, GuiMessageTag pTag) boolean
private boolean
private void
logChatMessage
(GuiMessage pMessage) private void
private void
void
render
(GuiGraphics pGuiGraphics, int pTickCount, int pMouseX, int pMouseY, boolean pFocused) void
void
void
restoreState
(ChatComponent.State pState) private double
screenToChatX
(double pX) private double
screenToChatY
(double pY) void
scrollChat
(int pPosInc) void
tick()
-
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 -
messageDeletionQueue
-
-
Constructor Details
-
ChatComponent
-
-
Method Details
-
tick
public void tick() -
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() -
storeState
-
restoreState
-