Package net.minecraft.network
Record Class MessageType
java.lang.Object
java.lang.Record
net.minecraft.network.MessageType
- Record Components:
chat- the display rule for the content displayed in the chat hud, orOptional.empty()if it should not be displayed in the chat hudoverlay- the display rule for the content displayed as the overlay, orOptional.empty()if it should not be displayed as the overlaynarration- the narration rule for the content, orOptional.empty()if it should not be narrated
public record MessageType(Optional<MessageType.DisplayRule> chat, Optional<MessageType.DisplayRule> overlay, Optional<MessageType.NarrationRule> narration)
extends Record
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.overlaycontrols the content displayed as the overlay (above the hotbar).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 MessageType.DisplayRule
and MessageType.NarrationRule for details.
- See Also:
- Mappings:
Namespace Name official rjintermediary net/minecraft/class_2556named net/minecraft/network/MessageTypeofficial jintermediary comp_792named chatofficial kintermediary comp_793named overlayofficial lintermediary comp_794named narration
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe display rule for the message type.static final recordThe narration rule for the message type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Optional<MessageType.DisplayRule>The field for thechatrecord component.static final RegistryKey<MessageType>The registry key for the message type used bychat messages.static 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 game info message type.static final RegistryKey<MessageType>The registry key for the message command message type, used by /msg.private final Optional<MessageType.NarrationRule>The field for thenarrationrecord component.private final Optional<MessageType.DisplayRule>The field for theoverlayrecord 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 system message message type.static final RegistryKey<MessageType>The registry key for the team message command message type, used by /teammsg.static final RegistryKey<MessageType>The registry key for the tellraw command message type, used by /tellraw. -
Constructor Summary
ConstructorsConstructorDescriptionMessageType(Optional<MessageType.DisplayRule> optional, Optional<MessageType.DisplayRule> optional2, Optional<MessageType.NarrationRule> optional3) -
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.overlay()Returns the value of theoverlayrecord component.private static RegistryKey<MessageType>final StringtoString()Returns a string representation of this record class.
-
Field Details
-
chat
The field for thechatrecord component. -
overlay
The field for theoverlayrecord component. -
narration
The field for thenarrationrecord component. -
CODEC
- Mappings:
Namespace Name Mixin selector official aLrj;a:Lcom/mojang/serialization/Codec;intermediary field_39227Lnet/minecraft/class_2556;field_39227:Lcom/mojang/serialization/Codec;named CODECLnet/minecraft/network/MessageType;CODEC:Lcom/mojang/serialization/Codec;
-
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 bLrj;b:Laai;intermediary field_11737Lnet/minecraft/class_2556;field_11737:Lnet/minecraft/class_5321;named CHATLnet/minecraft/network/MessageType;CHAT:Lnet/minecraft/util/registry/RegistryKey;
-
SYSTEM
The registry key for the system message message type. This is also referred to as game messages. This message type does not have a decoration and its narrations will interrupt others.- API Note:
- System messages include join/leave messages, death messages, advancement messages, and other messages that are not sent by players.
- Mappings:
Namespace Name Mixin selector official cLrj;c:Laai;intermediary field_11735Lnet/minecraft/class_2556;field_11735:Lnet/minecraft/class_5321;named SYSTEMLnet/minecraft/network/MessageType;SYSTEM:Lnet/minecraft/util/registry/RegistryKey;
-
GAME_INFO
The registry key for the game info message type. This appears on the overlay only and is not narrated at all. This message type does not have a decoration.- API Note:
- This is most often seen when the player uses a bed.
- Mappings:
Namespace Name Mixin selector official dLrj;d:Laai;intermediary field_11733Lnet/minecraft/class_2556;field_11733:Lnet/minecraft/class_5321;named GAME_INFOLnet/minecraft/network/MessageType;GAME_INFO: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 eLrj;e:Laai;intermediary field_39228Lnet/minecraft/class_2556;field_39228:Lnet/minecraft/class_5321;named SAY_COMMANDLnet/minecraft/network/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 fLrj;f:Laai;intermediary field_39229Lnet/minecraft/class_2556;field_39229:Lnet/minecraft/class_5321;named MSG_COMMANDLnet/minecraft/network/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 gLrj;g:Laai;intermediary field_39230Lnet/minecraft/class_2556;field_39230:Lnet/minecraft/class_5321;named TEAM_MSG_COMMANDLnet/minecraft/network/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 hLrj;h:Laai;intermediary field_39231Lnet/minecraft/class_2556;field_39231:Lnet/minecraft/class_5321;named EMOTE_COMMANDLnet/minecraft/network/MessageType;EMOTE_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
-
TELLRAW_COMMAND
The registry key for the tellraw command message type, used by /tellraw. This message type does not have a decoration.- Mappings:
Namespace Name Mixin selector official iLrj;i:Laai;intermediary field_39232Lnet/minecraft/class_2556;field_39232:Lnet/minecraft/class_5321;named TELLRAW_COMMANDLnet/minecraft/network/MessageType;TELLRAW_COMMAND:Lnet/minecraft/util/registry/RegistryKey;
-
-
Constructor Details
-
MessageType
public MessageType(Optional<MessageType.DisplayRule> optional, Optional<MessageType.DisplayRule> optional2, Optional<MessageType.NarrationRule> optional3)
-
-
Method Details
-
register
- Mappings:
Namespace Name Mixin selector official aLrj;a(Ljava/lang/String;)Laai;intermediary method_43845Lnet/minecraft/class_2556;method_43845(Ljava/lang/String;)Lnet/minecraft/class_5321;named registerLnet/minecraft/network/MessageType;register(Ljava/lang/String;)Lnet/minecraft/util/registry/RegistryKey;
-
initialize
- Mappings:
Namespace Name Mixin selector official aLrj;a(Lhm;)Lhc;intermediary method_43844Lnet/minecraft/class_2556;method_43844(Lnet/minecraft/class_2378;)Lnet/minecraft/class_6880;named initializeLnet/minecraft/network/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
-
overlay
Returns the value of theoverlayrecord component.- Returns:
- the value of the
overlayrecord component
-
narration
Returns the value of thenarrationrecord component.- Returns:
- the value of the
narrationrecord component
-