Enum Class Formatting

java.lang.Object
java.lang.Enum<Formatting>
net.minecraft.util.Formatting
All Implemented Interfaces:
Serializable, Comparable<Formatting>, Constable, StringIdentifiable

public enum Formatting extends Enum<Formatting> implements StringIdentifiable
An enum holding formattings.

There are two types of formattings, color and modifier. Color formattings are associated with a specific color, while modifier formattings modify the style, such as by bolding the text. RESET is a special formatting and is not classified as either of these two.

Mappings:
Namespace Name
named net/minecraft/util/Formatting
intermediary net/minecraft/class_124
official n
  • Enum Constant Details

    • BLACK

      public static final Formatting BLACK
      Mappings:
      Namespace Name Mixin selector
      named BLACK Lnet/minecraft/util/Formatting;BLACK:Lnet/minecraft/util/Formatting;
      intermediary field_1074 Lnet/minecraft/class_124;field_1074:Lnet/minecraft/class_124;
      official a Ln;a:Ln;
    • DARK_BLUE

      public static final Formatting DARK_BLUE
      Mappings:
      Namespace Name Mixin selector
      named DARK_BLUE Lnet/minecraft/util/Formatting;DARK_BLUE:Lnet/minecraft/util/Formatting;
      intermediary field_1058 Lnet/minecraft/class_124;field_1058:Lnet/minecraft/class_124;
      official b Ln;b:Ln;
    • DARK_GREEN

      public static final Formatting DARK_GREEN
      Mappings:
      Namespace Name Mixin selector
      named DARK_GREEN Lnet/minecraft/util/Formatting;DARK_GREEN:Lnet/minecraft/util/Formatting;
      intermediary field_1077 Lnet/minecraft/class_124;field_1077:Lnet/minecraft/class_124;
      official c Ln;c:Ln;
    • DARK_AQUA

      public static final Formatting DARK_AQUA
      Mappings:
      Namespace Name Mixin selector
      named DARK_AQUA Lnet/minecraft/util/Formatting;DARK_AQUA:Lnet/minecraft/util/Formatting;
      intermediary field_1062 Lnet/minecraft/class_124;field_1062:Lnet/minecraft/class_124;
      official d Ln;d:Ln;
    • DARK_RED

      public static final Formatting DARK_RED
      Mappings:
      Namespace Name Mixin selector
      named DARK_RED Lnet/minecraft/util/Formatting;DARK_RED:Lnet/minecraft/util/Formatting;
      intermediary field_1079 Lnet/minecraft/class_124;field_1079:Lnet/minecraft/class_124;
      official e Ln;e:Ln;
    • DARK_PURPLE

      public static final Formatting DARK_PURPLE
      Mappings:
      Namespace Name Mixin selector
      named DARK_PURPLE Lnet/minecraft/util/Formatting;DARK_PURPLE:Lnet/minecraft/util/Formatting;
      intermediary field_1064 Lnet/minecraft/class_124;field_1064:Lnet/minecraft/class_124;
      official f Ln;f:Ln;
    • GOLD

      public static final Formatting GOLD
      Mappings:
      Namespace Name Mixin selector
      named GOLD Lnet/minecraft/util/Formatting;GOLD:Lnet/minecraft/util/Formatting;
      intermediary field_1065 Lnet/minecraft/class_124;field_1065:Lnet/minecraft/class_124;
      official g Ln;g:Ln;
    • GRAY

      public static final Formatting GRAY
      Mappings:
      Namespace Name Mixin selector
      named GRAY Lnet/minecraft/util/Formatting;GRAY:Lnet/minecraft/util/Formatting;
      intermediary field_1080 Lnet/minecraft/class_124;field_1080:Lnet/minecraft/class_124;
      official h Ln;h:Ln;
    • DARK_GRAY

      public static final Formatting DARK_GRAY
      Mappings:
      Namespace Name Mixin selector
      named DARK_GRAY Lnet/minecraft/util/Formatting;DARK_GRAY:Lnet/minecraft/util/Formatting;
      intermediary field_1063 Lnet/minecraft/class_124;field_1063:Lnet/minecraft/class_124;
      official i Ln;i:Ln;
    • BLUE

      public static final Formatting BLUE
      Mappings:
      Namespace Name Mixin selector
      named BLUE Lnet/minecraft/util/Formatting;BLUE:Lnet/minecraft/util/Formatting;
      intermediary field_1078 Lnet/minecraft/class_124;field_1078:Lnet/minecraft/class_124;
      official j Ln;j:Ln;
    • GREEN

      public static final Formatting GREEN
      Mappings:
      Namespace Name Mixin selector
      named GREEN Lnet/minecraft/util/Formatting;GREEN:Lnet/minecraft/util/Formatting;
      intermediary field_1060 Lnet/minecraft/class_124;field_1060:Lnet/minecraft/class_124;
      official k Ln;k:Ln;
    • AQUA

      public static final Formatting AQUA
      Mappings:
      Namespace Name Mixin selector
      named AQUA Lnet/minecraft/util/Formatting;AQUA:Lnet/minecraft/util/Formatting;
      intermediary field_1075 Lnet/minecraft/class_124;field_1075:Lnet/minecraft/class_124;
      official l Ln;l:Ln;
    • RED

      public static final Formatting RED
      Mappings:
      Namespace Name Mixin selector
      named RED Lnet/minecraft/util/Formatting;RED:Lnet/minecraft/util/Formatting;
      intermediary field_1061 Lnet/minecraft/class_124;field_1061:Lnet/minecraft/class_124;
      official m Ln;m:Ln;
    • LIGHT_PURPLE

      public static final Formatting LIGHT_PURPLE
      Mappings:
      Namespace Name Mixin selector
      named LIGHT_PURPLE Lnet/minecraft/util/Formatting;LIGHT_PURPLE:Lnet/minecraft/util/Formatting;
      intermediary field_1076 Lnet/minecraft/class_124;field_1076:Lnet/minecraft/class_124;
      official n Ln;n:Ln;
    • YELLOW

      public static final Formatting YELLOW
      Mappings:
      Namespace Name Mixin selector
      named YELLOW Lnet/minecraft/util/Formatting;YELLOW:Lnet/minecraft/util/Formatting;
      intermediary field_1054 Lnet/minecraft/class_124;field_1054:Lnet/minecraft/class_124;
      official o Ln;o:Ln;
    • WHITE

      public static final Formatting WHITE
      Mappings:
      Namespace Name Mixin selector
      named WHITE Lnet/minecraft/util/Formatting;WHITE:Lnet/minecraft/util/Formatting;
      intermediary field_1068 Lnet/minecraft/class_124;field_1068:Lnet/minecraft/class_124;
      official p Ln;p:Ln;
    • OBFUSCATED

      public static final Formatting OBFUSCATED
      Mappings:
      Namespace Name Mixin selector
      named OBFUSCATED Lnet/minecraft/util/Formatting;OBFUSCATED:Lnet/minecraft/util/Formatting;
      intermediary field_1051 Lnet/minecraft/class_124;field_1051:Lnet/minecraft/class_124;
      official q Ln;q:Ln;
    • BOLD

      public static final Formatting BOLD
      Mappings:
      Namespace Name Mixin selector
      named BOLD Lnet/minecraft/util/Formatting;BOLD:Lnet/minecraft/util/Formatting;
      intermediary field_1067 Lnet/minecraft/class_124;field_1067:Lnet/minecraft/class_124;
      official r Ln;r:Ln;
    • STRIKETHROUGH

      public static final Formatting STRIKETHROUGH
      Mappings:
      Namespace Name Mixin selector
      named STRIKETHROUGH Lnet/minecraft/util/Formatting;STRIKETHROUGH:Lnet/minecraft/util/Formatting;
      intermediary field_1055 Lnet/minecraft/class_124;field_1055:Lnet/minecraft/class_124;
      official s Ln;s:Ln;
    • UNDERLINE

      public static final Formatting UNDERLINE
      Mappings:
      Namespace Name Mixin selector
      named UNDERLINE Lnet/minecraft/util/Formatting;UNDERLINE:Lnet/minecraft/util/Formatting;
      intermediary field_1073 Lnet/minecraft/class_124;field_1073:Lnet/minecraft/class_124;
      official t Ln;t:Ln;
    • ITALIC

      public static final Formatting ITALIC
      Mappings:
      Namespace Name Mixin selector
      named ITALIC Lnet/minecraft/util/Formatting;ITALIC:Lnet/minecraft/util/Formatting;
      intermediary field_1056 Lnet/minecraft/class_124;field_1056:Lnet/minecraft/class_124;
      official u Ln;u:Ln;
    • RESET

      public static final Formatting RESET
      Mappings:
      Namespace Name Mixin selector
      named RESET Lnet/minecraft/util/Formatting;RESET:Lnet/minecraft/util/Formatting;
      intermediary field_1070 Lnet/minecraft/class_124;field_1070:Lnet/minecraft/class_124;
      official v Ln;v:Ln;
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<Formatting> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/util/Formatting;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_39218 Lnet/minecraft/class_124;field_39218:Lcom/mojang/serialization/Codec;
      official w Ln;w:Lcom/mojang/serialization/Codec;
    • FORMATTING_CODE_PREFIX

      public static final char FORMATTING_CODE_PREFIX
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named FORMATTING_CODE_PREFIX Lnet/minecraft/util/Formatting;FORMATTING_CODE_PREFIX:C
      intermediary field_33292 Lnet/minecraft/class_124;field_33292:C
      official x Ln;x:C
    • BY_NAME

      private static final Map<String,Formatting> BY_NAME
      Mappings:
      Namespace Name Mixin selector
      named BY_NAME Lnet/minecraft/util/Formatting;BY_NAME:Ljava/util/Map;
      intermediary field_1052 Lnet/minecraft/class_124;field_1052:Ljava/util/Map;
      official y Ln;y:Ljava/util/Map;
    • FORMATTING_CODE_PATTERN

      private static final Pattern FORMATTING_CODE_PATTERN
      Mappings:
      Namespace Name Mixin selector
      named FORMATTING_CODE_PATTERN Lnet/minecraft/util/Formatting;FORMATTING_CODE_PATTERN:Ljava/util/regex/Pattern;
      intermediary field_1066 Lnet/minecraft/class_124;field_1066:Ljava/util/regex/Pattern;
      official z Ln;z:Ljava/util/regex/Pattern;
    • name

      private final String name
      Mappings:
      Namespace Name Mixin selector
      named name Lnet/minecraft/util/Formatting;name:Ljava/lang/String;
      intermediary field_1057 Lnet/minecraft/class_124;field_1057:Ljava/lang/String;
      official A Ln;A:Ljava/lang/String;
    • code

      private final char code
      Mappings:
      Namespace Name Mixin selector
      named code Lnet/minecraft/util/Formatting;code:C
      intermediary field_1059 Lnet/minecraft/class_124;field_1059:C
      official B Ln;B:C
    • modifier

      private final boolean modifier
      Mappings:
      Namespace Name Mixin selector
      named modifier Lnet/minecraft/util/Formatting;modifier:Z
      intermediary field_1081 Lnet/minecraft/class_124;field_1081:Z
      official C Ln;C:Z
    • stringValue

      private final String stringValue
      Mappings:
      Namespace Name Mixin selector
      named stringValue Lnet/minecraft/util/Formatting;stringValue:Ljava/lang/String;
      intermediary field_1069 Lnet/minecraft/class_124;field_1069:Ljava/lang/String;
      official D Ln;D:Ljava/lang/String;
    • colorIndex

      private final int colorIndex
      Mappings:
      Namespace Name Mixin selector
      named colorIndex Lnet/minecraft/util/Formatting;colorIndex:I
      intermediary field_1071 Lnet/minecraft/class_124;field_1071:I
      official E Ln;E:I
    • colorValue

      @Nullable private final @Nullable Integer colorValue
      Mappings:
      Namespace Name Mixin selector
      named colorValue Lnet/minecraft/util/Formatting;colorValue:Ljava/lang/Integer;
      intermediary field_1053 Lnet/minecraft/class_124;field_1053:Ljava/lang/Integer;
      official F Ln;F:Ljava/lang/Integer;
  • Constructor Details

    • Formatting

      private Formatting(String name, char code, int colorIndex, @Nullable @Nullable Integer colorValue)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/util/Formatting;<init>(Ljava/lang/String;ILjava/lang/String;CILjava/lang/Integer;)V
      intermediary <init> Lnet/minecraft/class_124;<init>(Ljava/lang/String;ILjava/lang/String;CILjava/lang/Integer;)V
      official <init> Ln;<init>(Ljava/lang/String;ILjava/lang/String;CILjava/lang/Integer;)V
    • Formatting

      private Formatting(String name, char code, boolean modifier)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/util/Formatting;<init>(Ljava/lang/String;ILjava/lang/String;CZ)V
      intermediary <init> Lnet/minecraft/class_124;<init>(Ljava/lang/String;ILjava/lang/String;CZ)V
      official <init> Ln;<init>(Ljava/lang/String;ILjava/lang/String;CZ)V
    • Formatting

      private Formatting(String name, char code, boolean modifier, int colorIndex, @Nullable @Nullable Integer colorValue)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/util/Formatting;<init>(Ljava/lang/String;ILjava/lang/String;CZILjava/lang/Integer;)V
      intermediary <init> Lnet/minecraft/class_124;<init>(Ljava/lang/String;ILjava/lang/String;CZILjava/lang/Integer;)V
      official <init> Ln;<init>(Ljava/lang/String;ILjava/lang/String;CZILjava/lang/Integer;)V
  • Method Details

    • values

      public static Formatting[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Formatting valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • sanitize

      private static String sanitize(String name)
      Mappings:
      Namespace Name Mixin selector
      named sanitize Lnet/minecraft/util/Formatting;sanitize(Ljava/lang/String;)Ljava/lang/String;
      intermediary method_535 Lnet/minecraft/class_124;method_535(Ljava/lang/String;)Ljava/lang/String;
      official c Ln;c(Ljava/lang/String;)Ljava/lang/String;
    • getCode

      public char getCode()
      Returns the code to be placed after the '\u00a7' when this format is converted to a string.
      Returns:
      the code to be placed after the '\u00a7' when this format is converted to a string
      Mappings:
      Namespace Name Mixin selector
      named getCode Lnet/minecraft/util/Formatting;getCode()C
      intermediary method_36145 Lnet/minecraft/class_124;method_36145()C
      official a Ln;a()C
    • getColorIndex

      public int getColorIndex()
      Returns the color index for the formatting, or -1 to indicate no color.
      Returns:
      the color index for the formatting, or -1 to indicate no color
      API Note:
      This is also used to calculate scoreboard team display slot IDs.
      Mappings:
      Namespace Name Mixin selector
      named getColorIndex Lnet/minecraft/util/Formatting;getColorIndex()I
      intermediary method_536 Lnet/minecraft/class_124;method_536()I
      official b Ln;b()I
    • isModifier

      public boolean isModifier()
      Returns true if the formatting is a modifier, false otherwise.
      Returns:
      true if the formatting is a modifier, false otherwise
      Mappings:
      Namespace Name Mixin selector
      named isModifier Lnet/minecraft/util/Formatting;isModifier()Z
      intermediary method_542 Lnet/minecraft/class_124;method_542()Z
      official d Ln;d()Z
    • isColor

      public boolean isColor()
      Returns true if the formatting is associated with a color, false otherwise.
      Returns:
      true if the formatting is associated with a color, false otherwise
      Mappings:
      Namespace Name Mixin selector
      named isColor Lnet/minecraft/util/Formatting;isColor()Z
      intermediary method_543 Lnet/minecraft/class_124;method_543()Z
      official e Ln;e()Z
    • getColorValue

      @Nullable public @Nullable Integer getColorValue()
      Returns the color of the formatted text, or null if the formatting has no associated color.
      Returns:
      the color of the formatted text, or null if the formatting has no associated color
      Mappings:
      Namespace Name Mixin selector
      named getColorValue Lnet/minecraft/util/Formatting;getColorValue()Ljava/lang/Integer;
      intermediary method_532 Lnet/minecraft/class_124;method_532()Ljava/lang/Integer;
      official f Ln;f()Ljava/lang/Integer;
    • getName

      public String getName()
      Returns the name of the formatting.
      Returns:
      the name of the formatting
      Mappings:
      Namespace Name Mixin selector
      named getName Lnet/minecraft/util/Formatting;getName()Ljava/lang/String;
      intermediary method_537 Lnet/minecraft/class_124;method_537()Ljava/lang/String;
      official g Ln;g()Ljava/lang/String;
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Formatting>
    • strip

      @Nullable public static @Nullable String strip(@Nullable @Nullable String string)
      Returns the text with all formatting codes removed.
      Returns:
      the text with all formatting codes removed
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named strip Lnet/minecraft/util/Formatting;strip(Ljava/lang/String;)Ljava/lang/String;
      intermediary method_539 Lnet/minecraft/class_124;method_539(Ljava/lang/String;)Ljava/lang/String;
      official a Ln;a(Ljava/lang/String;)Ljava/lang/String;
    • byName

      @Nullable public static @Nullable Formatting byName(@Nullable @Nullable String name)
      Returns the formatting with the name name, or null if there is none.
      Returns:
      the formatting with the name name, or null if there is none
      Mappings:
      Namespace Name Mixin selector
      named byName Lnet/minecraft/util/Formatting;byName(Ljava/lang/String;)Lnet/minecraft/util/Formatting;
      intermediary method_533 Lnet/minecraft/class_124;method_533(Ljava/lang/String;)Lnet/minecraft/class_124;
      official b Ln;b(Ljava/lang/String;)Ln;
    • byColorIndex

      @Nullable public static @Nullable Formatting byColorIndex(int colorIndex)
      Returns the formatting with the color index colorIndex, or null if there is none.
      Returns:
      the formatting with the color index colorIndex, or null if there is none
      Mappings:
      Namespace Name Mixin selector
      named byColorIndex Lnet/minecraft/util/Formatting;byColorIndex(I)Lnet/minecraft/util/Formatting;
      intermediary method_534 Lnet/minecraft/class_124;method_534(I)Lnet/minecraft/class_124;
      official a Ln;a(I)Ln;
    • byCode

      @Nullable public static @Nullable Formatting byCode(char code)
      Returns the formatting with the code code, or null if there is none.
      Returns:
      the formatting with the code code, or null if there is none
      Mappings:
      Namespace Name Mixin selector
      named byCode Lnet/minecraft/util/Formatting;byCode(C)Lnet/minecraft/util/Formatting;
      intermediary method_544 Lnet/minecraft/class_124;method_544(C)Lnet/minecraft/class_124;
      official a Ln;a(C)Ln;
    • getNames

      public static Collection<String> getNames(boolean colors, boolean modifiers)
      Returns the list of formattings matching the given condition.
      Parameters:
      colors - whether or not to include color formattings
      modifiers - whether or not to include modifier formattings
      Returns:
      the list of formattings matching the given condition
      Mappings:
      Namespace Name Mixin selector
      named getNames Lnet/minecraft/util/Formatting;getNames(ZZ)Ljava/util/Collection;
      intermediary method_540 Lnet/minecraft/class_124;method_540(ZZ)Ljava/util/Collection;
      official a Ln;a(ZZ)Ljava/util/Collection;
    • asString

      public String asString()
      Returns the unique string representation of the enum, used for serialization.
      Specified by:
      asString in interface StringIdentifiable
      Returns:
      the unique string representation of the enum, used for serialization
      Mappings:
      Namespace Name Mixin selector
      named asString Lnet/minecraft/util/StringIdentifiable;asString()Ljava/lang/String;
      intermediary method_15434 Lnet/minecraft/class_3542;method_15434()Ljava/lang/String;
      official c Lazu;c()Ljava/lang/String;