Class AcknowledgmentValidator

java.lang.Object
net.minecraft.network.message.AcknowledgmentValidator

public class AcknowledgmentValidator extends Object
A class that validates the clients' message acknowledgment.

When clients receive or send messages, they send "acknowledgments" to the server, containing messages they've last seen or received. If there are too many messages waiting for message acknowledgments (more than 4096), or if the acknowledgment is incorrect, the client will be disconnected.

Mappings:
Namespace Name
official ry
intermediary net/minecraft/class_7638
named net/minecraft/network/message/AcknowledgmentValidator
  • Field Details

    • UNKNOWN

      private static final int UNKNOWN
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lry;a:I
      intermediary field_39888 Lnet/minecraft/class_7638;field_39888:I
      named UNKNOWN Lnet/minecraft/network/message/AcknowledgmentValidator;UNKNOWN:I
    • prevValidated

      private LastSeenMessageList prevValidated
      Mappings:
      Namespace Name Mixin selector
      official b Lry;b:Lrw;
      intermediary field_39889 Lnet/minecraft/class_7638;field_39889:Lnet/minecraft/class_7635;
      named prevValidated Lnet/minecraft/network/message/AcknowledgmentValidator;prevValidated:Lnet/minecraft/network/message/LastSeenMessageList;
    • pending

      private final ObjectList<LastSeenMessageList.Entry> pending
      Mappings:
      Namespace Name Mixin selector
      official c Lry;c:Lit/unimi/dsi/fastutil/objects/ObjectList;
      intermediary field_39890 Lnet/minecraft/class_7638;field_39890:Lit/unimi/dsi/fastutil/objects/ObjectList;
      named pending Lnet/minecraft/network/message/AcknowledgmentValidator;pending:Lit/unimi/dsi/fastutil/objects/ObjectList;
  • Constructor Details

    • AcknowledgmentValidator

      public AcknowledgmentValidator()
  • Method Details

    • addPending

      public void addPending(LastSeenMessageList.Entry entry)
      Mappings:
      Namespace Name Mixin selector
      official a Lry;a(Lrw$a;)V
      intermediary method_44989 Lnet/minecraft/class_7638;method_44989(Lnet/minecraft/class_7635$class_7609;)V
      named addPending Lnet/minecraft/network/message/AcknowledgmentValidator;addPending(Lnet/minecraft/network/message/LastSeenMessageList$Entry;)V
    • getPendingCount

      public int getPendingCount()
      Mappings:
      Namespace Name Mixin selector
      official a Lry;a()I
      intermediary method_44987 Lnet/minecraft/class_7638;method_44987()I
      named getPendingCount Lnet/minecraft/network/message/AcknowledgmentValidator;getPendingCount()I
    • hasDuplicateProfiles

      private boolean hasDuplicateProfiles(LastSeenMessageList messages)
      Returns whether messages have multiple entries with the same profile ID.

      If true, validation fails.

      Returns:
      whether messages have multiple entries with the same profile ID
      Mappings:
      Namespace Name Mixin selector
      official a Lry;a(Lrw;)Z
      intermediary method_44991 Lnet/minecraft/class_7638;method_44991(Lnet/minecraft/class_7635;)Z
      named hasDuplicateProfiles Lnet/minecraft/network/message/AcknowledgmentValidator;hasDuplicateProfiles(Lnet/minecraft/network/message/LastSeenMessageList;)Z
    • order

      private int order(List<LastSeenMessageList.Entry> lastSeen, int[] result, @Nullable LastSeenMessageList.Entry lastReceived)
      Orders lastSeen. result should be an array with the same size as lastSeen, and it will hold the order of each entry, where a larger integer corresponds to more recent message. If the integer is -2147483648, then the message is unknown (neither previously acknowledged nor is newly sent), which causes validation failure.
      Returns:
      the order of the last received message; if any messages have higher order than this, it is a validation failure.
      Mappings:
      Namespace Name Mixin selector
      official a Lry;a(Ljava/util/List;[ILrw$a;)I
      intermediary method_44988 Lnet/minecraft/class_7638;method_44988(Ljava/util/List;[ILnet/minecraft/class_7635$class_7609;)I
      named order Lnet/minecraft/network/message/AcknowledgmentValidator;order(Ljava/util/List;[ILnet/minecraft/network/message/LastSeenMessageList$Entry;)I
    • validate

      Validates acknowledgment.
      Returns:
      reasons for acknowledgment validation failure, or an empty set if validation is successful
      Mappings:
      Namespace Name Mixin selector
      official a Lry;a(Lrw$b;)Ljava/util/Set;
      intermediary method_44990 Lnet/minecraft/class_7638;method_44990(Lnet/minecraft/class_7635$class_7636;)Ljava/util/Set;
      named validate Lnet/minecraft/network/message/AcknowledgmentValidator;validate(Lnet/minecraft/network/message/LastSeenMessageList$Acknowledgment;)Ljava/util/Set;