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
named net/minecraft/text/Decoration
intermediary net/minecraft/class_7463
official ww
named translationKey
intermediary comp_788
official c
named parameters
intermediary comp_789
official d
named style
intermediary comp_790
official e
  • Field Details

    • translationKey

      private final String translationKey
      The field for the translationKey record component.
    • parameters

      private final List<Decoration.Parameter> parameters
      The field for the parameters record component.
    • style

      private final Style style
      The field for the style record component.
    • CODEC

      public static final com.mojang.serialization.Codec<Decoration> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/text/Decoration;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_39219 Lnet/minecraft/class_7463;field_39219:Lcom/mojang/serialization/Codec;
      official a Lww;a:Lcom/mojang/serialization/Codec;
    • PACKET_CODEC

      public static final PacketCodec<RegistryByteBuf,Decoration> PACKET_CODEC
      Mappings:
      Namespace Name Mixin selector
      named PACKET_CODEC Lnet/minecraft/text/Decoration;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
      intermediary field_51971 Lnet/minecraft/class_7463;field_51971:Lnet/minecraft/class_9139;
      official b Lww;b:Lyx;
  • Constructor Details

  • Method Details

    • ofChat

      public static Decoration ofChat(String translationKey)
      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
      named ofChat Lnet/minecraft/text/Decoration;ofChat(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
      intermediary method_43831 Lnet/minecraft/class_7463;method_43831(Ljava/lang/String;)Lnet/minecraft/class_7463;
      official a Lww;a(Ljava/lang/String;)Lww;
    • ofIncomingMessage

      public static Decoration ofIncomingMessage(String translationKey)
      Returns the decoration used in incoming messages sent with MessageCommand.
      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
      named ofIncomingMessage Lnet/minecraft/text/Decoration;ofIncomingMessage(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
      intermediary method_44779 Lnet/minecraft/class_7463;method_44779(Ljava/lang/String;)Lnet/minecraft/class_7463;
      official b Lww;b(Ljava/lang/String;)Lww;
    • ofOutgoingMessage

      public static Decoration ofOutgoingMessage(String translationKey)
      Returns the decoration used in outgoing messages sent with MessageCommand.
      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
      named ofOutgoingMessage Lnet/minecraft/text/Decoration;ofOutgoingMessage(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
      intermediary method_44780 Lnet/minecraft/class_7463;method_44780(Ljava/lang/String;)Lnet/minecraft/class_7463;
      official c Lww;c(Ljava/lang/String;)Lww;
    • ofTeamMessage

      public static Decoration ofTeamMessage(String translationKey)
      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
      named ofTeamMessage Lnet/minecraft/text/Decoration;ofTeamMessage(Ljava/lang/String;)Lnet/minecraft/text/Decoration;
      intermediary method_43835 Lnet/minecraft/class_7463;method_43835(Ljava/lang/String;)Lnet/minecraft/class_7463;
      official d Lww;d(Ljava/lang/String;)Lww;
    • apply

      public Text apply(Text content, MessageType.Parameters params)
      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
      named apply Lnet/minecraft/text/Decoration;apply(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageType$Parameters;)Lnet/minecraft/text/Text;
      intermediary method_43832 Lnet/minecraft/class_7463;method_43832(Lnet/minecraft/class_2561;Lnet/minecraft/class_2556$class_7602;)Lnet/minecraft/class_2561;
      official a Lww;a(Lwz;Lwv$a;)Lwz;
    • collectArguments

      private Text[] collectArguments(Text content, MessageType.Parameters params)
      Returns the arguments passed to Text.translatable(String, Object[]).

      This is collected by supplying content and sender to 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
      named collectArguments Lnet/minecraft/text/Decoration;collectArguments(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageType$Parameters;)[Lnet/minecraft/text/Text;
      intermediary method_43834 Lnet/minecraft/class_7463;method_43834(Lnet/minecraft/class_2561;Lnet/minecraft/class_2556$class_7602;)[Lnet/minecraft/class_2561;
      official b Lww;b(Lwz;Lwv$a;)[Lwz;
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object object)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • translationKey

      public String translationKey()
      Returns the value of the translationKey record component.
      Returns:
      the value of the translationKey record component
    • parameters

      public List<Decoration.Parameter> parameters()
      Returns the value of the parameters record component.
      Returns:
      the value of the parameters record component
    • style

      public Style style()
      Returns the value of the style record component.
      Returns:
      the value of the style record component