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.
chat
controls the content displayed in the chat hud.overlay
controls the content displayed as the overlay (above the hotbar).narration
controls 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 rj
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
The display rule for the message type.static final record
The narration rule for the message type. -
Field Summary
Modifier and TypeFieldDescriptionprivate final Optional<MessageType.DisplayRule>
The field for thechat
record 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 thenarration
record component.private final Optional<MessageType.DisplayRule>
The field for theoverlay
record 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
ConstructorDescriptionMessageType
(Optional<MessageType.DisplayRule> optional, Optional<MessageType.DisplayRule> optional2, Optional<MessageType.NarrationRule> optional3) -
Method Summary
Modifier and TypeMethodDescriptionchat()
Returns the value of thechat
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static RegistryEntry<MessageType>
initialize
(Registry<MessageType> registry) Returns the value of thenarration
record component.overlay()
Returns the value of theoverlay
record component.private static RegistryKey<MessageType>
final String
toString()
Returns a string representation of this record class.
-
Field Details
-
chat
The field for thechat
record component. -
overlay
The field for theoverlay
record component. -
narration
The field for thenarration
record component. -
CODEC
- Mappings:
Namespace Name Mixin selector official a
Lrj;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
The registry key for the message type used bychat messages
. The message content is decorated using thechat.type.text
text.- Mappings:
Namespace Name Mixin selector official b
Lrj;b:Laai;
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
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 c
Lrj;c:Laai;
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
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 d
Lrj;d:Laai;
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
The registry key for the say command message type, used by /say. The message content is decorated using thechat.type.announcement
text.- Mappings:
Namespace Name Mixin selector official e
Lrj;e:Laai;
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
The registry key for the message command message type, used by /msg. The message content is decorated using thecommands.message.display.incoming
text, and the text is italicized and colored gray.- Mappings:
Namespace Name Mixin selector official f
Lrj;f:Laai;
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
The registry key for the team message command message type, used by /teammsg. The message content is decorated using thechat.type.team.text
text.- Mappings:
Namespace Name Mixin selector official g
Lrj;g:Laai;
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
The registry key for the emote command message type, used by /me. The message content is decorated using thechat.type.emote
text.- Mappings:
Namespace Name Mixin selector official h
Lrj;h:Laai;
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
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 i
Lrj;i:Laai;
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
-
MessageType
public MessageType(Optional<MessageType.DisplayRule> optional, Optional<MessageType.DisplayRule> optional2, Optional<MessageType.NarrationRule> optional3)
-
-
Method Details
-
register
- Mappings:
Namespace Name Mixin selector official a
Lrj;a(Ljava/lang/String;)Laai;
intermediary method_43845
Lnet/minecraft/class_2556;method_43845(Ljava/lang/String;)Lnet/minecraft/class_5321;
named register
Lnet/minecraft/network/MessageType;register(Ljava/lang/String;)Lnet/minecraft/util/registry/RegistryKey;
-
initialize
- Mappings:
Namespace Name Mixin selector official a
Lrj;a(Lhm;)Lhc;
intermediary method_43844
Lnet/minecraft/class_2556;method_43844(Lnet/minecraft/class_2378;)Lnet/minecraft/class_6880;
named initialize
Lnet/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 thechat
record component.- Returns:
- the value of the
chat
record component
-
overlay
Returns the value of theoverlay
record component.- Returns:
- the value of the
overlay
record component
-
narration
Returns the value of thenarration
record component.- Returns:
- the value of the
narration
record component
-