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 rf
intermediary net/minecraft/class_7463
named net/minecraft/text/Decoration
official b
intermediary comp_788
named translationKey
official c
intermediary comp_789
named parameters
official d
intermediary comp_790
named style
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents a parameter that the decoration uses. -
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Decoration>
private final List<Decoration.Parameter>
The field for theparameters
record component.private final Style
The field for thestyle
record component.private final String
The field for thetranslationKey
record component. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapply
(Text content, @Nullable MessageSender sender) Returns the text obtained by applying the passed values to the decoration.private Text[]
collectArguments
(Text content, @Nullable MessageSender sender) Returns the arguments passed toText.translatable(String, Object[])
.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static Decoration
Returns the decoration used in chat messages.static Decoration
ofDirectMessage
(String translationKey) Returns the decoration used inMessageCommand
.static Decoration
ofTeamMessage
(String translationKey) Returns the decoration used in chat messages.Returns the value of theparameters
record component.style()
Returns the value of thestyle
record component.final String
toString()
Returns a string representation of this record class.Returns the value of thetranslationKey
record component.
-
Field Details
-
translationKey
The field for thetranslationKey
record component. -
parameters
The field for theparameters
record component. -
style
The field for thestyle
record component. -
CODEC
- Mappings:
Namespace Name Mixin selector official a
Lrf;a:Lcom/mojang/serialization/Codec;
intermediary field_39219
Lnet/minecraft/class_7463;field_39219:Lcom/mojang/serialization/Codec;
named CODEC
Lnet/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 use of the sender and the content parameters. It has no style.
- Mappings:
Namespace Name Mixin selector official a
Lrf;a(Ljava/lang/String;)Lrf;
intermediary method_43831
Lnet/minecraft/class_7463;method_43831(Ljava/lang/String;)Lnet/minecraft/class_7463;
named ofChat
Lnet/minecraft/text/Decoration;ofChat(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
-
ofDirectMessage
Returns the decoration used inMessageCommand
.- Returns:
- the decoration used in
MessageCommand
- Implementation Note:
- This decoration allows use of the sender and the content parameters. The text is colored gray and is displayed in italic.
- Mappings:
Namespace Name Mixin selector official b
Lrf;b(Ljava/lang/String;)Lrf;
intermediary method_43833
Lnet/minecraft/class_7463;method_43833(Ljava/lang/String;)Lnet/minecraft/class_7463;
named ofDirectMessage
Lnet/minecraft/text/Decoration;ofDirectMessage(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 use of the team name, the sender, and the content parameters. It has no style.
- Mappings:
Namespace Name Mixin selector official c
Lrf;c(Ljava/lang/String;)Lrf;
intermediary method_43835
Lnet/minecraft/class_7463;method_43835(Ljava/lang/String;)Lnet/minecraft/class_7463;
named ofTeamMessage
Lnet/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 parametersender
- the sender passed to parameters, ornull
if inapplicable- Returns:
- the text obtained by applying the passed values to the decoration
- Mappings:
Namespace Name Mixin selector official a
Lrf;a(Lrm;Lri;)Lrm;
intermediary method_43832
Lnet/minecraft/class_7463;method_43832(Lnet/minecraft/class_2561;Lnet/minecraft/class_7436;)Lnet/minecraft/class_2561;
named apply
Lnet/minecraft/text/Decoration;apply(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSender;)Lnet/minecraft/text/Text;
-
collectArguments
Returns the arguments passed toText.translatable(String, Object[])
.This is collected by supplying
content
andsender
to the parameters'Decoration.Parameter.apply(net.minecraft.text.Text, net.minecraft.network.message.MessageSender)
method.- Returns:
- the arguments passed to
Text.translatable(String, Object[])
- Mappings:
Namespace Name Mixin selector official b
Lrf;b(Lrm;Lri;)[Lrm;
intermediary method_43834
Lnet/minecraft/class_7463;method_43834(Lnet/minecraft/class_2561;Lnet/minecraft/class_7436;)[Lnet/minecraft/class_2561;
named collectArguments
Lnet/minecraft/text/Decoration;collectArguments(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSender;)[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 thetranslationKey
record component.- Returns:
- the value of the
translationKey
record component
-
parameters
Returns the value of theparameters
record component.- Returns:
- the value of the
parameters
record component
-
style
Returns the value of thestyle
record component.- Returns:
- the value of the
style
record component
-