Record Class MessageType

java.lang.Object
java.lang.Record
net.minecraft.network.MessageType
Record Components:
chat - the display rule of a message to the chat hud, or Optional.empty() if it is not displayed
overlay - the display rule of a message to the in-game hud overlay, or Optional.empty() if it is not displayed
narration - the narration rule of a message, or Optional.empty() if it is not narrated

public record MessageType(Optional<MessageType.DisplayRule> chat, Optional<MessageType.DisplayRule> overlay, Optional<MessageType.NarrationRule> narration) extends Record
A message type, or chat type in registry, or chat style format per Minecraft blog, defines how a piece of text content should be rendered. It can direct messages to the chat hud, the in-game hud overlay, and the narrator, and format them with the sender information.
Mappings:
Namespace Name
official rc
intermediary net/minecraft/class_2556
named net/minecraft/network/MessageType
official j
intermediary comp_792
named chat
official k
intermediary comp_793
named overlay
official l
intermediary comp_794
named narration
  • Field Details

    • chat

      private final Optional<MessageType.DisplayRule> chat
      The field for the chat record component.
    • overlay

      private final Optional<MessageType.DisplayRule> overlay
      The field for the overlay record component.
    • narration

      private final Optional<MessageType.NarrationRule> narration
      The field for the narration record component.
    • CODEC

      public static final com.mojang.serialization.Codec<MessageType> CODEC
      The codec for the message type.
      Mappings:
      Namespace Name Mixin selector
      official a Lrc;a:Lcom/mojang/serialization/Codec;
      intermediary field_39227 Lnet/minecraft/class_2556;field_39227:Lcom/mojang/serialization/Codec;
      named CODEC Lnet/minecraft/network/MessageType;CODEC:Lcom/mojang/serialization/Codec;
    • CHAT

      public static final RegistryKey<MessageType> CHAT
      Mappings:
      Namespace Name Mixin selector
      official b Lrc;b:Lzx;
      intermediary field_11737 Lnet/minecraft/class_2556;field_11737:Lnet/minecraft/class_5321;
      named CHAT Lnet/minecraft/network/MessageType;CHAT:Lnet/minecraft/util/registry/RegistryKey;
    • SYSTEM

      public static final RegistryKey<MessageType> SYSTEM
      Mappings:
      Namespace Name Mixin selector
      official c Lrc;c:Lzx;
      intermediary field_11735 Lnet/minecraft/class_2556;field_11735:Lnet/minecraft/class_5321;
      named SYSTEM Lnet/minecraft/network/MessageType;SYSTEM:Lnet/minecraft/util/registry/RegistryKey;
    • GAME_INFO

      public static final RegistryKey<MessageType> GAME_INFO
      Mappings:
      Namespace Name Mixin selector
      official d Lrc;d:Lzx;
      intermediary field_11733 Lnet/minecraft/class_2556;field_11733:Lnet/minecraft/class_5321;
      named GAME_INFO Lnet/minecraft/network/MessageType;GAME_INFO:Lnet/minecraft/util/registry/RegistryKey;
    • SAY_COMMAND

      public static final RegistryKey<MessageType> SAY_COMMAND
      Mappings:
      Namespace Name Mixin selector
      official e Lrc;e:Lzx;
      intermediary field_39228 Lnet/minecraft/class_2556;field_39228:Lnet/minecraft/class_5321;
      named SAY_COMMAND Lnet/minecraft/network/MessageType;SAY_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
    • MSG_COMMAND

      public static final RegistryKey<MessageType> MSG_COMMAND
      Mappings:
      Namespace Name Mixin selector
      official f Lrc;f:Lzx;
      intermediary field_39229 Lnet/minecraft/class_2556;field_39229:Lnet/minecraft/class_5321;
      named MSG_COMMAND Lnet/minecraft/network/MessageType;MSG_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
    • TEAM_MSG_COMMAND

      public static final RegistryKey<MessageType> TEAM_MSG_COMMAND
      Mappings:
      Namespace Name Mixin selector
      official g Lrc;g:Lzx;
      intermediary field_39230 Lnet/minecraft/class_2556;field_39230:Lnet/minecraft/class_5321;
      named TEAM_MSG_COMMAND Lnet/minecraft/network/MessageType;TEAM_MSG_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
    • EMOTE_COMMAND

      public static final RegistryKey<MessageType> EMOTE_COMMAND
      Mappings:
      Namespace Name Mixin selector
      official h Lrc;h:Lzx;
      intermediary field_39231 Lnet/minecraft/class_2556;field_39231:Lnet/minecraft/class_5321;
      named EMOTE_COMMAND Lnet/minecraft/network/MessageType;EMOTE_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
    • TELLRAW_COMMAND

      public static final RegistryKey<MessageType> TELLRAW_COMMAND
      Mappings:
      Namespace Name Mixin selector
      official i Lrc;i:Lzx;
      intermediary field_39232 Lnet/minecraft/class_2556;field_39232:Lnet/minecraft/class_5321;
      named TELLRAW_COMMAND Lnet/minecraft/network/MessageType;TELLRAW_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
  • Constructor Details

  • Method Details

    • getKey

      private static RegistryKey<MessageType> getKey(String id)
      Mappings:
      Namespace Name Mixin selector
      official a Lrc;a(Ljava/lang/String;)Lzx;
      intermediary method_43845 Lnet/minecraft/class_2556;method_43845(Ljava/lang/String;)Lnet/minecraft/class_5321;
      named getKey Lnet/minecraft/network/MessageType;getKey(Ljava/lang/String;)Lnet/minecraft/util/registry/RegistryKey;
    • registerAndGetDefault

      public static MessageType registerAndGetDefault(Registry<MessageType> registry)
      Registers the built-in message types and returns the default "chat" type.
      Mappings:
      Namespace Name Mixin selector
      official a Lrc;a(Lhi;)Lrc;
      intermediary method_43844 Lnet/minecraft/class_2556;method_43844(Lnet/minecraft/class_2378;)Lnet/minecraft/class_2556;
      named registerAndGetDefault Lnet/minecraft/network/MessageType;registerAndGetDefault(Lnet/minecraft/util/registry/Registry;)Lnet/minecraft/network/MessageType;
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object object)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • chat

      Returns the value of the chat record component.
      Returns:
      the value of the chat record component
    • overlay

      public Optional<MessageType.DisplayRule> overlay()
      Returns the value of the overlay record component.
      Returns:
      the value of the overlay record component
    • narration

      public Optional<MessageType.NarrationRule> narration()
      Returns the value of the narration record component.
      Returns:
      the value of the narration record component