Class MessageHandler

java.lang.Object
net.minecraft.client.network.message.MessageHandler

@Environment(CLIENT) public class MessageHandler extends Object
Handles received messages, including chat messages and game messages.
Mappings:
Namespace Name
official eve
intermediary net/minecraft/class_7594
named net/minecraft/client/network/message/MessageHandler
  • Field Details

    • CHAT_VALIDATION_FAILED_DISCONNECT_REASON

      private static final Text CHAT_VALIDATION_FAILED_DISCONNECT_REASON
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a:Lrq;
      intermediary field_39904 Lnet/minecraft/class_7594;field_39904:Lnet/minecraft/class_2561;
      named CHAT_VALIDATION_FAILED_DISCONNECT_REASON Lnet/minecraft/client/network/message/MessageHandler;CHAT_VALIDATION_FAILED_DISCONNECT_REASON:Lnet/minecraft/text/Text;
    • client

      private final MinecraftClient client
      Mappings:
      Namespace Name Mixin selector
      official b Leve;b:Lefu;
      intermediary field_39779 Lnet/minecraft/class_7594;field_39779:Lnet/minecraft/class_310;
      named client Lnet/minecraft/client/network/message/MessageHandler;client:Lnet/minecraft/client/MinecraftClient;
    • delayedMessages

      private final Deque<MessageHandler.ProcessableMessage> delayedMessages
      Mappings:
      Namespace Name Mixin selector
      official c Leve;c:Ljava/util/Deque;
      intermediary field_39796 Lnet/minecraft/class_7594;field_39796:Ljava/util/Deque;
      named delayedMessages Lnet/minecraft/client/network/message/MessageHandler;delayedMessages:Ljava/util/Deque;
    • chatDelay

      private long chatDelay
      Mappings:
      Namespace Name Mixin selector
      official d Leve;d:J
      intermediary field_39797 Lnet/minecraft/class_7594;field_39797:J
      named chatDelay Lnet/minecraft/client/network/message/MessageHandler;chatDelay:J
    • lastProcessTime

      private long lastProcessTime
      Mappings:
      Namespace Name Mixin selector
      official e Leve;e:J
      intermediary field_39798 Lnet/minecraft/class_7594;field_39798:J
      named lastProcessTime Lnet/minecraft/client/network/message/MessageHandler;lastProcessTime:J
  • Constructor Details

    • MessageHandler

      public MessageHandler(MinecraftClient client)
      Mappings:
      Namespace Name Mixin selector
      official <init> Leve;<init>(Lefu;)V
      intermediary <init> Lnet/minecraft/class_7594;<init>(Lnet/minecraft/class_310;)V
      named <init> Lnet/minecraft/client/network/message/MessageHandler;<init>(Lnet/minecraft/client/MinecraftClient;)V
  • Method Details

    • processDelayedMessages

      public void processDelayedMessages()
      Processes all delayed messages until one of them fails to process if the delay has passed, and otherwise does nothing.
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a()V
      intermediary method_44765 Lnet/minecraft/class_7594;method_44765()V
      named processDelayedMessages Lnet/minecraft/client/network/message/MessageHandler;processDelayedMessages()V
    • setChatDelay

      public void setChatDelay(double chatDelay)
      Sets the chat delay to chatDelay seconds. If the chat delay was changed to 0, this also processes all queued messages.
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(D)V
      intermediary method_44766 Lnet/minecraft/class_7594;method_44766(D)V
      named setChatDelay Lnet/minecraft/client/network/message/MessageHandler;setChatDelay(D)V
    • process

      public void process()
      Processes one delayed message from the queue's beginning.
      Mappings:
      Namespace Name Mixin selector
      official b Leve;b()V
      intermediary method_44769 Lnet/minecraft/class_7594;method_44769()V
      named process Lnet/minecraft/client/network/message/MessageHandler;process()V
    • getUnprocessedMessageCount

      public long getUnprocessedMessageCount()
      Returns the number of delayed messages that are not processed yet.
      Returns:
      the number of delayed messages that are not processed yet
      Mappings:
      Namespace Name Mixin selector
      official c Leve;c()J
      intermediary method_44944 Lnet/minecraft/class_7594;method_44944()J
      named getUnprocessedMessageCount Lnet/minecraft/client/network/message/MessageHandler;getUnprocessedMessageCount()J
    • processAll

      public void processAll()
      Processes all delayed messages from the queue.
      Mappings:
      Namespace Name Mixin selector
      official d Leve;d()V
      intermediary method_44945 Lnet/minecraft/class_7594;method_44945()V
      named processAll Lnet/minecraft/client/network/message/MessageHandler;processAll()V
    • removeDelayedMessage

      public boolean removeDelayedMessage(MessageSignatureData signature)
      Removes a delayed message whose signature matches signature. If this returns false, either the message is not received or it it already on the hud.
      Returns:
      whether the message was removed
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lrz;)Z
      intermediary method_44819 Lnet/minecraft/class_7594;method_44819(Lnet/minecraft/class_7469;)Z
      named removeDelayedMessage Lnet/minecraft/client/network/message/MessageHandler;removeDelayedMessage(Lnet/minecraft/network/message/MessageSignatureData;)Z
    • shouldDelay

      private boolean shouldDelay()
      Returns if the chat delay is set and the message should be delayed.
      Returns:
      if the chat delay is set and the message should be delayed
      Mappings:
      Namespace Name Mixin selector
      official e Leve;e()Z
      intermediary method_44775 Lnet/minecraft/class_7594;method_44775()Z
      named shouldDelay Lnet/minecraft/client/network/message/MessageHandler;shouldDelay()Z
    • process

      private void process(MessageHandler.ProcessableMessage message)
      Queues processor during the chat delay, otherwise runs the processor.
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Leve$a;)V
      intermediary method_44818 Lnet/minecraft/class_7594;method_44818(Lnet/minecraft/class_7594$class_7627;)V
      named process Lnet/minecraft/client/network/message/MessageHandler;process(Lnet/minecraft/client/network/message/MessageHandler$ProcessableMessage;)V
    • onChatMessage

      public void onChatMessage(SignedMessage message, MessageType.Parameters params)
      Called when a chat message is received.

      This enqueues the message to be processed after the chat delay set in options, if any.

      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lsd;Lrm$a;)V
      intermediary method_44733 Lnet/minecraft/class_7594;method_44733(Lnet/minecraft/class_7471;Lnet/minecraft/class_2556$class_7602;)V
      named onChatMessage Lnet/minecraft/client/network/message/MessageHandler;onChatMessage(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/network/message/MessageType$Parameters;)V
    • onMessageHeader

      public void onMessageHeader(MessageHeader header, MessageSignatureData signature, byte[] bodyDigest)
      Called when a message header is received.

      Message header is received instead of the full message when a message is censored or when the message is originally sent without metadata due to it being originated from entities. This is to keep the integrity of the "message chain".

      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lsh;Lrz;[B)V
      intermediary method_44820 Lnet/minecraft/class_7594;method_44820(Lnet/minecraft/class_7614;Lnet/minecraft/class_7469;[B)V
      named onMessageHeader Lnet/minecraft/client/network/message/MessageHandler;onMessageHeader(Lnet/minecraft/network/message/MessageHeader;Lnet/minecraft/network/message/MessageSignatureData;[B)V
    • processChatMessage

      boolean processChatMessage(MessageType.Parameters params, SignedMessage message, Text decorated, @Nullable @Nullable PlayerListEntry senderEntry, boolean onlyShowSecureChat, Instant receptionTimestamp)
      Processes a chat message and sends acknowledgment to the server.

      The message can still end up not being displayed if the verification fails and onlyShowSecureChat is true or if the sender is blocked via the social interactions screen.

      Parameters:
      receptionTimestamp - the timestamp when the message was received by this client
      Returns:
      whether the message was actually displayed
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lrm$a;Lsd;Lrq;Leuz;ZLjava/time/Instant;)Z
      intermediary method_44768 Lnet/minecraft/class_7594;method_44768(Lnet/minecraft/class_2556$class_7602;Lnet/minecraft/class_7471;Lnet/minecraft/class_2561;Lnet/minecraft/class_640;ZLjava/time/Instant;)Z
      named processChatMessage Lnet/minecraft/client/network/message/MessageHandler;processChatMessage(Lnet/minecraft/network/message/MessageType$Parameters;Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/text/Text;Lnet/minecraft/client/network/PlayerListEntry;ZLjava/time/Instant;)Z
    • processChatMessageInternal

      private boolean processChatMessageInternal(MessageType.Parameters params, SignedMessage message, Text decorated, @Nullable @Nullable PlayerListEntry senderEntry, boolean onlyShowSecureChat, Instant receptionTimestamp)
      Processes a chat message.

      If the message cannot be verified due to a broken chain, this disconnects the client from the server.

      The message can still end up not being displayed if the verification fails and onlyShowSecureChat is true or if the sender is blocked via the social interactions screen.

      This adds the message to the hud, narrates it, and appends it to the chat log.

      Parameters:
      receptionTimestamp - the timestamp when the message was received by this client
      Returns:
      whether the message was actually displayed
      Mappings:
      Namespace Name Mixin selector
      official b Leve;b(Lrm$a;Lsd;Lrq;Leuz;ZLjava/time/Instant;)Z
      intermediary method_44943 Lnet/minecraft/class_7594;method_44943(Lnet/minecraft/class_2556$class_7602;Lnet/minecraft/class_7471;Lnet/minecraft/class_2561;Lnet/minecraft/class_640;ZLjava/time/Instant;)Z
      named processChatMessageInternal Lnet/minecraft/client/network/message/MessageHandler;processChatMessageInternal(Lnet/minecraft/network/message/MessageType$Parameters;Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/text/Text;Lnet/minecraft/client/network/PlayerListEntry;ZLjava/time/Instant;)Z
    • processProfilelessMessage

      boolean processProfilelessMessage(MessageType.Parameters params, SignedMessage message, Text decorated)
      Processes a message that is sent as chat message but lacks the sender.

      This is usually a message sent via commands executed from /execute command.

      This adds the message to the hud, narrates it, and appends it to the chat log. The message is not verified.

      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lrm$a;Lsd;Lrq;)Z
      intermediary method_44767 Lnet/minecraft/class_7594;method_44767(Lnet/minecraft/class_2556$class_7602;Lnet/minecraft/class_7471;Lnet/minecraft/class_2561;)Z
      named processProfilelessMessage Lnet/minecraft/client/network/message/MessageHandler;processProfilelessMessage(Lnet/minecraft/network/message/MessageType$Parameters;Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/text/Text;)Z
    • processHeader

      boolean processHeader(MessageHeader header, MessageSignatureData signature, byte[] bodyDigest)
      Processes a received message header.

      Message header is received instead of the full message when a message is censored or when the message is originally sent without metadata due to it being originated from entities. This is to keep the integrity of the "message chain".

      If the header cannot be verified due to a broken chain, this disconnects the client from the server.

      This adds the header to the chat log.

      Mappings:
      Namespace Name Mixin selector
      official b Leve;b(Lsh;Lrz;[B)Z
      intermediary method_44821 Lnet/minecraft/class_7594;method_44821(Lnet/minecraft/class_7614;Lnet/minecraft/class_7469;[B)Z
      named processHeader Lnet/minecraft/client/network/message/MessageHandler;processHeader(Lnet/minecraft/network/message/MessageHeader;Lnet/minecraft/network/message/MessageSignatureData;[B)Z
    • disconnect

      private void disconnect()
      Disconnects from the server with reason CHAT_VALIDATION_FAILED_DISCONNECT_REASON.
      Mappings:
      Namespace Name Mixin selector
      official f Leve;f()V
      intermediary method_45031 Lnet/minecraft/class_7594;method_45031()V
      named disconnect Lnet/minecraft/client/network/message/MessageHandler;disconnect()V
    • narrate

      private void narrate(MessageType.Parameters params, Text message)
      Narrates message.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lrm$a;Lrq;)V
      intermediary method_44772 Lnet/minecraft/class_7594;method_44772(Lnet/minecraft/class_2556$class_7602;Lnet/minecraft/class_2561;)V
      named narrate Lnet/minecraft/client/network/message/MessageHandler;narrate(Lnet/minecraft/network/message/MessageType$Parameters;Lnet/minecraft/text/Text;)V
    • getStatus

      private MessageTrustStatus getStatus(SignedMessage message, Text decorated, @Nullable @Nullable PlayerListEntry senderEntry, Instant receptionTimestamp)
      Returns the trust status of message.

      This returns MessageTrustStatus.SECURE for messages that are considered to be always trusted.

      Returns:
      the trust status of message
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lsd;Lrq;Leuz;Ljava/time/Instant;)Levh;
      intermediary method_44732 Lnet/minecraft/class_7594;method_44732(Lnet/minecraft/class_7471;Lnet/minecraft/class_2561;Lnet/minecraft/class_640;Ljava/time/Instant;)Lnet/minecraft/class_7595;
      named getStatus Lnet/minecraft/client/network/message/MessageHandler;getStatus(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/text/Text;Lnet/minecraft/client/network/PlayerListEntry;Ljava/time/Instant;)Lnet/minecraft/client/network/message/MessageTrustStatus;
    • addToChatLog

      private void addToChatLog(SignedMessage message, MessageType.Parameters params, @Nullable @Nullable PlayerListEntry senderEntry, MessageTrustStatus trustStatus)
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lsd;Lrm$a;Leuz;Levh;)V
      intermediary method_44737 Lnet/minecraft/class_7594;method_44737(Lnet/minecraft/class_7471;Lnet/minecraft/class_2556$class_7602;Lnet/minecraft/class_640;Lnet/minecraft/class_7595;)V
      named addToChatLog Lnet/minecraft/client/network/message/MessageHandler;addToChatLog(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/network/message/MessageType$Parameters;Lnet/minecraft/client/network/PlayerListEntry;Lnet/minecraft/client/network/message/MessageTrustStatus;)V
    • addToChatLog

      private void addToChatLog(Text message, Instant timestamp)
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lrq;Ljava/time/Instant;)V
      intermediary method_44735 Lnet/minecraft/class_7594;method_44735(Lnet/minecraft/class_2561;Ljava/time/Instant;)V
      named addToChatLog Lnet/minecraft/client/network/message/MessageHandler;addToChatLog(Lnet/minecraft/text/Text;Ljava/time/Instant;)V
    • addToChatLog

      private void addToChatLog(MessageHeader header, MessageSignatureData signatures, byte[] bodyDigest)
      Mappings:
      Namespace Name Mixin selector
      official c Leve;c(Lsh;Lrz;[B)V
      intermediary method_44822 Lnet/minecraft/class_7594;method_44822(Lnet/minecraft/class_7614;Lnet/minecraft/class_7469;[B)V
      named addToChatLog Lnet/minecraft/client/network/message/MessageHandler;addToChatLog(Lnet/minecraft/network/message/MessageHeader;Lnet/minecraft/network/message/MessageSignatureData;[B)V
    • getPlayerListEntry

      @Nullable private @Nullable PlayerListEntry getPlayerListEntry(UUID sender)
      Returns the player list entry for sender, or null if the sender's UUID did not correspond to any known players.
      Returns:
      the player list entry for sender, or null if the sender's UUID did not correspond to any known players
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Ljava/util/UUID;)Leuz;
      intermediary method_44731 Lnet/minecraft/class_7594;method_44731(Ljava/util/UUID;)Lnet/minecraft/class_640;
      named getPlayerListEntry Lnet/minecraft/client/network/message/MessageHandler;getPlayerListEntry(Ljava/util/UUID;)Lnet/minecraft/client/network/PlayerListEntry;
    • onGameMessage

      public void onGameMessage(Text message, boolean overlay)
      Called when a game message is received.

      Game messages ignore chat delay.

      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lrq;Z)V
      intermediary method_44736 Lnet/minecraft/class_7594;method_44736(Lnet/minecraft/class_2561;Z)V
      named onGameMessage Lnet/minecraft/client/network/message/MessageHandler;onGameMessage(Lnet/minecraft/text/Text;Z)V
    • extractSender

      private UUID extractSender(Text text)
      Mappings:
      Namespace Name Mixin selector
      official a Leve;a(Lrq;)Ljava/util/UUID;
      intermediary method_44734 Lnet/minecraft/class_7594;method_44734(Lnet/minecraft/class_2561;)Ljava/util/UUID;
      named extractSender Lnet/minecraft/client/network/message/MessageHandler;extractSender(Lnet/minecraft/text/Text;)Ljava/util/UUID;
    • isAlwaysTrusted

      private boolean isAlwaysTrusted(UUID sender)
      Returns whether messages from sender are always trusted.

      Messages from this client's player in a singleplayer world are always trusted.

      Returns:
      whether messages from sender are always trusted
      Mappings:
      Namespace Name Mixin selector
      official b Leve;b(Ljava/util/UUID;)Z
      intermediary method_44738 Lnet/minecraft/class_7594;method_44738(Ljava/util/UUID;)Z
      named isAlwaysTrusted Lnet/minecraft/client/network/message/MessageHandler;isAlwaysTrusted(Ljava/util/UUID;)Z