Class ChatLogImpl

java.lang.Object
net.minecraft.client.report.log.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 entry at the index is overwritten. If the index goes above the array size, the array index wraps around but the entry 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 evl
intermediary net/minecraft/class_7561
named net/minecraft/client/report/log/ChatLogImpl
  • Field Details

    • entries

      private final ChatLogEntry[] entries
      Mappings:
      Namespace Name Mixin selector
      official b Levl;b:[Levi;
      intermediary field_39638 Lnet/minecraft/class_7561;field_39638:[Lnet/minecraft/class_7629;
      named entries Lnet/minecraft/client/report/log/ChatLogImpl;entries:[Lnet/minecraft/client/report/log/ChatLogEntry;
    • maxIndex

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

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

    • ChatLogImpl

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

    • add

      public void add(ChatLogEntry entry)
      Adds entry to the log.
      Specified by:
      add in interface ChatLog
      Mappings:
      Namespace Name Mixin selector
      official a Levf;a(Levi;)V
      intermediary method_44535 Lnet/minecraft/class_7555;method_44535(Lnet/minecraft/class_7629;)V
      named add Lnet/minecraft/client/report/log/ChatLog;add(Lnet/minecraft/client/report/log/ChatLogEntry;)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 Levl;e()I
      intermediary method_44559 Lnet/minecraft/class_7561;method_44559()I
      named incrementIndex Lnet/minecraft/client/report/log/ChatLogImpl;incrementIndex()I
    • get

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

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

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

      public int getOffsetIndex(int index, int offset)
      Returns the index offset by offset if there is an entry with that index, or -1 if there is no entry with the offset index.
      Specified by:
      getOffsetIndex in interface ChatLog
      Returns:
      the index offset by offset if there is an entry with that index, or -1 if there is no entry with the offset index
      Mappings:
      Namespace Name Mixin selector
      official a Levf;a(II)I
      intermediary method_44533 Lnet/minecraft/class_7555;method_44533(II)I
      named getOffsetIndex Lnet/minecraft/client/report/log/ChatLog;getOffsetIndex(II)I
    • getMaxIndex

      public int getMaxIndex()
      Returns the maximum index currently used within the log.

      This value changes every time a new entry gets added. The entry 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 Levf;a()I
      intermediary method_44531 Lnet/minecraft/class_7555;method_44531()I
      named getMaxIndex Lnet/minecraft/client/report/log/ChatLog;getMaxIndex()I
    • getMinIndex

      public int getMinIndex()
      Returns the minimum index currently used within the log.

      This value can change every time a new entry gets added. The entry 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 Levf;b()I
      intermediary method_44536 Lnet/minecraft/class_7555;method_44536()I
      named getMinIndex Lnet/minecraft/client/report/log/ChatLog;getMinIndex()I