Package net.minecraft.network.message
Record Class MessageType
java.lang.Object
java.lang.Record
net.minecraft.network.message.MessageType
- Record Components:
chat- the display rule for the content displayed in the chat hud, orif it should not be displayed in the chat hudinvalid @link
Optional#empty()narration- the narration rule for the content, orif it should not be narratedinvalid @link
Optional#empty()
A message type (also known as "chat type") controls whether to display or narrate
the messages sent to the clients, and if so, how. Message types are registered
at
BuiltinRegistries.MESSAGE_TYPE. When
sending a message, the registry key of the message type can be passed to indicate
which message type should be used.
Message type has three fields, all of which are optional. If the field is empty, the message is not displayed or narrated there.
chatcontrols the content displayed in the chat hud.-
controls the content displayed as the overlay (above the hotbar).
invalid @link
#overlay narrationcontrols the narrated content.
The display rules and the narration rule can optionally have a "decoration", which is an
instance of Decoration. Decorations are pre-defined message formatting and
styling rules, which can be applied to the message to
produce the displayed or narrated text. If there is no decoration, the message is used
without any extra processing. See the documentation for
and
invalid @link
MessageType.DisplayRule
for details.invalid @link
MessageType.NarrationRule
- See Also:
-
-
invalid @see
net.minecraft.server.PlayerManager#broadcast(Text, RegistryKey)
-
- Mappings:
Namespace Name official riintermediary net/minecraft/class_2556named net/minecraft/network/message/MessageTypeofficial hintermediary comp_792named chatofficial iintermediary comp_794named narration
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DecorationThe field for thechatrecord component.static final RegistryKey<MessageType>The registry key for the message type used bychat messages.static final Decorationstatic final com.mojang.serialization.Codec<MessageType>static final RegistryKey<MessageType>The registry key for the emote command message type, used by /me.static final RegistryKey<MessageType>The registry key for the message command message type, used by /msg.private final DecorationThe field for thenarrationrecord component.static final RegistryKey<MessageType>The registry key for the say command message type, used by /say.static final RegistryKey<MessageType>The registry key for the team message command message type, used by /teammsg. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchat()Returns the value of thechatrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static RegistryEntry<MessageType>initialize(Registry<MessageType> registry) Returns the value of thenarrationrecord component.private static RegistryKey<MessageType>final StringtoString()Returns a string representation of this record class.
-
Field Details
-
chat
The field for thechatrecord component. -
narration
The field for thenarrationrecord component. -
CODEC
- Mappings:
Namespace Name Mixin selector official aLri;a:Lcom/mojang/serialization/Codec;intermediary field_39227Lnet/minecraft/class_2556;field_39227:Lcom/mojang/serialization/Codec;named CODECLnet/minecraft/network/message/MessageType;CODEC:Lcom/mojang/serialization/Codec;
-
CHAT_TEXT_DECORATION
- Mappings:
Namespace Name Mixin selector official bLri;b:Lrj;intermediary field_39677Lnet/minecraft/class_2556;field_39677:Lnet/minecraft/class_7463;named CHAT_TEXT_DECORATIONLnet/minecraft/network/message/MessageType;CHAT_TEXT_DECORATION:Lnet/minecraft/text/Decoration;
-
CHAT
The registry key for the message type used bychat messages. The message content is decorated using thechat.type.texttext.- Mappings:
Namespace Name Mixin selector official cLri;c:Laai;intermediary field_11737Lnet/minecraft/class_2556;field_11737:Lnet/minecraft/class_5321;named CHATLnet/minecraft/network/message/MessageType;CHAT:Lnet/minecraft/util/registry/RegistryKey;
-
SAY_COMMAND
The registry key for the say command message type, used by /say. The message content is decorated using thechat.type.announcementtext.- Mappings:
Namespace Name Mixin selector official dLri;d:Laai;intermediary field_39228Lnet/minecraft/class_2556;field_39228:Lnet/minecraft/class_5321;named SAY_COMMANDLnet/minecraft/network/message/MessageType;SAY_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
-
MSG_COMMAND
The registry key for the message command message type, used by /msg. The message content is decorated using thecommands.message.display.incomingtext, and the text is italicized and colored gray.- Mappings:
Namespace Name Mixin selector official eLri;e:Laai;intermediary field_39229Lnet/minecraft/class_2556;field_39229:Lnet/minecraft/class_5321;named MSG_COMMANDLnet/minecraft/network/message/MessageType;MSG_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
-
TEAM_MSG_COMMAND
The registry key for the team message command message type, used by /teammsg. The message content is decorated using thechat.type.team.texttext.- Mappings:
Namespace Name Mixin selector official fLri;f:Laai;intermediary field_39230Lnet/minecraft/class_2556;field_39230:Lnet/minecraft/class_5321;named TEAM_MSG_COMMANDLnet/minecraft/network/message/MessageType;TEAM_MSG_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
-
EMOTE_COMMAND
The registry key for the emote command message type, used by /me. The message content is decorated using thechat.type.emotetext.- Mappings:
Namespace Name Mixin selector official gLri;g:Laai;intermediary field_39231Lnet/minecraft/class_2556;field_39231:Lnet/minecraft/class_5321;named EMOTE_COMMANDLnet/minecraft/network/message/MessageType;EMOTE_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
-
-
Constructor Details
-
MessageType
-
-
Method Details
-
register
- Mappings:
Namespace Name Mixin selector official aLri;a(Ljava/lang/String;)Laai;intermediary method_43845Lnet/minecraft/class_2556;method_43845(Ljava/lang/String;)Lnet/minecraft/class_5321;named registerLnet/minecraft/network/message/MessageType;register(Ljava/lang/String;)Lnet/minecraft/util/registry/RegistryKey;
-
initialize
- Mappings:
Namespace Name Mixin selector official aLri;a(Lhm;)Lhc;intermediary method_43844Lnet/minecraft/class_2556;method_43844(Lnet/minecraft/class_2378;)Lnet/minecraft/class_6880;named initializeLnet/minecraft/network/message/MessageType;initialize(Lnet/minecraft/util/registry/Registry;)Lnet/minecraft/util/registry/RegistryEntry;
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
chat
Returns the value of thechatrecord component.- Returns:
- the value of the
chatrecord component
-
narration
Returns the value of thenarrationrecord component.- Returns:
- the value of the
narrationrecord component
-