Package net.minecraft.text
Record Class Decoration
java.lang.Object
java.lang.Record
net.minecraft.text.Decoration
- Record Components:
translationKey-parameters-style-
public record Decoration(String translationKey, List<Decoration.Parameter> parameters, Style style)
extends Record
A decoration is a pre-defined set of styling and formatting rules for messages
sent by the server. This consists of the translation key, the style, and the parameters
usable in the translation. The actual text format needs to be supplied via custom
language files in resource packs.
- Mappings:
Namespace Name official stintermediary net/minecraft/class_7463named net/minecraft/text/Decorationofficial bintermediary comp_788named translationKeyofficial cintermediary comp_789named parametersofficial dintermediary comp_790named style
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents a parameter that the decoration uses. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Decoration>private final List<Decoration.Parameter>The field for theparametersrecord component.private final StyleThe field for thestylerecord component.private final StringThe field for thetranslationKeyrecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(Text content, MessageType.Parameters params) Returns the text obtained by applying the passed values to the decoration.private Text[]collectArguments(Text content, MessageType.Parameters params) Returns the arguments passed toText.translatable(String, Object[]).final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static DecorationReturns the decoration used in chat messages.static DecorationofIncomingMessage(String translationKey) Returns the decoration used in incoming messages sent withMessageCommand.static DecorationofOutgoingMessage(String translationKey) Returns the decoration used in outgoing messages sent withMessageCommand.static DecorationofTeamMessage(String translationKey) Returns the decoration used in chat messages.Returns the value of theparametersrecord component.style()Returns the value of thestylerecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetranslationKeyrecord component.
-
Field Details
-
translationKey
The field for thetranslationKeyrecord component. -
parameters
The field for theparametersrecord component. -
style
The field for thestylerecord component. -
CODEC
- Mappings:
Namespace Name Mixin selector official aLst;a:Lcom/mojang/serialization/Codec;intermediary field_39219Lnet/minecraft/class_7463;field_39219:Lcom/mojang/serialization/Codec;named CODECLnet/minecraft/text/Decoration;CODEC:Lcom/mojang/serialization/Codec;
-
-
Constructor Details
-
Decoration
-
-
Method Details
-
ofChat
Returns the decoration used in chat messages.- Returns:
- the decoration used in chat messages
- Implementation Note:
- This decoration allows using the sender and the content parameters. It has no style.
- Mappings:
Namespace Name Mixin selector official aLst;a(Ljava/lang/String;)Lst;intermediary method_43831Lnet/minecraft/class_7463;method_43831(Ljava/lang/String;)Lnet/minecraft/class_7463;named ofChatLnet/minecraft/text/Decoration;ofChat(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
-
ofIncomingMessage
Returns the decoration used in incoming messages sent withMessageCommand.- Returns:
- the decoration used in incoming messages sent with
MessageCommand - Implementation Note:
- This decoration allows using the sender and the content parameters. It is italicized and colored gray.
- Mappings:
Namespace Name Mixin selector official bLst;b(Ljava/lang/String;)Lst;intermediary method_44779Lnet/minecraft/class_7463;method_44779(Ljava/lang/String;)Lnet/minecraft/class_7463;named ofIncomingMessageLnet/minecraft/text/Decoration;ofIncomingMessage(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
-
ofOutgoingMessage
Returns the decoration used in outgoing messages sent withMessageCommand.- Returns:
- the decoration used in outgoing messages sent with
MessageCommand - Implementation Note:
- This decoration allows using the target (recipient) and the content parameters. It is italicized and colored gray.
- Mappings:
Namespace Name Mixin selector official cLst;c(Ljava/lang/String;)Lst;intermediary method_44780Lnet/minecraft/class_7463;method_44780(Ljava/lang/String;)Lnet/minecraft/class_7463;named ofOutgoingMessageLnet/minecraft/text/Decoration;ofOutgoingMessage(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
-
ofTeamMessage
Returns the decoration used in chat messages.- Returns:
- the decoration used in chat messages
- Implementation Note:
- This decoration allows using the target (team name), the sender, and the content parameters. It has no style.
- Mappings:
Namespace Name Mixin selector official dLst;d(Ljava/lang/String;)Lst;intermediary method_43835Lnet/minecraft/class_7463;method_43835(Ljava/lang/String;)Lnet/minecraft/class_7463;named ofTeamMessageLnet/minecraft/text/Decoration;ofTeamMessage(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
-
apply
Returns the text obtained by applying the passed values to the decoration.- Parameters:
content- the value of the content parameter- Returns:
- the text obtained by applying the passed values to the decoration
- Mappings:
Namespace Name Mixin selector official aLst;a(Lsw;Lss$a;)Lsw;intermediary method_43832Lnet/minecraft/class_7463;method_43832(Lnet/minecraft/class_2561;Lnet/minecraft/class_2556$class_7602;)Lnet/minecraft/class_2561;named applyLnet/minecraft/text/Decoration;apply(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageType$Parameters;)Lnet/minecraft/text/Text;
-
collectArguments
Returns the arguments passed toText.translatable(String, Object[]).This is collected by supplying
contentandsenderto the parameters'Decoration.Parameter.apply(net.minecraft.text.Text, net.minecraft.network.message.MessageType.Parameters)method.- Returns:
- the arguments passed to
Text.translatable(String, Object[]) - Mappings:
Namespace Name Mixin selector official bLst;b(Lsw;Lss$a;)[Lsw;intermediary method_43834Lnet/minecraft/class_7463;method_43834(Lnet/minecraft/class_2561;Lnet/minecraft/class_2556$class_7602;)[Lnet/minecraft/class_2561;named collectArgumentsLnet/minecraft/text/Decoration;collectArguments(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageType$Parameters;)[Lnet/minecraft/text/Text;
-
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). -
translationKey
Returns the value of thetranslationKeyrecord component.- Returns:
- the value of the
translationKeyrecord component
-
parameters
Returns the value of theparametersrecord component.- Returns:
- the value of the
parametersrecord component
-
style
Returns the value of thestylerecord component.- Returns:
- the value of the
stylerecord component
-