Package net.minecraft.client.report
Class ChatLogImpl
java.lang.Object
net.minecraft.client.report.ChatLogImpl
- All Implemented Interfaces:
ChatLog
An implementation of
ChatLog using a fixed-size array and 0 as the
starting index. When adding a log, the index is incremented, and the message at the
index is overwritten. If the index goes above the array size, the array index wraps
around but the message index is still incremented.
For example, if the size is 10, after adding the 10th item, the next index is
10 because the log is 0-indexed. However, the next message will be stored at
messages[0]. Use wrapIndex(int) to calculate the wrapped index.
- Mappings:
Namespace Name official eumintermediary net/minecraft/class_7561named net/minecraft/client/report/ChatLogImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.report.ChatLog
ChatLog.Streams -
Field Summary
FieldsFields inherited from interface net.minecraft.client.report.ChatLog
MISSING_NEXT_INDEX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ReceivedMessage message) Addsmessageto the log.intclampWithOffset(int index, int offset) Returns the index offset byoffsetand clamped between the minimum and the maximum indices.booleancontains(int index) Returns whether the log contains a message with indexindex.get(int index) Returns the message with indexindex, ornullif there is no such message in the log.intReturns the maximum index currently used within the log.intReturns the minimum index currently used within the log.intgetOffsetIndex(int index, int offset) Returns the index offset byoffsetif there is a message with that index, or -1 if there is no message with the offset index.private intReturns the incremented index.private intwrapIndex(int index) Returns the messageindexwrapped for accessing the backing array.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.report.ChatLog
getIndexed, getNextIndex, getPreviousIndex, stream, streamBackward, streamBackward, streamForward, streamForward, streamForward
-
Field Details
-
messages
- Mappings:
Namespace Name Mixin selector official bLeum;b:[Leul;intermediary field_39638Lnet/minecraft/class_7561;field_39638:[Lnet/minecraft/class_7557;named messagesLnet/minecraft/client/report/ChatLogImpl;messages:[Lnet/minecraft/client/report/ReceivedMessage;
-
maxIndex
private int maxIndex- Mappings:
Namespace Name Mixin selector official cLeum;c:Iintermediary field_39639Lnet/minecraft/class_7561;field_39639:Inamed maxIndexLnet/minecraft/client/report/ChatLogImpl;maxIndex:I
-
minIndex
private int minIndex- Mappings:
Namespace Name Mixin selector official dLeum;d:Iintermediary field_39640Lnet/minecraft/class_7561;field_39640:Inamed minIndexLnet/minecraft/client/report/ChatLogImpl;minIndex:I
-
-
Constructor Details
-
ChatLogImpl
public ChatLogImpl(int maxMessages) - Mappings:
Namespace Name Mixin selector official <init>Leum;<init>(I)Vintermediary <init>Lnet/minecraft/class_7561;<init>(I)Vnamed <init>Lnet/minecraft/client/report/ChatLogImpl;<init>(I)V
-
-
Method Details
-
add
Addsmessageto the log. -
incrementIndex
private int incrementIndex()Returns the incremented index.- Returns:
- the incremented index
- Implementation Note:
- This always increments
maxIndex, and incrementsminIndexonly if the array is already full. - Mappings:
Namespace Name Mixin selector official eLeum;e()Iintermediary method_44559Lnet/minecraft/class_7561;method_44559()Inamed incrementIndexLnet/minecraft/client/report/ChatLogImpl;incrementIndex()I
-
get
Returns the message with indexindex, ornullif there is no such message in the log.- Specified by:
getin interfaceChatLog- Returns:
- the message with index
index, ornullif there is no such message in the log - Mappings:
Namespace Name Mixin selector official aLeuj;a(I)Leul;intermediary method_44532Lnet/minecraft/class_7555;method_44532(I)Lnet/minecraft/class_7557;named getLnet/minecraft/client/report/ChatLog;get(I)Lnet/minecraft/client/report/ReceivedMessage;
-
wrapIndex
private int wrapIndex(int index) Returns the messageindexwrapped for accessing the backing array.- Returns:
- the message
indexwrapped for accessing the backing array - Mappings:
Namespace Name Mixin selector official hLeum;h(I)Iintermediary method_44560Lnet/minecraft/class_7561;method_44560(I)Inamed wrapIndexLnet/minecraft/client/report/ChatLogImpl;wrapIndex(I)I
-
contains
public boolean contains(int index) Returns whether the log contains a message with indexindex.- Specified by:
containsin interfaceChatLog- Returns:
- whether the log contains a message with index
index - Mappings:
Namespace Name Mixin selector official cLeuj;c(I)Zintermediary method_44540Lnet/minecraft/class_7555;method_44540(I)Znamed containsLnet/minecraft/client/report/ChatLog;contains(I)Z
-
getOffsetIndex
public int getOffsetIndex(int index, int offset) Returns the index offset byoffsetif there is a message with that index, or -1 if there is no message with the offset index.- Specified by:
getOffsetIndexin interfaceChatLog- Returns:
- the index offset by
offsetif there is a message with that index, or -1 if there is no message with the offset index - Mappings:
Namespace Name Mixin selector official aLeuj;a(II)Iintermediary method_44533Lnet/minecraft/class_7555;method_44533(II)Inamed getOffsetIndexLnet/minecraft/client/report/ChatLog;getOffsetIndex(II)I
-
clampWithOffset
public int clampWithOffset(int index, int offset) Returns the index offset byoffsetand clamped between the minimum and the maximum indices.- Specified by:
clampWithOffsetin interfaceChatLog- Returns:
- the index offset by
offsetand clamped between the minimum and the maximum indices - See Also:
- Mappings:
Namespace Name Mixin selector official bLeuj;b(II)Iintermediary method_44538Lnet/minecraft/class_7555;method_44538(II)Inamed clampWithOffsetLnet/minecraft/client/report/ChatLog;clampWithOffset(II)I
-
getMaxIndex
public int getMaxIndex()Returns the maximum index currently used within the log.This value changes every time a new message gets added. The message associated with this index is the newest one in the log.
- Specified by:
getMaxIndexin interfaceChatLog- Returns:
- the maximum index currently used within the log
- Mappings:
Namespace Name Mixin selector official aLeuj;a()Iintermediary method_44531Lnet/minecraft/class_7555;method_44531()Inamed getMaxIndexLnet/minecraft/client/report/ChatLog;getMaxIndex()I
-
getMinIndex
public int getMinIndex()Returns the minimum index currently used within the log.This value can change every time a new message gets added. The message associated with this index is the oldest one in the log.
- Specified by:
getMinIndexin interfaceChatLog- Returns:
- the minimum index currently used within the log
- Mappings:
Namespace Name Mixin selector official bLeuj;b()Iintermediary method_44536Lnet/minecraft/class_7555;method_44536()Inamed getMinIndexLnet/minecraft/client/report/ChatLog;getMinIndex()I
-