Class ChatLogImpl

java.lang.Object
net.minecraft.client.report.ChatLogImpl
All Implemented Interfaces:
ChatLog

@Environment(CLIENT) public class ChatLogImpl extends Object implements 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 evg
intermediary net/minecraft/class_7561
named net/minecraft/client/report/ChatLogImpl
  • Field Details

    • messages

      private final class_7629[] messages
      Mappings:
      Namespace Name Mixin selector
      official b Levg;b:[Levd;
      intermediary field_39638 Lnet/minecraft/class_7561;field_39638:[Lnet/minecraft/class_7629;
      named messages Lnet/minecraft/client/report/ChatLogImpl;messages:[Lnet/minecraft/class_7629;
    • maxIndex

      private int maxIndex
      Mappings:
      Namespace Name Mixin selector
      official c Levg;c:I
      intermediary field_39639 Lnet/minecraft/class_7561;field_39639:I
      named maxIndex Lnet/minecraft/client/report/ChatLogImpl;maxIndex:I
    • minIndex

      private int minIndex
      Mappings:
      Namespace Name Mixin selector
      official d Levg;d:I
      intermediary field_39640 Lnet/minecraft/class_7561;field_39640:I
      named minIndex Lnet/minecraft/client/report/ChatLogImpl;minIndex:I
  • Constructor Details

    • ChatLogImpl

      public ChatLogImpl(int maxMessages)
      Mappings:
      Namespace Name Mixin selector
      official <init> Levg;<init>(I)V
      intermediary <init> Lnet/minecraft/class_7561;<init>(I)V
      named <init> Lnet/minecraft/client/report/ChatLogImpl;<init>(I)V
  • Method Details

    • add

      public void add(class_7629 message)
      Adds message to the log.
      Specified by:
      add in interface ChatLog
      Mappings:
      Namespace Name Mixin selector
      official a Leva;a(Levd;)V
      intermediary method_44535 Lnet/minecraft/class_7555;method_44535(Lnet/minecraft/class_7629;)V
      named add Lnet/minecraft/client/report/ChatLog;add(Lnet/minecraft/class_7629;)V
    • incrementIndex

      private int incrementIndex()
      Returns the incremented index.
      Returns:
      the incremented index
      Implementation Note:
      This always increments maxIndex, and increments minIndex only if the array is already full.
      Mappings:
      Namespace Name Mixin selector
      official e Levg;e()I
      intermediary method_44559 Lnet/minecraft/class_7561;method_44559()I
      named incrementIndex Lnet/minecraft/client/report/ChatLogImpl;incrementIndex()I
    • get

      @Nullable public @Nullable class_7629 get(int index)
      Returns the message with index index, or null if there is no such message in the log.
      Specified by:
      get in interface ChatLog
      Returns:
      the message with index index, or null if there is no such message in the log
      Mappings:
      Namespace Name Mixin selector
      official a Leva;a(I)Levd;
      intermediary method_44532 Lnet/minecraft/class_7555;method_44532(I)Lnet/minecraft/class_7629;
      named get Lnet/minecraft/client/report/ChatLog;get(I)Lnet/minecraft/class_7629;
    • wrapIndex

      private int wrapIndex(int index)
      Returns the message index wrapped for accessing the backing array.
      Returns:
      the message index wrapped for accessing the backing array
      Mappings:
      Namespace Name Mixin selector
      official h Levg;h(I)I
      intermediary method_44560 Lnet/minecraft/class_7561;method_44560(I)I
      named wrapIndex Lnet/minecraft/client/report/ChatLogImpl;wrapIndex(I)I
    • contains

      public boolean contains(int index)
      Returns whether the log contains a message with index index.
      Specified by:
      contains in interface ChatLog
      Returns:
      whether the log contains a message with index index
      Mappings:
      Namespace Name Mixin selector
      official c Leva;c(I)Z
      intermediary method_44540 Lnet/minecraft/class_7555;method_44540(I)Z
      named contains Lnet/minecraft/client/report/ChatLog;contains(I)Z
    • getOffsetIndex

      public int getOffsetIndex(int index, int offset)
      Returns the index offset by offset if there is a message with that index, or -1 if there is no message with the offset index.
      Specified by:
      getOffsetIndex in interface ChatLog
      Returns:
      the index offset by offset if there is a message with that index, or -1 if there is no message with the offset index
      Mappings:
      Namespace Name Mixin selector
      official a Leva;a(II)I
      intermediary method_44533 Lnet/minecraft/class_7555;method_44533(II)I
      named getOffsetIndex Lnet/minecraft/client/report/ChatLog;getOffsetIndex(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:
      getMaxIndex in interface ChatLog
      Returns:
      the maximum index currently used within the log
      Mappings:
      Namespace Name Mixin selector
      official a Leva;a()I
      intermediary method_44531 Lnet/minecraft/class_7555;method_44531()I
      named getMaxIndex Lnet/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:
      getMinIndex in interface ChatLog
      Returns:
      the minimum index currently used within the log
      Mappings:
      Namespace Name Mixin selector
      official b Leva;b()I
      intermediary method_44536 Lnet/minecraft/class_7555;method_44536()I
      named getMinIndex Lnet/minecraft/client/report/ChatLog;getMinIndex()I