Interface Style.Builder
- All Superinterfaces:
AbstractBuilder<Style>, MutableStyleSetter<Style.Builder>, StyleSetter<Style.Builder>
- Enclosing interface:
Style
public static sealed interface Style.Builder
extends AbstractBuilder<Style>, MutableStyleSetter<Style.Builder>
A style builder.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault Style.Builderapply(StyleBuilderApplicable applicable) Appliesapplicableto this builder.build()Builds the style.clickEvent(@Nullable ClickEvent<?> event) Sets the click event.Sets the color.colorIfAbsent(@Nullable TextColor color) Sets the color if there isn't one set already.default Style.Builderdecorate(TextDecoration decoration) SetsdecorationtoTextDecoration.State.TRUE.default Style.Builderdecorate(TextDecoration... decorations) SetsdecorationstoTextDecoration.State.TRUE.default Style.Builderdecoration(TextDecoration decoration, boolean flag) Sets the state of a decoration on this style.decoration(TextDecoration decoration, TextDecoration.State state) Sets the value of a decoration.decorationIfAbsent(TextDecoration decoration, TextDecoration.State state) Sets the state of a decoration on this style tostateif the current state of the decoration isTextDecoration.State.NOT_SET.default Style.Builderdecorations(Map<TextDecoration, TextDecoration.State> decorations) Sets decorations for this style using the specifieddecorationsmap.Sets the font.hoverEvent(@Nullable HoverEventSource<?> source) Sets the hover event.Sets the string to be inserted.default Style.BuilderMerges from another style into this style.default Style.Buildermerge(Style that, Set<Style.Merge> merges) Merges from another style into this style.default Style.Buildermerge(Style that, Style.Merge... merges) Merges from another style into this style.default Style.Buildermerge(Style that, Style.Merge.Strategy strategy) Merges from another style into this style.merge(Style that, Style.Merge.Strategy strategy, Set<Style.Merge> merges) Merges from another style into this style.default Style.Buildermerge(Style that, Style.Merge.Strategy strategy, Style.Merge... merges) Merges from another style into this style.Methods inherited from interface MutableStyleSetter
decorationsMethods inherited from interface StyleSetter
shadowColor, shadowColorIfAbsent
-
Method Details
-
font
Sets the font.- Specified by:
fontin interfaceStyleSetter<Style.Builder>- Parameters:
font- the font- Returns:
- this builder
- Since:
- 4.0.0
- Since Minecraft:
- 1.16
-
color
Sets the color.- Specified by:
colorin interfaceStyleSetter<Style.Builder>- Parameters:
color- the color- Returns:
- this builder
- Since:
- 4.0.0
-
colorIfAbsent
Sets the color if there isn't one set already.- Specified by:
colorIfAbsentin interfaceStyleSetter<Style.Builder>- Parameters:
color- the color- Returns:
- this builder
- Since:
- 4.0.0
-
decorate
SetsdecorationtoTextDecoration.State.TRUE.- Specified by:
decoratein interfaceStyleSetter<Style.Builder>- Parameters:
decoration- the decoration- Returns:
- a style
- Since:
- 4.0.0
-
decorate
SetsdecorationstoTextDecoration.State.TRUE.- Specified by:
decoratein interfaceMutableStyleSetter<Style.Builder>- Specified by:
decoratein interfaceStyleSetter<Style.Builder>- Parameters:
decorations- the decorations- Returns:
- a style
- Since:
- 4.0.0
-
decoration
Sets the state of a decoration on this style.- Specified by:
decorationin interfaceStyleSetter<Style.Builder>- Parameters:
decoration- the decorationflag-trueif this style should have the decoration,falseif this style should not have the decoration- Returns:
- a style
- Since:
- 4.0.0
-
decorations
@Contract("_ -> this") default Style.Builder decorations(Map<TextDecoration, TextDecoration.State> decorations) Sets decorations for this style using the specifieddecorationsmap.If a given decoration does not have a value explicitly set, the value of that particular decoration is not changed.
- Specified by:
decorationsin interfaceMutableStyleSetter<Style.Builder>- Specified by:
decorationsin interfaceStyleSetter<Style.Builder>- Parameters:
decorations- a map containing text decorations and their respective state.- Returns:
- this builder.
- Since:
- 4.10.0
-
decoration
@Contract("_, _ -> this") Style.Builder decoration(TextDecoration decoration, TextDecoration.State state) Sets the value of a decoration.- Specified by:
decorationin interfaceStyleSetter<Style.Builder>- Parameters:
decoration- the decorationstate-TextDecoration.State.TRUEif this component should have the decoration,TextDecoration.State.FALSEif this component should not have the decoration, andTextDecoration.State.NOT_SETif the decoration should not have a set value- Returns:
- this builder
- Since:
- 4.0.0
-
decorationIfAbsent
@Contract("_, _ -> this") Style.Builder decorationIfAbsent(TextDecoration decoration, TextDecoration.State state) Sets the state of a decoration on this style tostateif the current state of the decoration isTextDecoration.State.NOT_SET.- Specified by:
decorationIfAbsentin interfaceStyleSetter<Style.Builder>- Parameters:
decoration- the decorationstate- the state- Returns:
- this builder
- Since:
- 4.12.0
-
clickEvent
Sets the click event.- Specified by:
clickEventin interfaceStyleSetter<Style.Builder>- Parameters:
event- the click event- Returns:
- this builder
- Since:
- 4.0.0
-
hoverEvent
Sets the hover event.- Specified by:
hoverEventin interfaceStyleSetter<Style.Builder>- Parameters:
source- the hover event source- Returns:
- this builder
- Since:
- 4.0.0
-
insertion
Sets the string to be inserted.- Specified by:
insertionin interfaceStyleSetter<Style.Builder>- Parameters:
insertion- the insertion string- Returns:
- this builder
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other style- Returns:
- this builder
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other stylestrategy- the merge strategy- Returns:
- this builder
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other stylemerges- the parts to merge- Returns:
- this builder
- Since:
- 4.0.0
-
merge
@Contract("_, _, _ -> this") default Style.Builder merge(Style that, Style.Merge.Strategy strategy, Style.Merge... merges) Merges from another style into this style.- Parameters:
that- the other stylestrategy- the merge strategymerges- the parts to merge- Returns:
- this builder
- Since:
- 4.0.0
-
merge
Merges from another style into this style.- Parameters:
that- the other stylemerges- the parts to merge- Returns:
- this builder
- Since:
- 4.0.0
-
merge
@Contract("_, _, _ -> this") Style.Builder merge(Style that, Style.Merge.Strategy strategy, Set<Style.Merge> merges) Merges from another style into this style.- Parameters:
that- the other stylestrategy- the merge strategymerges- the parts to merge- Returns:
- this builder
- Since:
- 4.0.0
-
apply
Appliesapplicableto this builder.- Parameters:
applicable- the applicable- Returns:
- this builder
- Since:
- 4.0.0
-
build
Style build()Builds the style.- Specified by:
buildin interfaceAbstractBuilder<Style>- Returns:
- the style
-