Package net.minecraft.util
Enum Class Formatting
- All Implemented Interfaces:
Serializable,Comparable<Formatting>,Constable,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/Formattingintermediary net/minecraft/class_124official o
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>Nested classes/interfaces inherited from interface net.minecraft.util.StringIdentifiable
StringIdentifiable.BasicCodec<S extends StringIdentifiable>, StringIdentifiable.EnumCodec<E extends Enum<E> & StringIdentifiable> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map<String, Formatting> private final charstatic final com.mojang.serialization.Codec<Formatting> static final com.mojang.serialization.Codec<Formatting> private final intprivate static final Patternstatic final charprivate final booleanprivate final Stringprivate final StringFields inherited from interface net.minecraft.util.StringIdentifiable
CACHED_MAP_THRESHOLD -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateFormatting(String name, char code, boolean modifier) privateFormatting(String name, char code, boolean modifier, int colorIndex, @Nullable Integer colorValue) privateFormatting(String name, char code, int colorIndex, @Nullable Integer colorValue) -
Method Summary
Modifier and TypeMethodDescriptionasString()Returns the unique string representation of the enum, used for serialization.static @Nullable FormattingbyCode(char code) Returns the formatting with the codecode, ornullif there is none.static @Nullable FormattingbyColorIndex(int colorIndex) Returns the formatting with the color indexcolorIndex, ornullif there is none.static @Nullable FormattingReturns the formatting with the namename, ornullif there is none.chargetCode()Returns the code to be placed after the '\u00a7' when this format is converted to a string.intReturns the color index for the formatting, or-1to indicate no color.Returns the color of the formatted text, ornullif the formatting has no associated color.getName()Returns the name of the formatting.static Collection<String> getNames(boolean colors, boolean modifiers) Returns the list of formattings matching the given condition.booleanisColor()Returns true if the formatting is associated with a color, false otherwise.booleanReturns true if the formatting is a modifier, false otherwise.private static StringReturns thetextwith all formatting codes removed.toString()static FormattingReturns the enum constant of this class with the specified name.static Formatting[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BLACK
- Mappings:
Namespace Name Mixin selector named BLACKLnet/minecraft/util/Formatting;BLACK:Lnet/minecraft/util/Formatting;intermediary field_1074Lnet/minecraft/class_124;field_1074:Lnet/minecraft/class_124;official aLo;a:Lo;
-
DARK_BLUE
- Mappings:
Namespace Name Mixin selector named DARK_BLUELnet/minecraft/util/Formatting;DARK_BLUE:Lnet/minecraft/util/Formatting;intermediary field_1058Lnet/minecraft/class_124;field_1058:Lnet/minecraft/class_124;official bLo;b:Lo;
-
DARK_GREEN
- Mappings:
Namespace Name Mixin selector named DARK_GREENLnet/minecraft/util/Formatting;DARK_GREEN:Lnet/minecraft/util/Formatting;intermediary field_1077Lnet/minecraft/class_124;field_1077:Lnet/minecraft/class_124;official cLo;c:Lo;
-
DARK_AQUA
- Mappings:
Namespace Name Mixin selector named DARK_AQUALnet/minecraft/util/Formatting;DARK_AQUA:Lnet/minecraft/util/Formatting;intermediary field_1062Lnet/minecraft/class_124;field_1062:Lnet/minecraft/class_124;official dLo;d:Lo;
-
DARK_RED
- Mappings:
Namespace Name Mixin selector named DARK_REDLnet/minecraft/util/Formatting;DARK_RED:Lnet/minecraft/util/Formatting;intermediary field_1079Lnet/minecraft/class_124;field_1079:Lnet/minecraft/class_124;official eLo;e:Lo;
-
DARK_PURPLE
- Mappings:
Namespace Name Mixin selector named DARK_PURPLELnet/minecraft/util/Formatting;DARK_PURPLE:Lnet/minecraft/util/Formatting;intermediary field_1064Lnet/minecraft/class_124;field_1064:Lnet/minecraft/class_124;official fLo;f:Lo;
-
GOLD
- Mappings:
Namespace Name Mixin selector named GOLDLnet/minecraft/util/Formatting;GOLD:Lnet/minecraft/util/Formatting;intermediary field_1065Lnet/minecraft/class_124;field_1065:Lnet/minecraft/class_124;official gLo;g:Lo;
-
GRAY
- Mappings:
Namespace Name Mixin selector named GRAYLnet/minecraft/util/Formatting;GRAY:Lnet/minecraft/util/Formatting;intermediary field_1080Lnet/minecraft/class_124;field_1080:Lnet/minecraft/class_124;official hLo;h:Lo;
-
DARK_GRAY
- Mappings:
Namespace Name Mixin selector named DARK_GRAYLnet/minecraft/util/Formatting;DARK_GRAY:Lnet/minecraft/util/Formatting;intermediary field_1063Lnet/minecraft/class_124;field_1063:Lnet/minecraft/class_124;official iLo;i:Lo;
-
BLUE
- Mappings:
Namespace Name Mixin selector named BLUELnet/minecraft/util/Formatting;BLUE:Lnet/minecraft/util/Formatting;intermediary field_1078Lnet/minecraft/class_124;field_1078:Lnet/minecraft/class_124;official jLo;j:Lo;
-
GREEN
- Mappings:
Namespace Name Mixin selector named GREENLnet/minecraft/util/Formatting;GREEN:Lnet/minecraft/util/Formatting;intermediary field_1060Lnet/minecraft/class_124;field_1060:Lnet/minecraft/class_124;official kLo;k:Lo;
-
AQUA
- Mappings:
Namespace Name Mixin selector named AQUALnet/minecraft/util/Formatting;AQUA:Lnet/minecraft/util/Formatting;intermediary field_1075Lnet/minecraft/class_124;field_1075:Lnet/minecraft/class_124;official lLo;l:Lo;
-
RED
- Mappings:
Namespace Name Mixin selector named REDLnet/minecraft/util/Formatting;RED:Lnet/minecraft/util/Formatting;intermediary field_1061Lnet/minecraft/class_124;field_1061:Lnet/minecraft/class_124;official mLo;m:Lo;
-
LIGHT_PURPLE
- Mappings:
Namespace Name Mixin selector named LIGHT_PURPLELnet/minecraft/util/Formatting;LIGHT_PURPLE:Lnet/minecraft/util/Formatting;intermediary field_1076Lnet/minecraft/class_124;field_1076:Lnet/minecraft/class_124;official nLo;n:Lo;
-
YELLOW
- Mappings:
Namespace Name Mixin selector named YELLOWLnet/minecraft/util/Formatting;YELLOW:Lnet/minecraft/util/Formatting;intermediary field_1054Lnet/minecraft/class_124;field_1054:Lnet/minecraft/class_124;official oLo;o:Lo;
-
WHITE
- Mappings:
Namespace Name Mixin selector named WHITELnet/minecraft/util/Formatting;WHITE:Lnet/minecraft/util/Formatting;intermediary field_1068Lnet/minecraft/class_124;field_1068:Lnet/minecraft/class_124;official pLo;p:Lo;
-
OBFUSCATED
- Mappings:
Namespace Name Mixin selector named OBFUSCATEDLnet/minecraft/util/Formatting;OBFUSCATED:Lnet/minecraft/util/Formatting;intermediary field_1051Lnet/minecraft/class_124;field_1051:Lnet/minecraft/class_124;official qLo;q:Lo;
-
BOLD
- Mappings:
Namespace Name Mixin selector named BOLDLnet/minecraft/util/Formatting;BOLD:Lnet/minecraft/util/Formatting;intermediary field_1067Lnet/minecraft/class_124;field_1067:Lnet/minecraft/class_124;official rLo;r:Lo;
-
STRIKETHROUGH
- Mappings:
Namespace Name Mixin selector named STRIKETHROUGHLnet/minecraft/util/Formatting;STRIKETHROUGH:Lnet/minecraft/util/Formatting;intermediary field_1055Lnet/minecraft/class_124;field_1055:Lnet/minecraft/class_124;official sLo;s:Lo;
-
UNDERLINE
- Mappings:
Namespace Name Mixin selector named UNDERLINELnet/minecraft/util/Formatting;UNDERLINE:Lnet/minecraft/util/Formatting;intermediary field_1073Lnet/minecraft/class_124;field_1073:Lnet/minecraft/class_124;official tLo;t:Lo;
-
ITALIC
- Mappings:
Namespace Name Mixin selector named ITALICLnet/minecraft/util/Formatting;ITALIC:Lnet/minecraft/util/Formatting;intermediary field_1056Lnet/minecraft/class_124;field_1056:Lnet/minecraft/class_124;official uLo;u:Lo;
-
RESET
- Mappings:
Namespace Name Mixin selector named RESETLnet/minecraft/util/Formatting;RESET:Lnet/minecraft/util/Formatting;intermediary field_1070Lnet/minecraft/class_124;field_1070:Lnet/minecraft/class_124;official vLo;v:Lo;
-
-
Field Details
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/util/Formatting;CODEC:Lcom/mojang/serialization/Codec;intermediary field_39218Lnet/minecraft/class_124;field_39218:Lcom/mojang/serialization/Codec;official wLo;w:Lcom/mojang/serialization/Codec;
-
COLOR_CODEC
- Mappings:
Namespace Name Mixin selector named COLOR_CODECLnet/minecraft/util/Formatting;COLOR_CODEC:Lcom/mojang/serialization/Codec;intermediary field_56511Lnet/minecraft/class_124;field_56511:Lcom/mojang/serialization/Codec;official xLo;x:Lcom/mojang/serialization/Codec;
-
FORMATTING_CODE_PREFIX
public static final char FORMATTING_CODE_PREFIX- See Also:
- Mappings:
Namespace Name Mixin selector named FORMATTING_CODE_PREFIXLnet/minecraft/util/Formatting;FORMATTING_CODE_PREFIX:Cintermediary field_33292Lnet/minecraft/class_124;field_33292:Cofficial yLo;y:C
-
BY_NAME
- Mappings:
Namespace Name Mixin selector named BY_NAMELnet/minecraft/util/Formatting;BY_NAME:Ljava/util/Map;intermediary field_1052Lnet/minecraft/class_124;field_1052:Ljava/util/Map;official zLo;z:Ljava/util/Map;
-
FORMATTING_CODE_PATTERN
- Mappings:
Namespace Name Mixin selector named FORMATTING_CODE_PATTERNLnet/minecraft/util/Formatting;FORMATTING_CODE_PATTERN:Ljava/util/regex/Pattern;intermediary field_1066Lnet/minecraft/class_124;field_1066:Ljava/util/regex/Pattern;official ALo;A:Ljava/util/regex/Pattern;
-
name
- Mappings:
Namespace Name Mixin selector named nameLnet/minecraft/util/Formatting;name:Ljava/lang/String;intermediary field_1057Lnet/minecraft/class_124;field_1057:Ljava/lang/String;official BLo;B:Ljava/lang/String;
-
code
private final char code- Mappings:
Namespace Name Mixin selector named codeLnet/minecraft/util/Formatting;code:Cintermediary field_1059Lnet/minecraft/class_124;field_1059:Cofficial CLo;C:C
-
modifier
private final boolean modifier- Mappings:
Namespace Name Mixin selector named modifierLnet/minecraft/util/Formatting;modifier:Zintermediary field_1081Lnet/minecraft/class_124;field_1081:Zofficial DLo;D:Z
-
stringValue
- Mappings:
Namespace Name Mixin selector named stringValueLnet/minecraft/util/Formatting;stringValue:Ljava/lang/String;intermediary field_1069Lnet/minecraft/class_124;field_1069:Ljava/lang/String;official ELo;E:Ljava/lang/String;
-
colorIndex
private final int colorIndex- Mappings:
Namespace Name Mixin selector named colorIndexLnet/minecraft/util/Formatting;colorIndex:Iintermediary field_1071Lnet/minecraft/class_124;field_1071:Iofficial FLo;F:I
-
colorValue
- Mappings:
Namespace Name Mixin selector named colorValueLnet/minecraft/util/Formatting;colorValue:Ljava/lang/Integer;intermediary field_1053Lnet/minecraft/class_124;field_1053:Ljava/lang/Integer;official GLo;G:Ljava/lang/Integer;
-
-
Constructor Details
-
Formatting
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/util/Formatting;<init>(Ljava/lang/String;ILjava/lang/String;CILjava/lang/Integer;)Vintermediary <init>Lnet/minecraft/class_124;<init>(Ljava/lang/String;ILjava/lang/String;CILjava/lang/Integer;)Vofficial <init>Lo;<init>(Ljava/lang/String;ILjava/lang/String;CILjava/lang/Integer;)V
-
Formatting
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/util/Formatting;<init>(Ljava/lang/String;ILjava/lang/String;CZ)Vintermediary <init>Lnet/minecraft/class_124;<init>(Ljava/lang/String;ILjava/lang/String;CZ)Vofficial <init>Lo;<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;)Vintermediary <init>Lnet/minecraft/class_124;<init>(Ljava/lang/String;ILjava/lang/String;CZILjava/lang/Integer;)Vofficial <init>Lo;<init>(Ljava/lang/String;ILjava/lang/String;CZILjava/lang/Integer;)V
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
sanitize
- Mappings:
Namespace Name Mixin selector named sanitizeLnet/minecraft/util/Formatting;sanitize(Ljava/lang/String;)Ljava/lang/String;intermediary method_535Lnet/minecraft/class_124;method_535(Ljava/lang/String;)Ljava/lang/String;official cLo;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 getCodeLnet/minecraft/util/Formatting;getCode()Cintermediary method_36145Lnet/minecraft/class_124;method_36145()Cofficial aLo;a()C
-
getColorIndex
public int getColorIndex()Returns the color index for the formatting, or-1to indicate no color.- Returns:
- the color index for the formatting, or
-1to indicate no color - API Note:
- This is also used to calculate scoreboard team display slot IDs.
- Mappings:
Namespace Name Mixin selector named getColorIndexLnet/minecraft/util/Formatting;getColorIndex()Iintermediary method_536Lnet/minecraft/class_124;method_536()Iofficial bLo;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 isModifierLnet/minecraft/util/Formatting;isModifier()Zintermediary method_542Lnet/minecraft/class_124;method_542()Zofficial dLo;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 isColorLnet/minecraft/util/Formatting;isColor()Zintermediary method_543Lnet/minecraft/class_124;method_543()Zofficial eLo;e()Z
-
getColorValue
Returns the color of the formatted text, ornullif the formatting has no associated color.- Returns:
- the color of the formatted text, or
nullif the formatting has no associated color - Mappings:
Namespace Name Mixin selector named getColorValueLnet/minecraft/util/Formatting;getColorValue()Ljava/lang/Integer;intermediary method_532Lnet/minecraft/class_124;method_532()Ljava/lang/Integer;official fLo;f()Ljava/lang/Integer;
-
getName
Returns the name of the formatting.- Returns:
- the name of the formatting
- Mappings:
Namespace Name Mixin selector named getNameLnet/minecraft/util/Formatting;getName()Ljava/lang/String;intermediary method_537Lnet/minecraft/class_124;method_537()Ljava/lang/String;official gLo;g()Ljava/lang/String;
-
toString
- Overrides:
toStringin classEnum<Formatting>
-
strip
@Contract("!null->!null;_->_") @Nullable public static @Nullable String strip(@Nullable @Nullable String string) Returns thetextwith all formatting codes removed.- Returns:
- the
textwith all formatting codes removed - See Also:
- Mappings:
Namespace Name Mixin selector named stripLnet/minecraft/util/Formatting;strip(Ljava/lang/String;)Ljava/lang/String;intermediary method_539Lnet/minecraft/class_124;method_539(Ljava/lang/String;)Ljava/lang/String;official aLo;a(Ljava/lang/String;)Ljava/lang/String;
-
byName
Returns the formatting with the namename, ornullif there is none.- Returns:
- the formatting with the name
name, ornullif there is none - Mappings:
Namespace Name Mixin selector named byNameLnet/minecraft/util/Formatting;byName(Ljava/lang/String;)Lnet/minecraft/util/Formatting;intermediary method_533Lnet/minecraft/class_124;method_533(Ljava/lang/String;)Lnet/minecraft/class_124;official bLo;b(Ljava/lang/String;)Lo;
-
byColorIndex
Returns the formatting with the color indexcolorIndex, ornullif there is none.- Returns:
- the formatting with the color index
colorIndex, ornullif there is none - Mappings:
Namespace Name Mixin selector named byColorIndexLnet/minecraft/util/Formatting;byColorIndex(I)Lnet/minecraft/util/Formatting;intermediary method_534Lnet/minecraft/class_124;method_534(I)Lnet/minecraft/class_124;official aLo;a(I)Lo;
-
byCode
Returns the formatting with the codecode, ornullif there is none.- Returns:
- the formatting with the code
code, ornullif there is none - Mappings:
Namespace Name Mixin selector named byCodeLnet/minecraft/util/Formatting;byCode(C)Lnet/minecraft/util/Formatting;intermediary method_544Lnet/minecraft/class_124;method_544(C)Lnet/minecraft/class_124;official aLo;a(C)Lo;
-
getNames
Returns the list of formattings matching the given condition.- Parameters:
colors- whether or not to include color formattingsmodifiers- whether or not to include modifier formattings- Returns:
- the list of formattings matching the given condition
- Mappings:
Namespace Name Mixin selector named getNamesLnet/minecraft/util/Formatting;getNames(ZZ)Ljava/util/Collection;intermediary method_540Lnet/minecraft/class_124;method_540(ZZ)Ljava/util/Collection;official aLo;a(ZZ)Ljava/util/Collection;
-
asString
Returns the unique string representation of the enum, used for serialization.- Specified by:
asStringin interfaceStringIdentifiable- Returns:
- the unique string representation of the enum, used for serialization
- Mappings:
Namespace Name Mixin selector named asStringLnet/minecraft/util/StringIdentifiable;asString()Ljava/lang/String;intermediary method_15434Lnet/minecraft/class_3542;method_15434()Ljava/lang/String;official cLbax;c()Ljava/lang/String;
-