Package net.kyori.adventure.text
Interface ComponentBuilder<C extends BuildableComponent<C,B>,B extends ComponentBuilder<C,B>>
- Type Parameters:
- C- the component type
- B- the builder type
- All Superinterfaces:
- Buildable.Builder<C>,- ComponentBuilderApplicable,- ComponentLike
- All Known Subinterfaces:
- BlockNBTComponent.Builder,- EntityNBTComponent.Builder,- KeybindComponent.Builder,- NBTComponentBuilder<C,B>,- ScoreComponent.Builder,- SelectorComponent.Builder,- StorageNBTComponent.Builder,- TextComponent.Builder,- TranslatableComponent.Builder
public interface ComponentBuilder<C extends BuildableComponent<C,B>,B extends ComponentBuilder<C,B>> extends Buildable.Builder<C>, ComponentBuilderApplicable, ComponentLike
A component builder.
- Since:
- 4.0.0
- 
Method SummaryModifier and Type Method Description @NonNull Bappend(@NonNull Iterable<? extends ComponentLike> components)Appends components to this component.@NonNull Bappend(@NonNull Component component)Appends a component to this component.@NonNull Bappend(@NonNull Component @NonNull ... components)Appends components to this component.default @NonNull Bappend(@NonNull ComponentBuilder<?,?> builder)Appends a component to this component.default @NonNull Bappend(@NonNull ComponentLike component)Appends a component to this component.@NonNull Bappend(@NonNull ComponentLike @NonNull ... components)Appends components to this component.default @NonNull BapplicableApply(@NonNull ComponentBuilderApplicable applicable)Appliesapplicable.default @NonNull Bapply(@NonNull Consumer<? super ComponentBuilder<?,?>> consumer)Applies an action to this builder.@NonNull BapplyDeep(@NonNull Consumer<? super ComponentBuilder<?,?>> action)Applies an action to this component and all child components if they are an instance ofBuildableComponent.default @NonNull ComponentasComponent()Gets aComponentrepresentation.@NonNull Cbuild()Build a component.@NonNull BclickEvent(@Nullable ClickEvent event)Sets the click event of this component.@NonNull Bcolor(@Nullable TextColor color)Sets the color of this component.@NonNull BcolorIfAbsent(@Nullable TextColor color)Sets the color of this component if there isn't one set already.default voidcomponentBuilderApply(@NonNull ComponentBuilder<?,?> component)Applies tocomponent.default @NonNull Bdecorate(@NonNull TextDecoration decoration)Sets the state ofdecorationtoTextDecoration.State.TRUE.default @NonNull Bdecorate(@NonNull TextDecoration @NonNull ... decorations)SetsdecorationstoTextDecoration.State.TRUE.default @NonNull Bdecoration(@NonNull TextDecoration decoration, boolean flag)Sets the state of a decoration on this component.@NonNull Bdecoration(@NonNull TextDecoration decoration, @NonNull TextDecoration.State state)Sets the value of a decoration on this component.default @NonNull Bdecorations(@NonNull Set<TextDecoration> decorations, boolean flag)Sets the state of a set of decorations toflagon this component.@NonNull Bfont(@Nullable Key font)Sets the font of this component.@NonNull BhoverEvent(@Nullable HoverEventSource<?> source)Sets the hover event of this component.@NonNull Binsertion(@Nullable String insertion)Sets the string to be inserted when this component is shift-clicked.@NonNull BmapChildren(@NonNull Function<BuildableComponent<?,?>,? extends BuildableComponent<?,?>> function)Replaces each child of this component with the resultant component from the function.@NonNull BmapChildrenDeep(@NonNull Function<BuildableComponent<?,?>,? extends BuildableComponent<?,?>> function)Replaces each child and sub-child of this component with the resultant component of the function.default @NonNull BmergeStyle(@NonNull Component that)Merges styling from another component into this component.@NonNull BmergeStyle(@NonNull Component that, @NonNull Set<Style.Merge> merges)Merges styling from another component into this component.default @NonNull BmergeStyle(@NonNull Component that, @NonNull Style.Merge @NonNull ... merges)Merges styling from another component into this component.@NonNull BresetStyle()Resets all styling on this component.@NonNull Bstyle(@NonNull Consumer<Style.Builder> consumer)Configures the style.@NonNull Bstyle(@NonNull Style style)Sets the style.
- 
Method Details- 
appendAppends a component to this component.- Parameters:
- component- the component to append
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
appendAppends a component to this component.- Parameters:
- component- the component to append
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
appendAppends a component to this component.- Parameters:
- builder- the component to append
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
appendAppends components to this component.- Parameters:
- components- the components to append
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
appendAppends components to this component.- Parameters:
- components- the components to append
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
appendAppends components to this component.- Parameters:
- components- the components to append
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
applyApplies an action to this builder.- Parameters:
- consumer- the action
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
applyDeepApplies an action to this component and all child components if they are an instance ofBuildableComponent.- Parameters:
- action- the action
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
mapChildren@NonNull B mapChildren(@NonNull Function<BuildableComponent<?,?>,? extends BuildableComponent<?,?>> function)Replaces each child of this component with the resultant component from the function.- Parameters:
- function- the mapping function
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
mapChildrenDeep@NonNull B mapChildrenDeep(@NonNull Function<BuildableComponent<?,?>,? extends BuildableComponent<?,?>> function)Replaces each child and sub-child of this component with the resultant component of the function.- Parameters:
- function- the mapping function
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
styleSets the style.- Parameters:
- style- the style
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
styleConfigures the style.- Parameters:
- consumer- the style consumer
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
fontSets the font of this component.- Parameters:
- font- the font
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
colorSets the color of this component.- Parameters:
- color- the color
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
colorIfAbsentSets the color of this component if there isn't one set already.- Parameters:
- color- the color
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
decorationsSets the state of a set of decorations toflagon this component.- Parameters:
- decorations- the decorations
- flag-- trueif this component should have the decorations,- falseif this component should not have the decorations
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
decorateSets the state ofdecorationtoTextDecoration.State.TRUE.- Parameters:
- decoration- the decoration
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
decorateSetsdecorationstoTextDecoration.State.TRUE.- Parameters:
- decorations- the decorations
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
decorationSets the state of a decoration on this component.- Parameters:
- decoration- the decoration
- flag-- trueif this component should have the decoration,- falseif this component should not have the decoration
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
decorationSets the value of a decoration on this component.- Parameters:
- decoration- the decoration
- state-- TextDecoration.State.TRUEif this component should have the decoration,- TextDecoration.State.FALSEif this component should not have the decoration, and- TextDecoration.State.NOT_SETif the decoration should not have a set value
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
clickEventSets the click event of this component.- Parameters:
- event- the click event
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
hoverEventSets the hover event of this component.- Parameters:
- source- the hover event source
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
insertionSets the string to be inserted when this component is shift-clicked.- Parameters:
- insertion- the insertion string
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
mergeStyleMerges styling from another component into this component.- Parameters:
- that- the other component
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
mergeStyleMerges styling from another component into this component.- Parameters:
- that- the other component
- merges- the parts to merge
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
mergeStyleMerges styling from another component into this component.- Parameters:
- that- the other component
- merges- the parts to merge
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
resetStyle@NonNull B resetStyle()Resets all styling on this component.- Returns:
- this builder
- Since:
- 4.0.0
 
- 
build@NonNull C build()Build a component.- Specified by:
- buildin interface- Buildable.Builder<C extends BuildableComponent<C,B>>
- Returns:
- the component
 
- 
applicableApplyAppliesapplicable.- Parameters:
- applicable- the thing to apply
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
componentBuilderApplyDescription copied from interface:ComponentBuilderApplicableApplies tocomponent.- Specified by:
- componentBuilderApplyin interface- ComponentBuilderApplicable
- Parameters:
- component- the component builder
 
- 
asComponentDescription copied from interface:ComponentLikeGets aComponentrepresentation.- Specified by:
- asComponentin interface- ComponentLike
- Returns:
- a component
 
 
-