Package net.minecraft

Enum Class ChatFormatting

java.lang.Object
java.lang.Enum<ChatFormatting>
net.minecraft.ChatFormatting
All Implemented Interfaces:
Serializable, Comparable<ChatFormatting>, Constable, StringRepresentable

public enum ChatFormatting extends Enum<ChatFormatting> implements StringRepresentable
  • Enum Constant Details

  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<ChatFormatting> CODEC
    • PREFIX_CODE

      public static final char PREFIX_CODE
      See Also:
    • FORMATTING_BY_NAME

      private static final Map<String,ChatFormatting> FORMATTING_BY_NAME
    • STRIP_FORMATTING_PATTERN

      private static final Pattern STRIP_FORMATTING_PATTERN
    • name

      private final String name
      The name of this color/formatting
    • code

      private final char code
    • isFormat

      private final boolean isFormat
    • toString

      private final String toString
    • id

      private final int id
      The numerical index that represents this color
    • color

      @Nullable private final Integer color
  • Constructor Details

    • ChatFormatting

      private ChatFormatting(String name, char code, int id, @Nullable Integer color)
    • ChatFormatting

      private ChatFormatting(String name, char code, boolean isFormat)
    • ChatFormatting

      private ChatFormatting(String name, char code, boolean isFormat, int id, @Nullable Integer color)
  • Method Details

    • values

      public static ChatFormatting[] 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 ChatFormatting 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
    • cleanName

      private static String cleanName(String string)
    • getChar

      public char getChar()
    • getId

      public int getId()
    • isFormat

      public boolean isFormat()
    • isColor

      public boolean isColor()
    • getColor

      @Nullable public Integer getColor()
    • getName

      public String getName()
    • toString

      public String toString()
      Overrides:
      toString in class Enum<ChatFormatting>
    • stripFormatting

      @Nullable @Contract("!null->!null;_->_") public static String stripFormatting(@Nullable String text)
      Returns a copy of the given string, with formatting codes stripped away.
    • getByName

      @Nullable public static ChatFormatting getByName(@Nullable String friendlyName)
      Gets a value by its friendly name null if the given name does not map to a defined value.
    • getById

      @Nullable public static ChatFormatting getById(int index)
      Get a TextFormatting from its color index
    • getByCode

      @Nullable public static ChatFormatting getByCode(char formattingCode)
    • getNames

      public static Collection<String> getNames(boolean getColor, boolean getFancyStyling)
      Gets all the valid values.
    • getSerializedName

      public String getSerializedName()
      Specified by:
      getSerializedName in interface StringRepresentable