Package net.minecraft.text
Class Style
java.lang.Object
net.minecraft.text.Style
public class Style extends Object
The style of a
Text
, representing cosmetic attributes. It includes
font, formatting, click/hover events (actions), color, etc.
A style is immutable.
- See Also:
Text
- Mappings:
Namespace Name official os
intermediary net/minecraft/class_2583
named net/minecraft/text/Style
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Style.Serializer
A JSON serializer forStyle
. -
Field Summary
Fields Modifier and Type Field Description private Boolean
bold
private ClickEvent
clickEvent
private TextColor
color
static Identifier
DEFAULT_FONT_ID
The identifier for the default font of a style.static Style
EMPTY
An empty style.private Identifier
font
private HoverEvent
hoverEvent
private String
insertion
private Boolean
italic
private Boolean
obfuscated
private Boolean
strikethrough
private Boolean
underlined
-
Constructor Summary
Constructors Modifier Constructor Description private
Style(TextColor color, Boolean bold, Boolean italic, Boolean underlined, Boolean strikethrough, Boolean obfuscated, ClickEvent clickEvent, HoverEvent hoverEvent, String insertion, Identifier font)
-
Method Summary
Modifier and Type Method Description boolean
equals(Object obj)
ClickEvent
getClickEvent()
Returns the click event of this style.TextColor
getColor()
Returns the color of this style.Identifier
getFont()
Returns the font of this style.HoverEvent
getHoverEvent()
Returns the hover event of this style.String
getInsertion()
Returns the insertion text of the style.int
hashCode()
boolean
isBold()
Returns whether the style has bold formatting.boolean
isEmpty()
Returns if this is the empty style.boolean
isItalic()
Returns whether the style has italic formatting.boolean
isObfuscated()
Returns whether the style has obfuscated formatting.boolean
isStrikethrough()
Returns whether the style has strikethrough formatting.boolean
isUnderlined()
Returns whether the style has underline formatting.String
toString()
Style
withBold(Boolean bold)
Returns a new style with the bold attribute provided and all other attributes of this style.Style
withClickEvent(ClickEvent clickEvent)
Returns a new style with the click event provided and all other attributes of this style.Style
withColor(TextColor color)
Returns a new style with the color provided and all other attributes of this style.Style
withColor(Formatting color)
Returns a new style with the color provided and all other attributes of this style.Style
withExclusiveFormatting(Formatting formatting)
Returns a new style with the formatting provided and some applicable attributes of this style.Style
withFont(Identifier font)
Returns a new style with the font provided and all other attributes of this style.Style
withFormatting(Formatting formatting)
Returns a new style with the formatting provided and all other attributes of this style.Style
withFormatting(Formatting[] formattings)
Returns a new style with the formattings provided and all other attributes of this style.Style
withHoverEvent(HoverEvent hoverEvent)
Returns a new style with the hover event provided and all other attributes of this style.Style
withInsertion(String insertion)
Returns a new style with the insertion provided and all other attributes of this style.Style
withItalic(Boolean italic)
Returns a new style with the italic attribute provided and all other attributes of this style.Style
withParent(Style parent)
Returns a new style with the undefined attributes of this style filled by theparent
style.Style
withUnderline(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 official a
Los;a:Los;
intermediary field_24360
Lnet/minecraft/class_2583;field_24360:Lnet/minecraft/class_2583;
named EMPTY
Lnet/minecraft/text/Style;EMPTY:Lnet/minecraft/text/Style;
-
DEFAULT_FONT_ID
The identifier for the default font of a style.- Mappings:
Namespace Name Mixin selector official b
Los;b:Lwb;
intermediary field_24359
Lnet/minecraft/class_2583;field_24359:Lnet/minecraft/class_2960;
named DEFAULT_FONT_ID
Lnet/minecraft/text/Style;DEFAULT_FONT_ID:Lnet/minecraft/util/Identifier;
-
color
- Mappings:
Namespace Name Mixin selector official c
Los;c:Lou;
intermediary field_11855
Lnet/minecraft/class_2583;field_11855:Lnet/minecraft/class_5251;
named color
Lnet/minecraft/text/Style;color:Lnet/minecraft/text/TextColor;
-
bold
- Mappings:
Namespace Name Mixin selector official d
Los;d:Ljava/lang/Boolean;
intermediary field_11856
Lnet/minecraft/class_2583;field_11856:Ljava/lang/Boolean;
named bold
Lnet/minecraft/text/Style;bold:Ljava/lang/Boolean;
-
italic
- Mappings:
Namespace Name Mixin selector official e
Los;e:Ljava/lang/Boolean;
intermediary field_11852
Lnet/minecraft/class_2583;field_11852:Ljava/lang/Boolean;
named italic
Lnet/minecraft/text/Style;italic:Ljava/lang/Boolean;
-
underlined
- Mappings:
Namespace Name Mixin selector official f
Los;f:Ljava/lang/Boolean;
intermediary field_11851
Lnet/minecraft/class_2583;field_11851:Ljava/lang/Boolean;
named underlined
Lnet/minecraft/text/Style;underlined:Ljava/lang/Boolean;
-
strikethrough
- Mappings:
Namespace Name Mixin selector official g
Los;g:Ljava/lang/Boolean;
intermediary field_11857
Lnet/minecraft/class_2583;field_11857:Ljava/lang/Boolean;
named strikethrough
Lnet/minecraft/text/Style;strikethrough:Ljava/lang/Boolean;
-
obfuscated
- Mappings:
Namespace Name Mixin selector official h
Los;h:Ljava/lang/Boolean;
intermediary field_11861
Lnet/minecraft/class_2583;field_11861:Ljava/lang/Boolean;
named obfuscated
Lnet/minecraft/text/Style;obfuscated:Ljava/lang/Boolean;
-
clickEvent
- Mappings:
Namespace Name Mixin selector official i
Los;i:Log;
intermediary field_11853
Lnet/minecraft/class_2583;field_11853:Lnet/minecraft/class_2558;
named clickEvent
Lnet/minecraft/text/Style;clickEvent:Lnet/minecraft/text/ClickEvent;
-
hoverEvent
- Mappings:
Namespace Name Mixin selector official j
Los;j:Lom;
intermediary field_11858
Lnet/minecraft/class_2583;field_11858:Lnet/minecraft/class_2568;
named hoverEvent
Lnet/minecraft/text/Style;hoverEvent:Lnet/minecraft/text/HoverEvent;
-
insertion
- Mappings:
Namespace Name Mixin selector official k
Los;k:Ljava/lang/String;
intermediary field_11859
Lnet/minecraft/class_2583;field_11859:Ljava/lang/String;
named insertion
Lnet/minecraft/text/Style;insertion:Ljava/lang/String;
-
font
- Mappings:
Namespace Name Mixin selector official l
Los;l:Lwb;
intermediary field_24361
Lnet/minecraft/class_2583;field_24361:Lnet/minecraft/class_2960;
named font
Lnet/minecraft/text/Style;font:Lnet/minecraft/util/Identifier;
-
-
Constructor Details
-
Style
private Style(@Nullable TextColor color, @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)- Mappings:
Namespace Name Mixin selector official <init>
Los;<init>(Lou;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Ljava/lang/Boolean;Log;Lom;Ljava/lang/String;Lwb;)V
intermediary <init>
Lnet/minecraft/class_2583;<init>(Lnet/minecraft/class_5251;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;)V
named <init>
Lnet/minecraft/text/Style;<init>(Lnet/minecraft/text/TextColor;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;)V
-
-
Method Details
-
getColor
Returns the color of this style.- Mappings:
Namespace Name Mixin selector official a
Los;a()Lou;
intermediary method_10973
Lnet/minecraft/class_2583;method_10973()Lnet/minecraft/class_5251;
named getColor
Lnet/minecraft/text/Style;getColor()Lnet/minecraft/text/TextColor;
-
isBold
public boolean isBold()Returns whether the style has bold formatting.- See Also:
Formatting.BOLD
- Mappings:
Namespace Name Mixin selector official b
Los;b()Z
intermediary method_10984
Lnet/minecraft/class_2583;method_10984()Z
named isBold
Lnet/minecraft/text/Style;isBold()Z
-
isItalic
public boolean isItalic()Returns whether the style has italic formatting.- See Also:
Formatting.ITALIC
- Mappings:
Namespace Name Mixin selector official c
Los;c()Z
intermediary method_10966
Lnet/minecraft/class_2583;method_10966()Z
named isItalic
Lnet/minecraft/text/Style;isItalic()Z
-
isStrikethrough
public boolean isStrikethrough()Returns whether the style has strikethrough formatting.- See Also:
Formatting.STRIKETHROUGH
- Mappings:
Namespace Name Mixin selector official d
Los;d()Z
intermediary method_10986
Lnet/minecraft/class_2583;method_10986()Z
named isStrikethrough
Lnet/minecraft/text/Style;isStrikethrough()Z
-
isUnderlined
public boolean isUnderlined()Returns whether the style has underline formatting.- See Also:
Formatting.UNDERLINE
- Mappings:
Namespace Name Mixin selector official e
Los;e()Z
intermediary method_10965
Lnet/minecraft/class_2583;method_10965()Z
named isUnderlined
Lnet/minecraft/text/Style;isUnderlined()Z
-
isObfuscated
public boolean isObfuscated()Returns whether the style has obfuscated formatting.- See Also:
Formatting.OBFUSCATED
- Mappings:
Namespace Name Mixin selector official f
Los;f()Z
intermediary method_10987
Lnet/minecraft/class_2583;method_10987()Z
named isObfuscated
Lnet/minecraft/text/Style;isObfuscated()Z
-
isEmpty
public boolean isEmpty()Returns if this is the empty style.- See Also:
EMPTY
- Mappings:
Namespace Name Mixin selector official g
Los;g()Z
intermediary method_10967
Lnet/minecraft/class_2583;method_10967()Z
named isEmpty
Lnet/minecraft/text/Style;isEmpty()Z
-
getClickEvent
Returns the click event of this style.- Mappings:
Namespace Name Mixin selector official h
Los;h()Log;
intermediary method_10970
Lnet/minecraft/class_2583;method_10970()Lnet/minecraft/class_2558;
named getClickEvent
Lnet/minecraft/text/Style;getClickEvent()Lnet/minecraft/text/ClickEvent;
-
getHoverEvent
Returns the hover event of this style.- Mappings:
Namespace Name Mixin selector official i
Los;i()Lom;
intermediary method_10969
Lnet/minecraft/class_2583;method_10969()Lnet/minecraft/class_2568;
named getHoverEvent
Lnet/minecraft/text/Style;getHoverEvent()Lnet/minecraft/text/HoverEvent;
-
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 official j
Los;j()Ljava/lang/String;
intermediary method_10955
Lnet/minecraft/class_2583;method_10955()Ljava/lang/String;
named getInsertion
Lnet/minecraft/text/Style;getInsertion()Ljava/lang/String;
-
getFont
Returns the font of this style.- Mappings:
Namespace Name Mixin selector official k
Los;k()Lwb;
intermediary method_27708
Lnet/minecraft/class_2583;method_27708()Lnet/minecraft/class_2960;
named getFont
Lnet/minecraft/text/Style;getFont()Lnet/minecraft/util/Identifier;
-
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 official a
Los;a(Lou;)Los;
intermediary method_27703
Lnet/minecraft/class_2583;method_27703(Lnet/minecraft/class_5251;)Lnet/minecraft/class_2583;
named withColor
Lnet/minecraft/text/Style;withColor(Lnet/minecraft/text/TextColor;)Lnet/minecraft/text/Style;
-
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 official a
Los;a(Lk;)Los;
intermediary method_10977
Lnet/minecraft/class_2583;method_10977(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;
named withColor
Lnet/minecraft/text/Style;withColor(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;
-
withBold
Returns a new style with the bold attribute provided and all other attributes of this style.- Parameters:
bold
- the new bold property- Mappings:
Namespace Name Mixin selector official a
Los;a(Ljava/lang/Boolean;)Los;
intermediary method_10982
Lnet/minecraft/class_2583;method_10982(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;
named withBold
Lnet/minecraft/text/Style;withBold(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;
-
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 official b
Los;b(Ljava/lang/Boolean;)Los;
intermediary method_10978
Lnet/minecraft/class_2583;method_10978(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;
named withItalic
Lnet/minecraft/text/Style;withItalic(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;
-
withUnderline
Returns a new style with the underline attribute provided and all other attributes of this style.- Mappings:
Namespace Name Mixin selector official c
Los;c(Ljava/lang/Boolean;)Los;
intermediary method_30938
Lnet/minecraft/class_2583;method_30938(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;
named withUnderline
Lnet/minecraft/text/Style;withUnderline(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;
-
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 official a
Los;a(Log;)Los;
intermediary method_10958
Lnet/minecraft/class_2583;method_10958(Lnet/minecraft/class_2558;)Lnet/minecraft/class_2583;
named withClickEvent
Lnet/minecraft/text/Style;withClickEvent(Lnet/minecraft/text/ClickEvent;)Lnet/minecraft/text/Style;
-
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 official a
Los;a(Lom;)Los;
intermediary method_10949
Lnet/minecraft/class_2583;method_10949(Lnet/minecraft/class_2568;)Lnet/minecraft/class_2583;
named withHoverEvent
Lnet/minecraft/text/Style;withHoverEvent(Lnet/minecraft/text/HoverEvent;)Lnet/minecraft/text/Style;
-
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 official a
Los;a(Ljava/lang/String;)Los;
intermediary method_10975
Lnet/minecraft/class_2583;method_10975(Ljava/lang/String;)Lnet/minecraft/class_2583;
named withInsertion
Lnet/minecraft/text/Style;withInsertion(Ljava/lang/String;)Lnet/minecraft/text/Style;
-
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 official a
Los;a(Lwb;)Los;
intermediary method_27704
Lnet/minecraft/class_2583;method_27704(Lnet/minecraft/class_2960;)Lnet/minecraft/class_2583;
named withFont
Lnet/minecraft/text/Style;withFont(Lnet/minecraft/util/Identifier;)Lnet/minecraft/text/Style;
-
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 official b
Los;b(Lk;)Los;
intermediary method_27706
Lnet/minecraft/class_2583;method_27706(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;
named withFormatting
Lnet/minecraft/text/Style;withFormatting(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;
-
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 official c
Los;c(Lk;)Los;
intermediary method_27707
Lnet/minecraft/class_2583;method_27707(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;
named withExclusiveFormatting
Lnet/minecraft/text/Style;withExclusiveFormatting(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;
-
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 official a
Los;a([Lk;)Los;
intermediary method_27705
Lnet/minecraft/class_2583;method_27705([Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;
named withFormatting
Lnet/minecraft/text/Style;withFormatting([Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;
-
withParent
Returns a new style with the undefined attributes of this style filled by theparent
style.- Parameters:
parent
- the parent style- Mappings:
Namespace Name Mixin selector official a
Los;a(Los;)Los;
intermediary method_27702
Lnet/minecraft/class_2583;method_27702(Lnet/minecraft/class_2583;)Lnet/minecraft/class_2583;
named withParent
Lnet/minecraft/text/Style;withParent(Lnet/minecraft/text/Style;)Lnet/minecraft/text/Style;
-
toString
-
equals
-
hashCode
public int hashCode()
-