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:
Mappings:
Namespace Name
named net/minecraft/text/Style
intermediary net/minecraft/class_2583
official ys
  • Field Details

    • EMPTY

      public static final Style EMPTY
      An empty style.
      Mappings:
      Namespace Name Mixin selector
      named EMPTY Lnet/minecraft/text/Style;EMPTY:Lnet/minecraft/text/Style;
      intermediary field_24360 Lnet/minecraft/class_2583;field_24360:Lnet/minecraft/class_2583;
      official a Lys;a:Lys;
    • DEFAULT_FONT_ID

      public static final Identifier DEFAULT_FONT_ID
      The identifier for the default font of a style.
      Mappings:
      Namespace Name Mixin selector
      named DEFAULT_FONT_ID Lnet/minecraft/text/Style;DEFAULT_FONT_ID:Lnet/minecraft/util/Identifier;
      intermediary field_24359 Lnet/minecraft/class_2583;field_24359:Lnet/minecraft/class_2960;
      official b Lys;b:Lalz;
    • color

      Mappings:
      Namespace Name Mixin selector
      named color Lnet/minecraft/text/Style;color:Lnet/minecraft/text/TextColor;
      intermediary field_11855 Lnet/minecraft/class_2583;field_11855:Lnet/minecraft/class_5251;
      official c Lys;c:Lyu;
    • bold

      Mappings:
      Namespace Name Mixin selector
      named bold Lnet/minecraft/text/Style;bold:Ljava/lang/Boolean;
      intermediary field_11856 Lnet/minecraft/class_2583;field_11856:Ljava/lang/Boolean;
      official d Lys;d:Ljava/lang/Boolean;
    • italic

      @Nullable final @Nullable Boolean italic
      Mappings:
      Namespace Name Mixin selector
      named italic Lnet/minecraft/text/Style;italic:Ljava/lang/Boolean;
      intermediary field_11852 Lnet/minecraft/class_2583;field_11852:Ljava/lang/Boolean;
      official e Lys;e:Ljava/lang/Boolean;
    • underlined

      @Nullable final @Nullable Boolean underlined
      Mappings:
      Namespace Name Mixin selector
      named underlined Lnet/minecraft/text/Style;underlined:Ljava/lang/Boolean;
      intermediary field_11851 Lnet/minecraft/class_2583;field_11851:Ljava/lang/Boolean;
      official f Lys;f:Ljava/lang/Boolean;
    • strikethrough

      @Nullable final @Nullable Boolean strikethrough
      Mappings:
      Namespace Name Mixin selector
      named strikethrough Lnet/minecraft/text/Style;strikethrough:Ljava/lang/Boolean;
      intermediary field_11857 Lnet/minecraft/class_2583;field_11857:Ljava/lang/Boolean;
      official g Lys;g:Ljava/lang/Boolean;
    • obfuscated

      @Nullable final @Nullable Boolean obfuscated
      Mappings:
      Namespace Name Mixin selector
      named obfuscated Lnet/minecraft/text/Style;obfuscated:Ljava/lang/Boolean;
      intermediary field_11861 Lnet/minecraft/class_2583;field_11861:Ljava/lang/Boolean;
      official h Lys;h:Ljava/lang/Boolean;
    • clickEvent

      @Nullable final @Nullable ClickEvent clickEvent
      Mappings:
      Namespace Name Mixin selector
      named clickEvent Lnet/minecraft/text/Style;clickEvent:Lnet/minecraft/text/ClickEvent;
      intermediary field_11853 Lnet/minecraft/class_2583;field_11853:Lnet/minecraft/class_2558;
      official i Lys;i:Lxt;
    • hoverEvent

      @Nullable final @Nullable HoverEvent hoverEvent
      Mappings:
      Namespace Name Mixin selector
      named hoverEvent Lnet/minecraft/text/Style;hoverEvent:Lnet/minecraft/text/HoverEvent;
      intermediary field_11858 Lnet/minecraft/class_2583;field_11858:Lnet/minecraft/class_2568;
      official j Lys;j:Lyb;
    • insertion

      @Nullable final @Nullable String insertion
      Mappings:
      Namespace Name Mixin selector
      named insertion Lnet/minecraft/text/Style;insertion:Ljava/lang/String;
      intermediary field_11859 Lnet/minecraft/class_2583;field_11859:Ljava/lang/String;
      official k Lys;k:Ljava/lang/String;
    • font

      Mappings:
      Namespace Name Mixin selector
      named font Lnet/minecraft/text/Style;font:Lnet/minecraft/util/Identifier;
      intermediary field_24361 Lnet/minecraft/class_2583;field_24361:Lnet/minecraft/class_2960;
      official l Lys;l:Lalz;
  • Constructor Details

  • Method Details

    • of

      private static Style of(Optional<TextColor> color, Optional<Boolean> bold, Optional<Boolean> italic, Optional<Boolean> underlined, Optional<Boolean> strikethrough, Optional<Boolean> obfuscated, Optional<ClickEvent> optional, Optional<HoverEvent> optional2, Optional<String> optional3, Optional<Identifier> optional4)
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/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;)Lnet/minecraft/text/Style;
      intermediary method_43870 Lnet/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;)Lnet/minecraft/class_2583;
      official a Lys;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;)Lys;
    • getColor

      @Nullable public @Nullable TextColor getColor()
      Returns the color of this style.
      Mappings:
      Namespace Name Mixin selector
      named getColor Lnet/minecraft/text/Style;getColor()Lnet/minecraft/text/TextColor;
      intermediary method_10973 Lnet/minecraft/class_2583;method_10973()Lnet/minecraft/class_5251;
      official a Lys;a()Lyu;
    • isBold

      public boolean isBold()
      Returns whether the style has bold formatting.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named isBold Lnet/minecraft/text/Style;isBold()Z
      intermediary method_10984 Lnet/minecraft/class_2583;method_10984()Z
      official b Lys;b()Z
    • isItalic

      public boolean isItalic()
      Returns whether the style has italic formatting.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named isItalic Lnet/minecraft/text/Style;isItalic()Z
      intermediary method_10966 Lnet/minecraft/class_2583;method_10966()Z
      official c Lys;c()Z
    • isStrikethrough

      public boolean isStrikethrough()
      Returns whether the style has strikethrough formatting.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named isStrikethrough Lnet/minecraft/text/Style;isStrikethrough()Z
      intermediary method_10986 Lnet/minecraft/class_2583;method_10986()Z
      official d Lys;d()Z
    • isUnderlined

      public boolean isUnderlined()
      Returns whether the style has underline formatting.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named isUnderlined Lnet/minecraft/text/Style;isUnderlined()Z
      intermediary method_10965 Lnet/minecraft/class_2583;method_10965()Z
      official e Lys;e()Z
    • isObfuscated

      public boolean isObfuscated()
      Returns whether the style has obfuscated formatting.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named isObfuscated Lnet/minecraft/text/Style;isObfuscated()Z
      intermediary method_10987 Lnet/minecraft/class_2583;method_10987()Z
      official f Lys;f()Z
    • isEmpty

      public boolean isEmpty()
      Returns if this is the empty style.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named isEmpty Lnet/minecraft/text/Style;isEmpty()Z
      intermediary method_10967 Lnet/minecraft/class_2583;method_10967()Z
      official g Lys;g()Z
    • getClickEvent

      @Nullable public @Nullable ClickEvent getClickEvent()
      Returns the click event of this style.
      Mappings:
      Namespace Name Mixin selector
      named getClickEvent Lnet/minecraft/text/Style;getClickEvent()Lnet/minecraft/text/ClickEvent;
      intermediary method_10970 Lnet/minecraft/class_2583;method_10970()Lnet/minecraft/class_2558;
      official h Lys;h()Lxt;
    • getHoverEvent

      @Nullable public @Nullable HoverEvent getHoverEvent()
      Returns the hover event of this style.
      Mappings:
      Namespace Name Mixin selector
      named getHoverEvent Lnet/minecraft/text/Style;getHoverEvent()Lnet/minecraft/text/HoverEvent;
      intermediary method_10969 Lnet/minecraft/class_2583;method_10969()Lnet/minecraft/class_2568;
      official i Lys;i()Lyb;
    • getInsertion

      @Nullable public @Nullable String 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 getInsertion Lnet/minecraft/text/Style;getInsertion()Ljava/lang/String;
      intermediary method_10955 Lnet/minecraft/class_2583;method_10955()Ljava/lang/String;
      official j Lys;j()Ljava/lang/String;
    • getFont

      public Identifier getFont()
      Returns the font of this style.
      Mappings:
      Namespace Name Mixin selector
      named getFont Lnet/minecraft/text/Style;getFont()Lnet/minecraft/util/Identifier;
      intermediary method_27708 Lnet/minecraft/class_2583;method_27708()Lnet/minecraft/class_2960;
      official k Lys;k()Lalz;
    • with

      private static <T> Style with(Style newStyle, @Nullable T oldAttribute, @Nullable T newAttribute)
      Mappings:
      Namespace Name Mixin selector
      named with Lnet/minecraft/text/Style;with(Lnet/minecraft/text/Style;Ljava/lang/Object;Ljava/lang/Object;)Lnet/minecraft/text/Style;
      intermediary method_54210 Lnet/minecraft/class_2583;method_54210(Lnet/minecraft/class_2583;Ljava/lang/Object;Ljava/lang/Object;)Lnet/minecraft/class_2583;
      official a Lys;a(Lys;Ljava/lang/Object;Ljava/lang/Object;)Lys;
    • withColor

      public Style withColor(@Nullable @Nullable TextColor color)
      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 withColor Lnet/minecraft/text/Style;withColor(Lnet/minecraft/text/TextColor;)Lnet/minecraft/text/Style;
      intermediary method_27703 Lnet/minecraft/class_2583;method_27703(Lnet/minecraft/class_5251;)Lnet/minecraft/class_2583;
      official a Lys;a(Lyu;)Lys;
    • withColor

      public Style withColor(@Nullable @Nullable Formatting color)
      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 withColor Lnet/minecraft/text/Style;withColor(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;
      intermediary method_10977 Lnet/minecraft/class_2583;method_10977(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;
      official a Lys;a(Ln;)Lys;
    • withColor

      public Style withColor(int rgbColor)
      Mappings:
      Namespace Name Mixin selector
      named withColor Lnet/minecraft/text/Style;withColor(I)Lnet/minecraft/text/Style;
      intermediary method_36139 Lnet/minecraft/class_2583;method_36139(I)Lnet/minecraft/class_2583;
      official a Lys;a(I)Lys;
    • withBold

      public Style withBold(@Nullable @Nullable Boolean bold)
      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
      named withBold Lnet/minecraft/text/Style;withBold(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;
      intermediary method_10982 Lnet/minecraft/class_2583;method_10982(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;
      official a Lys;a(Ljava/lang/Boolean;)Lys;
    • withItalic

      public Style withItalic(@Nullable @Nullable Boolean italic)
      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 withItalic Lnet/minecraft/text/Style;withItalic(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;
      intermediary method_10978 Lnet/minecraft/class_2583;method_10978(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;
      official b Lys;b(Ljava/lang/Boolean;)Lys;
    • withUnderline

      public Style withUnderline(@Nullable @Nullable Boolean underline)
      Returns a new style with the underline attribute provided and all other attributes of this style.
      Mappings:
      Namespace Name Mixin selector
      named withUnderline Lnet/minecraft/text/Style;withUnderline(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;
      intermediary method_30938 Lnet/minecraft/class_2583;method_30938(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;
      official c Lys;c(Ljava/lang/Boolean;)Lys;
    • withStrikethrough

      public Style withStrikethrough(@Nullable @Nullable Boolean strikethrough)
      Mappings:
      Namespace Name Mixin selector
      named withStrikethrough Lnet/minecraft/text/Style;withStrikethrough(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;
      intermediary method_36140 Lnet/minecraft/class_2583;method_36140(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;
      official d Lys;d(Ljava/lang/Boolean;)Lys;
    • withObfuscated

      public Style withObfuscated(@Nullable @Nullable Boolean obfuscated)
      Mappings:
      Namespace Name Mixin selector
      named withObfuscated Lnet/minecraft/text/Style;withObfuscated(Ljava/lang/Boolean;)Lnet/minecraft/text/Style;
      intermediary method_36141 Lnet/minecraft/class_2583;method_36141(Ljava/lang/Boolean;)Lnet/minecraft/class_2583;
      official e Lys;e(Ljava/lang/Boolean;)Lys;
    • withClickEvent

      public Style withClickEvent(@Nullable @Nullable ClickEvent clickEvent)
      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 withClickEvent Lnet/minecraft/text/Style;withClickEvent(Lnet/minecraft/text/ClickEvent;)Lnet/minecraft/text/Style;
      intermediary method_10958 Lnet/minecraft/class_2583;method_10958(Lnet/minecraft/class_2558;)Lnet/minecraft/class_2583;
      official a Lys;a(Lxt;)Lys;
    • withHoverEvent

      public Style withHoverEvent(@Nullable @Nullable HoverEvent hoverEvent)
      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 withHoverEvent Lnet/minecraft/text/Style;withHoverEvent(Lnet/minecraft/text/HoverEvent;)Lnet/minecraft/text/Style;
      intermediary method_10949 Lnet/minecraft/class_2583;method_10949(Lnet/minecraft/class_2568;)Lnet/minecraft/class_2583;
      official a Lys;a(Lyb;)Lys;
    • withInsertion

      public Style withInsertion(@Nullable @Nullable String insertion)
      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 withInsertion Lnet/minecraft/text/Style;withInsertion(Ljava/lang/String;)Lnet/minecraft/text/Style;
      intermediary method_10975 Lnet/minecraft/class_2583;method_10975(Ljava/lang/String;)Lnet/minecraft/class_2583;
      official a Lys;a(Ljava/lang/String;)Lys;
    • withFont

      public Style withFont(@Nullable @Nullable Identifier font)
      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 withFont Lnet/minecraft/text/Style;withFont(Lnet/minecraft/util/Identifier;)Lnet/minecraft/text/Style;
      intermediary method_27704 Lnet/minecraft/class_2583;method_27704(Lnet/minecraft/class_2960;)Lnet/minecraft/class_2583;
      official a Lys;a(Lalz;)Lys;
    • withFormatting

      public Style withFormatting(Formatting formatting)
      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 withFormatting Lnet/minecraft/text/Style;withFormatting(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;
      intermediary method_27706 Lnet/minecraft/class_2583;method_27706(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;
      official b Lys;b(Ln;)Lys;
    • withExclusiveFormatting

      public Style withExclusiveFormatting(Formatting formatting)
      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 withExclusiveFormatting Lnet/minecraft/text/Style;withExclusiveFormatting(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;
      intermediary method_27707 Lnet/minecraft/class_2583;method_27707(Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;
      official c Lys;c(Ln;)Lys;
    • withFormatting

      public Style withFormatting(Formatting[] formattings)
      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 withFormatting Lnet/minecraft/text/Style;withFormatting([Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/Style;
      intermediary method_27705 Lnet/minecraft/class_2583;method_27705([Lnet/minecraft/class_124;)Lnet/minecraft/class_2583;
      official a Lys;a([Ln;)Lys;
    • withParent

      public Style withParent(Style parent)
      Returns a new style with the undefined attributes of this style filled by the parent style.
      Parameters:
      parent - the parent style
      Mappings:
      Namespace Name Mixin selector
      named withParent Lnet/minecraft/text/Style;withParent(Lnet/minecraft/text/Style;)Lnet/minecraft/text/Style;
      intermediary method_27702 Lnet/minecraft/class_2583;method_27702(Lnet/minecraft/class_2583;)Lnet/minecraft/class_2583;
      official a Lys;a(Lys;)Lys;
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      Mappings:
      Namespace Name Mixin selector
      named equals Lnet/minecraft/text/Style;equals(Ljava/lang/Object;)Z
      intermediary equals Lnet/minecraft/class_2583;equals(Ljava/lang/Object;)Z
      official equals Lys;equals(Ljava/lang/Object;)Z
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object