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
    • COLOR_CODEC

      public static final com.mojang.serialization.Codec<ChatFormatting> COLOR_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

      private final @Nullable Integer color
  • Constructor Details

    • ChatFormatting

      private ChatFormatting(String pName, char pCode, int pId, @Nullable Integer pColor)
    • ChatFormatting

      private ChatFormatting(String pName, char pCode, boolean pIsFormat)
    • ChatFormatting

      private ChatFormatting(String pName, char pCode, boolean pIsFormat, int pId, @Nullable Integer pColor)
  • 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 pString)
    • getChar

      public char getChar()
    • getId

      public int getId()
    • isFormat

      public boolean isFormat()
    • isColor

      public boolean isColor()
    • getColor

      public @Nullable Integer getColor()
    • getName

      public String getName()
    • toString

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

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

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

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

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

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

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