Package net.minecraft.text
Class Style
java.lang.Object
net.minecraft.text.Style
The style of a
Text, representing cosmetic attributes. It includes
font, formatting, click/hover events (actions), color, etc.
A style is immutable.
- See Also:
- Mappings:
Namespace Name named net/minecraft/text/Styleintermediary net/minecraft/class_2583official yd
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final @Nullable ClickEventstatic final IdentifierThe identifier for the default font of a style.static final StyleAn empty style.(package private) final @Nullable Identifier(package private) final @Nullable HoverEvent -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateStyle(@Nullable TextColor color, @Nullable Integer shadowColor, @Nullable Boolean bold, @Nullable Boolean italic, @Nullable Boolean underlined, @Nullable Boolean strikethrough, @Nullable Boolean obfuscated, @Nullable ClickEvent clickEvent, @Nullable HoverEvent hoverEvent, @Nullable String insertion, @Nullable Identifier font) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the click event of this style.getColor()Returns the color of this style.getFont()Returns the font of this style.Returns the hover event of this style.Returns the insertion text of the style.inthashCode()booleanisBold()Returns whether the style has bold formatting.booleanisEmpty()Returns if this is the empty style.booleanisItalic()Returns whether the style has italic formatting.booleanReturns whether the style has obfuscated formatting.booleanReturns whether the style has strikethrough formatting.booleanReturns whether the style has underline formatting.private static Styleof(Optional<TextColor> color, Optional<Integer> shadowColor, Optional<Boolean> bold, Optional<Boolean> italic, Optional<Boolean> underlined, Optional<Boolean> strikethrough, Optional<Boolean> obfuscated, Optional<ClickEvent> clickEvent, Optional<HoverEvent> hoverEvent, Optional<String> insertion, Optional<Identifier> font) toString()private static <T> StyleReturns a new style with the bold attribute provided and all other attributes of this style.withClickEvent(@Nullable ClickEvent clickEvent) Returns a new style with the click event provided and all other attributes of this style.withColor(int rgbColor) Returns a new style with the color provided and all other attributes of this style.withColor(@Nullable Formatting color) Returns a new style with the color provided and all other attributes of this style.withExclusiveFormatting(Formatting formatting) Returns a new style with the formatting provided and some applicable attributes of this style.withFont(@Nullable Identifier font) Returns a new style with the font provided and all other attributes of this style.withFormatting(Formatting formatting) Returns a new style with the formatting provided and all other attributes of this style.withFormatting(Formatting[] formattings) Returns a new style with the formattings provided and all other attributes of this style.withHoverEvent(@Nullable HoverEvent hoverEvent) Returns a new style with the hover event provided and all other attributes of this style.withInsertion(@Nullable String insertion) Returns a new style with the insertion provided and all other attributes of this style.withItalic(@Nullable Boolean italic) Returns a new style with the italic attribute provided and all other attributes of this style.withObfuscated(@Nullable Boolean obfuscated) withParent(Style parent) Returns a new style with the undefined attributes of this style filled by theparentstyle.withShadowColor(int shadowColor) withStrikethrough(@Nullable Boolean strikethrough) withUnderline(@Nullable Boolean underline) Returns a new style with the underline attribute provided and all other attributes of this style.
-
Field Details
-
EMPTY
An empty style.- Mappings:
Namespace Name Mixin selector named EMPTYLnet/minecraft/text/Style;EMPTY:Lnet/minecraft/text/Style;intermediary field_24360Lnet/minecraft/class_2583;field_24360:Lnet/minecraft/class_2583;official aLyd;a:Lyd;
-
DEFAULT_FONT_ID
The identifier for the default font of a style.- Mappings:
Namespace Name Mixin selector named DEFAULT_FONT_IDLnet/minecraft/text/Style;DEFAULT_FONT_ID:Lnet/minecraft/util/Identifier;intermediary field_24359Lnet/minecraft/class_2583;field_24359:Lnet/minecraft/class_2960;official bLyd;b:Lalr;
-
color
- Mappings:
Namespace Name Mixin selector named colorLnet/minecraft/text/Style;color:Lnet/minecraft/text/TextColor;intermediary field_11855Lnet/minecraft/class_2583;field_11855:Lnet/minecraft/class_5251;official cLyd;c:Lyf;
-
shadowColor
- Mappings:
Namespace Name Mixin selector named shadowColorLnet/minecraft/text/Style;shadowColor:Ljava/lang/Integer;intermediary field_55191Lnet/minecraft/class_2583;field_55191:Ljava/lang/Integer;official dLyd;d:Ljava/lang/Integer;
-
bold
- Mappings:
Namespace Name Mixin selector named boldLnet/minecraft/text/Style;bold:Ljava/lang/Boolean;intermediary field_11856Lnet/minecraft/class_2583;field_11856:Ljava/lang/Boolean;official eLyd;e:Ljava/lang/Boolean;
-
italic
- Mappings:
Namespace Name Mixin selector named italicLnet/minecraft/text/Style;italic:Ljava/lang/Boolean;intermediary field_11852Lnet/minecraft/class_2583;field_11852:Ljava/lang/Boolean;official fLyd;f:Ljava/lang/Boolean;
-
underlined
- Mappings:
Namespace Name Mixin selector named underlinedLnet/minecraft/text/Style;underlined:Ljava/lang/Boolean;intermediary field_11851Lnet/minecraft/class_2583;field_11851:Ljava/lang/Boolean;official gLyd;g:Ljava/lang/Boolean;
-
strikethrough
- Mappings:
Namespace Name Mixin selector named strikethroughLnet/minecraft/text/Style;strikethrough:Ljava/lang/Boolean;intermediary field_11857Lnet/minecraft/class_2583;field_11857:Ljava/lang/Boolean;official hLyd;h:Ljava/lang/Boolean;
-
obfuscated
- Mappings:
Namespace Name Mixin selector named obfuscatedLnet/minecraft/text/Style;obfuscated:Ljava/lang/Boolean;intermediary field_11861Lnet/minecraft/class_2583;field_11861:Ljava/lang/Boolean;official iLyd;i:Ljava/lang/Boolean;
-
clickEvent
- Mappings:
Namespace Name Mixin selector named clickEventLnet/minecraft/text/Style;clickEvent:Lnet/minecraft/text/ClickEvent;intermediary field_11853Lnet/minecraft/class_2583;field_11853:Lnet/minecraft/class_2558;official jLyd;j:Lxe;
-
hoverEvent
- Mappings:
Namespace Name Mixin selector named hoverEventLnet/minecraft/text/Style;hoverEvent:Lnet/minecraft/text/HoverEvent;intermediary field_11858Lnet/minecraft/class_2583;field_11858:Lnet/minecraft/class_2568;official kLyd;k:Lxm;
-
insertion
- Mappings:
Namespace Name Mixin selector named insertionLnet/minecraft/text/Style;insertion:Ljava/lang/String;intermediary field_11859Lnet/minecraft/class_2583;field_11859:Ljava/lang/String;official lLyd;l:Ljava/lang/String;
-
font
- Mappings:
Namespace Name Mixin selector named fontLnet/minecraft/text/Style;font:Lnet/minecraft/util/Identifier;intermediary field_24361Lnet/minecraft/class_2583;field_24361:Lnet/minecraft/class_2960;official mLyd;m:Lalr;
-
-
Constructor Details
-
Style
private Style(@Nullable @Nullable TextColor color, @Nullable @Nullable Integer shadowColor, @Nullable @Nullable Boolean bold, @Nullable @Nullable Boolean italic, @Nullable @Nullable Boolean underlined, @Nullable @Nullable Boolean strikethrough, @Nullable @Nullable Boolean obfuscated, @Nullable @Nullable ClickEvent clickEvent, @Nullable @Nullable HoverEvent hoverEvent, @Nullable @Nullable String insertion, @Nullable @Nullable Identifier font) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/text/Style;<init>(Lnet/minecraft/text/TextColor;Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Lnet/minecraft/text/ClickEvent;Lnet/minecraft/text/HoverEvent;Ljava/lang/String;Lnet/minecraft/util/Identifier;)Vintermediary <init>Lnet/minecraft/class_2583;<init>(Lnet/minecraft/class_5251;Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Lnet/minecraft/class_2558;Lnet/minecraft/class_2568;Ljava/lang/String;Lnet/minecraft/class_2960;)Vofficial <init>Lyd;<init>(Lyf;Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Lxe;Lxm;Ljava/lang/String;Lalr;)V
-
-
Method Details
-
of
private static Style of(Optional<TextColor> color, Optional<Integer> shadowColor, Optional<Boolean> bold, Optional<Boolean> italic, Optional<Boolean> underlined, Optional<Boolean> strikethrough, Optional<Boolean> obfuscated, Optional<ClickEvent> clickEvent, Optional<HoverEvent> hoverEvent, Optional<String> insertion, Optional<Identifier> font) - Mappings:
Namespace Name Mixin selector named ofLnet/minecraft/text/Style;of(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)Lnet/minecraft/text/Style;intermediary method_43870Lnet/minecraft/class_2583;method_43870(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)Lnet/minecraft/class_2583;official aLyd;a(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)Lyd;
-
getColor
Returns the color of this style.- Mappings:
Namespace Name Mixin selector named getColorLnet/minecraft/text/Style;getColor()Lnet/minecraft/text/TextColor;intermediary method_10973Lnet/minecraft/class_2583;method_10973()Lnet/minecraft/class_5251;official aLyd;a()Lyf;
-
getShadowColor
- Mappings:
Namespace Name Mixin selector named getShadowColorLnet/minecraft/text/Style;getShadowColor()Ljava/lang/Integer;intermediary method_65301Lnet/minecraft/class_2583;method_65301()Ljava/lang/Integer;official bLyd;b()Ljava/lang/Integer;
-
isBold
public boolean isBold()Returns whether the style has bold formatting.- See Also:
- Mappings:
Namespace Name Mixin selector named isBoldLnet/minecraft/text/Style;isBold()Zintermediary method_10984Lnet/minecraft/class_2583;method_10984()Zofficial cLyd;c()Z
-
isItalic
public boolean isItalic()Returns whether the style has italic formatting.- See Also:
- Mappings:
Namespace Name Mixin selector named isItalicLnet/minecraft/text/Style;isItalic()Zintermediary method_10966Lnet/minecraft/class_2583;method_10966()Zofficial dLyd;d()Z
-
isStrikethrough
public boolean isStrikethrough()Returns whether the style has strikethrough formatting.- See Also:
- Mappings:
Namespace Name Mixin selector named isStrikethroughLnet/minecraft/text/Style;isStrikethrough()Zintermediary method_10986Lnet/minecraft/class_2583;method_10986()Zofficial eLyd;e()Z
-
isUnderlined
public boolean isUnderlined()Returns whether the style has underline formatting.- See Also:
- Mappings:
Namespace Name Mixin selector named isUnderlinedLnet/minecraft/text/Style;isUnderlined()Zintermediary method_10965Lnet/minecraft/class_2583;method_10965()Zofficial fLyd;f()Z
-
isObfuscated
public boolean isObfuscated()Returns whether the style has obfuscated formatting.- See Also:
- Mappings:
Namespace Name Mixin selector named isObfuscatedLnet/minecraft/text/Style;isObfuscated()Zintermediary method_10987Lnet/minecraft/class_2583;method_10987()Zofficial gLyd;g()Z
-
isEmpty
public boolean isEmpty()Returns if this is the empty style.- See Also:
- Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/text/Style;isEmpty()Zintermediary method_10967Lnet/minecraft/class_2583;method_10967()Zofficial hLyd;h()Z
-
getClickEvent
Returns the click event of this style.- Mappings:
Namespace Name Mixin selector named getClickEventLnet/minecraft/text/Style;getClickEvent()Lnet/minecraft/text/ClickEvent;intermediary method_10970Lnet/minecraft/class_2583;method_10970()Lnet/minecraft/class_2558;official iLyd;i()Lxe;
-
getHoverEvent
Returns the hover event of this style.- Mappings:
Namespace Name Mixin selector named getHoverEventLnet/minecraft/text/Style;getHoverEvent()Lnet/minecraft/text/HoverEvent;intermediary method_10969Lnet/minecraft/class_2583;method_10969()Lnet/minecraft/class_2568;official jLyd;j()Lxm;
-
getInsertion
Returns the insertion text of the style.An insertion is inserted when a piece of text clicked while shift key is down in the chat HUD.
- Mappings:
Namespace Name Mixin selector named getInsertionLnet/minecraft/text/Style;getInsertion()Ljava/lang/String;intermediary method_10955Lnet/minecraft/class_2583;method_10955()Ljava/lang/String;official kLyd;k()Ljava/lang/String;
-
getFont
Returns the font of this style.- Mappings:
Namespace Name Mixin selector named getFontLnet/minecraft/text/Style;getFont()Lnet/minecraft/util/Identifier;intermediary method_27708Lnet/minecraft/class_2583;method_27708()Lnet/minecraft/class_2960;official lLyd;l()Lalr;
-
with
- Mappings:
Namespace Name Mixin selector named withLnet/minecraft/text/Style;with(Lnet/minecraft/text/Style;Ljava/lang/Object;Ljava/lang/Object;)Lnet/minecraft/text/Style;intermediary method_54210Lnet/minecraft/class_2583;method_54210(Lnet/minecraft/class_2583;Ljava/lang/Object;Ljava/lang/Object;)Lnet/minecraft/class_2583;official aLyd;a(Lyd;Ljava/lang/Object;Ljava/lang/Object;)Lyd;
-
withColor
Returns a new style with the color provided and all other attributes of this style.- Parameters:
color- the new color- Mappings:
Namespace Name Mixin selector named withColorLnet/minecraft/text/Style;withColor(Lnet/minecraft/text/TextColor;)Lnet/minecraft/text/Style;intermediary method_27703Lnet/minecraft/class_2583;method_27703(Lnet/minecraft/class_5251;)Lnet/minecraft/class_2583;official aLyd;a(Lyf;)Lyd;
-
withColor
Returns a new style with the color provided and all other attributes of this style.- Parameters:
color- the new color- Mappings:
Namespace Name Mixin selector named withColorLnet/minecraft/text/Style;withColor(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;intermediary method_10977Lnet/minecraft/class_2583;method_10977(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;official aLyd;a(Lo;)Lyd;
-
withColor
- Mappings:
Namespace Name Mixin selector named withColorLnet/minecraft/text/Style;withColor(I)Lnet/minecraft/text/Style;intermediary method_36139Lnet/minecraft/class_2583;method_36139(I)Lnet/minecraft/class_2583;official aLyd;a(I)Lyd;
-
withShadowColor
- Mappings:
Namespace Name Mixin selector named withShadowColorLnet/minecraft/text/Style;withShadowColor(I)Lnet/minecraft/text/Style;intermediary method_65302Lnet/minecraft/class_2583;method_65302(I)Lnet/minecraft/class_2583;official bLyd;b(I)Lyd;
-
withBold
Returns a new style with the bold attribute provided and all other attributes of this style.- Mappings:
Namespace Name Mixin selector named withBoldLnet/minecraft/text/Style;withBold(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;intermediary method_10982Lnet/minecraft/class_2583;method_10982(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;official aLyd;a(Ljava/lang/Boolean;)Lyd;
-
withItalic
Returns a new style with the italic attribute provided and all other attributes of this style.- Parameters:
italic- the new italic property- Mappings:
Namespace Name Mixin selector named withItalicLnet/minecraft/text/Style;withItalic(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;intermediary method_10978Lnet/minecraft/class_2583;method_10978(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;official bLyd;b(Ljava/lang/Boolean;)Lyd;
-
withUnderline
Returns a new style with the underline attribute provided and all other attributes of this style.- Mappings:
Namespace Name Mixin selector named withUnderlineLnet/minecraft/text/Style;withUnderline(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;intermediary method_30938Lnet/minecraft/class_2583;method_30938(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;official cLyd;c(Ljava/lang/Boolean;)Lyd;
-
withStrikethrough
- Mappings:
Namespace Name Mixin selector named withStrikethroughLnet/minecraft/text/Style;withStrikethrough(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;intermediary method_36140Lnet/minecraft/class_2583;method_36140(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;official dLyd;d(Ljava/lang/Boolean;)Lyd;
-
withObfuscated
- Mappings:
Namespace Name Mixin selector named withObfuscatedLnet/minecraft/text/Style;withObfuscated(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;intermediary method_36141Lnet/minecraft/class_2583;method_36141(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;official eLyd;e(Ljava/lang/Boolean;)Lyd;
-
withClickEvent
Returns a new style with the click event provided and all other attributes of this style.- Parameters:
clickEvent- the new click event- Mappings:
Namespace Name Mixin selector named withClickEventLnet/minecraft/text/Style;withClickEvent(Lnet/minecraft/text/ClickEvent;)Lnet/minecraft/text/Style;intermediary method_10958Lnet/minecraft/class_2583;method_10958(Lnet/minecraft/class_2558;)Lnet/minecraft/class_2583;official aLyd;a(Lxe;)Lyd;
-
withHoverEvent
Returns a new style with the hover event provided and all other attributes of this style.- Parameters:
hoverEvent- the new hover event- Mappings:
Namespace Name Mixin selector named withHoverEventLnet/minecraft/text/Style;withHoverEvent(Lnet/minecraft/text/HoverEvent;)Lnet/minecraft/text/Style;intermediary method_10949Lnet/minecraft/class_2583;method_10949(Lnet/minecraft/class_2568;)Lnet/minecraft/class_2583;official aLyd;a(Lxm;)Lyd;
-
withInsertion
Returns a new style with the insertion provided and all other attributes of this style.- Parameters:
insertion- the new insertion string- Mappings:
Namespace Name Mixin selector named withInsertionLnet/minecraft/text/Style;withInsertion(Ljava/lang/String;)Lnet/minecraft/text/Style;intermediary method_10975Lnet/minecraft/class_2583;method_10975(Ljava/lang/String;)Lnet/minecraft/class_2583;official aLyd;a(Ljava/lang/String;)Lyd;
-
withFont
Returns a new style with the font provided and all other attributes of this style.- Parameters:
font- the new font- Mappings:
Namespace Name Mixin selector named withFontLnet/minecraft/text/Style;withFont(Lnet/minecraft/util/Identifier;)Lnet/minecraft/text/Style;intermediary method_27704Lnet/minecraft/class_2583;method_27704(Lnet/minecraft/class_2960;)Lnet/minecraft/class_2583;official aLyd;a(Lalr;)Lyd;
-
withFormatting
Returns a new style with the formatting provided and all other attributes of this style.- Parameters:
formatting- the new formatting- Mappings:
Namespace Name Mixin selector named withFormattingLnet/minecraft/text/Style;withFormatting(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;intermediary method_27706Lnet/minecraft/class_2583;method_27706(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;official bLyd;b(Lo;)Lyd;
-
withExclusiveFormatting
Returns a new style with the formatting provided and some applicable attributes of this style.When a color formatting is passed for
formatting, the other formattings, including bold, italic, strikethrough, underlined, and obfuscated, are all removed.- Parameters:
formatting- the new formatting- Mappings:
Namespace Name Mixin selector named withExclusiveFormattingLnet/minecraft/text/Style;withExclusiveFormatting(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;intermediary method_27707Lnet/minecraft/class_2583;method_27707(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;official cLyd;c(Lo;)Lyd;
-
withFormatting
Returns a new style with the formattings provided and all other attributes of this style.- Parameters:
formattings- an array of new formattings- Mappings:
Namespace Name Mixin selector named withFormattingLnet/minecraft/text/Style;withFormatting([Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;intermediary method_27705Lnet/minecraft/class_2583;method_27705([Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;official aLyd;a([Lo;)Lyd;
-
withParent
Returns a new style with the undefined attributes of this style filled by theparentstyle.- Parameters:
parent- the parent style- Mappings:
Namespace Name Mixin selector named withParentLnet/minecraft/text/Style;withParent(Lnet/minecraft/text/Style;)Lnet/minecraft/text/Style;intermediary method_27702Lnet/minecraft/class_2583;method_27702(Lnet/minecraft/class_2583;)Lnet/minecraft/class_2583;official aLyd;a(Lyd;)Lyd;
-
toString
-
equals
-
hashCode
public int hashCode()
-