Package net.kyori.adventure.text
Interface Component
- All Superinterfaces:
- ComponentBuilderApplicable,- ComponentLike,- net.kyori.examination.Examinable,- HoverEventSource<Component>
- All Known Subinterfaces:
- BlockNBTComponent,- BuildableComponent<C,B>,- EntityNBTComponent,- KeybindComponent,- NBTComponent<C,B>,- ScopedComponent<C>,- ScoreComponent,- SelectorComponent,- StorageNBTComponent,- TextComponent,- TranslatableComponent
- All Known Implementing Classes:
- AbstractComponent
public interface Component extends ComponentBuilderApplicable, ComponentLike, net.kyori.examination.Examinable, HoverEventSource<Component>
A component.
- Since:
- 4.0.0
- See Also:
- BlockNBTComponent,- EntityNBTComponent,- KeybindComponent,- ScoreComponent,- SelectorComponent,- StorageNBTComponent,- TextComponent,- TranslatableComponent
- 
Method SummaryModifier and Type Method Description @NonNull Componentappend(@NonNull Component component)Appends a component to this component.default @NonNull Componentappend(@NonNull ComponentBuilder<?,?> builder)Appends a component to this component.default @NonNull Componentappend(@NonNull ComponentLike component)Appends a component to this component.default @NonNull ComponentasComponent()Gets aComponentrepresentation.default @NonNull HoverEvent<Component>asHoverEvent(@NonNull UnaryOperator<Component> op)Creates a hover event with value derived from this object.static @NonNull BlockNBTComponent.BuilderblockNBT()Creates a block NBT component builder.static @NonNull BlockNBTComponentblockNBT(@NonNull String nbtPath, boolean interpret, @NonNull BlockNBTComponent.Pos pos)Creates a block NBT component with a position.static @NonNull BlockNBTComponentblockNBT(@NonNull String nbtPath, @NonNull BlockNBTComponent.Pos pos)Creates a block NBT component with a position.static @NonNull BlockNBTComponentblockNBT(@NonNull Consumer<? super BlockNBTComponent.Builder> consumer)Creates a block NBT component by applying configuration fromconsumer.@NonNull List<Component>children()Gets the unmodifiable list of children.@NonNull Componentchildren(@NonNull List<? extends ComponentLike> children)Sets the list of children.default @Nullable ClickEventclickEvent()Gets the click event of this component.default @NonNull ComponentclickEvent(@Nullable ClickEvent event)Sets the click event of this component.default @Nullable TextColorcolor()Gets the color of this component.default @NonNull Componentcolor(@Nullable TextColor color)Sets the color of this component.default @NonNull ComponentcolorIfAbsent(@Nullable TextColor color)Sets the color if there isn't one set already.default voidcomponentBuilderApply(@NonNull ComponentBuilder<?,?> component)Applies tocomponent.default booleancontains(@NonNull Component that)Checks if this component contains a component.default @NonNull Componentdecorate(@NonNull TextDecoration decoration)Sets the state ofdecorationtoTextDecoration.State.TRUEon this component.default @NonNull TextDecoration.Statedecoration(@NonNull TextDecoration decoration)Gets the state of a decoration on this component.default @NonNull Componentdecoration(@NonNull TextDecoration decoration, boolean flag)Sets the state of a decoration on this component.default @NonNull Componentdecoration(@NonNull TextDecoration decoration, @NonNull TextDecoration.State state)Sets the value of a decoration on this component.default @NonNull Map<TextDecoration,TextDecoration.State>decorations()Gets a set of decorations this component has.default @NonNull Componentdecorations(@NonNull Map<TextDecoration,TextDecoration.State> decorations)Sets decorations for this component's style using the specifieddecorationsmap.default voiddetectCycle(@NonNull Component that)Prevents a cycle between this component and the provided component.static @NonNull TextComponentempty()Gets an empty component.static @NonNull EntityNBTComponent.BuilderentityNBT()Creates an entity NBT component builder.static @NonNull EntityNBTComponententityNBT(@NonNull String nbtPath, @NonNull String selector)Creates a entity NBT component with a position.static @NonNull EntityNBTComponententityNBT(@NonNull Consumer<? super EntityNBTComponent.Builder> consumer)Creates a entity NBT component by applying configuration fromconsumer.default booleanhasDecoration(@NonNull TextDecoration decoration)Tests if this component has a decoration.default booleanhasStyling()Tests if this component has any styling.default @Nullable HoverEvent<?>hoverEvent()Gets the hover event of this component.default @NonNull ComponenthoverEvent(@Nullable HoverEventSource<?> source)Sets the hover event of this component.default @Nullable Stringinsertion()Gets the string to be inserted when this component is shift-clicked.default @NonNull Componentinsertion(@Nullable String insertion)Sets the string to be inserted when this component is shift-clicked.static @NonNull TextComponentjoin(@NonNull ComponentLike separator, @NonNull ComponentLike @NonNull ... components)Joinscomponentsusingseparator.static @NonNull TextComponentjoin(@NonNull ComponentLike separator, Iterable<? extends ComponentLike> components)Joinscomponentsusingseparator.static @NonNull KeybindComponent.Builderkeybind()Creates a keybind component builder.static @NonNull KeybindComponentkeybind(@NonNull String keybind)Creates a keybind component with a keybind.static @NonNull KeybindComponentkeybind(@NonNull String keybind, @NonNull Style style)Creates a keybind component with a keybind and styling.static @NonNull KeybindComponentkeybind(@NonNull String keybind, @Nullable TextColor color)Creates a keybind component with a keybind, and optional color.static @NonNull KeybindComponentkeybind(@NonNull String keybind, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a keybind component with a keybind, and optional color and decorations.static @NonNull KeybindComponentkeybind(@NonNull String keybind, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a keybind component with a keybind, and optional color and decorations.static @NonNull KeybindComponentkeybind(@NonNull Consumer<? super KeybindComponent.Builder> consumer)Creates a keybind component by applying configuration fromconsumer.default @NonNull ComponentmergeStyle(@NonNull Component that)Merges from another style into this component's style.default @NonNull ComponentmergeStyle(@NonNull Component that, @NonNull Set<Style.Merge> merges)Merges from another style into this component's style.default @NonNull ComponentmergeStyle(@NonNull Component that, @NonNull Style.Merge @NonNull ... merges)Merges from another style into this component's style.static @NonNull TextComponentnewline()Gets a text component with a new line character as the content.default @NonNull ComponentreplaceFirstText(@NonNull String search, @Nullable ComponentLike replacement)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.default @NonNull ComponentreplaceFirstText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.default @NonNull ComponentreplaceText(@NonNull String search, @Nullable ComponentLike replacement)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.default @NonNull ComponentreplaceText(@NonNull String search, @Nullable ComponentLike replacement, int numberOfReplacements)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.default @NonNull ComponentreplaceText(@NonNull String search, @Nullable ComponentLike replacement, @NonNull IntFunction2<PatternReplacementResult> fn)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.@NonNull ComponentreplaceText(@NonNull Consumer<TextReplacementConfig.Builder> configurer)Finds and replaces any text with this or childComponents using the configured options.default @NonNull ComponentreplaceText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.default @NonNull ComponentreplaceText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement, int numberOfReplacements)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.default @NonNull ComponentreplaceText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement, @NonNull IntFunction2<PatternReplacementResult> fn)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.@NonNull ComponentreplaceText(@NonNull TextReplacementConfig config)Finds and replaces any text with this or childComponents using the provided options.static @NonNull ScoreComponent.Builderscore()Creates a score component builder.static @NonNull ScoreComponentscore(@NonNull String name, @NonNull String objective)Creates a score component with a name and objective.static @NonNull ScoreComponentscore(@NonNull String name, @NonNull String objective, @Nullable String value)Creates a score component with a name, objective, and optional value.static @NonNull ScoreComponentscore(@NonNull Consumer<? super ScoreComponent.Builder> consumer)Creates a score component by applying configuration fromconsumer.static @NonNull SelectorComponent.Builderselector()Creates a selector component builder.static @NonNull SelectorComponentselector(@NonNull String pattern)Creates a selector component with a pattern.static @NonNull SelectorComponentselector(@NonNull Consumer<? super SelectorComponent.Builder> consumer)Creates a selector component by applying configuration fromconsumer.static @NonNull TextComponentspace()Gets a text immutable component with a single space as the content.static @NonNull StorageNBTComponent.BuilderstorageNBT()Creates an storage NBT component builder.static @NonNull StorageNBTComponentstorageNBT(@NonNull String nbtPath, boolean interpret, @NonNull Key storage)Creates a storage NBT component with a path and an storage ID.static @NonNull StorageNBTComponentstorageNBT(@NonNull String nbtPath, @NonNull Key storage)Creates a storage NBT component with a path and an storage ID.static @NonNull StorageNBTComponentstorageNBT(@NonNull Consumer<? super StorageNBTComponent.Builder> consumer)Creates a storage NBT component by applying configuration fromconsumer.@NonNull Stylestyle()Gets the style of this component.default @NonNull Componentstyle(@NonNull Consumer<Style.Builder> consumer)Sets the style of this component.default @NonNull Componentstyle(@NonNull Consumer<Style.Builder> consumer, @NonNull Style.Merge.Strategy strategy)Sets the style of this component.@NonNull Componentstyle(@NonNull Style style)Sets the style of this component.default @NonNull Componentstyle(@NonNull Style.Builder style)Sets the style of this component.static @NonNull TextComponent.Buildertext()Creates a text component builder.static @NonNull TextComponenttext(boolean value)Creates a text component with the content ofString.valueOf(boolean).static @NonNull TextComponenttext(boolean value, @NonNull Style style)Creates a text component with the content ofString.valueOf(boolean)and styling.static @NonNull TextComponenttext(boolean value, @Nullable TextColor color)Creates a text component with the content ofString.valueOf(boolean), and optional color.static @NonNull TextComponenttext(boolean value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(boolean), and optional color and decorations.static @NonNull TextComponenttext(boolean value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(boolean), and optional color and decorations.static @NonNull TextComponenttext(char value)Creates a text component with the content ofString.valueOf(char).static @NonNull TextComponenttext(char value, @NonNull Style style)Creates a text component with the content ofString.valueOf(char)and styling.static @NonNull TextComponenttext(char value, @Nullable TextColor color)Creates a text component with the content ofString.valueOf(char), and optional color.static @NonNull TextComponenttext(char value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(char), and optional color and decorations.static @NonNull TextComponenttext(char value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(char), and optional color and decorations.static @NonNull TextComponenttext(double value)Creates a text component with the content ofString.valueOf(double).static @NonNull TextComponenttext(double value, @NonNull Style style)Creates a text component with the content ofString.valueOf(double)and styling.static @NonNull TextComponenttext(double value, @Nullable TextColor color)Creates a text component with the content ofString.valueOf(double), and optional color.static @NonNull TextComponenttext(double value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(double), and optional color and decorations.static @NonNull TextComponenttext(double value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(double), and optional color and decorations.static @NonNull TextComponenttext(float value)Creates a text component with the content ofString.valueOf(float).static @NonNull TextComponenttext(float value, @NonNull Style style)Creates a text component with the content ofString.valueOf(float)and styling.static @NonNull TextComponenttext(float value, @Nullable TextColor color)Creates a text component with the content ofString.valueOf(float), and optional color.static @NonNull TextComponenttext(float value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(float), and optional color and decorations.static @NonNull TextComponenttext(float value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(float), and optional color and decorations.static @NonNull TextComponenttext(int value)Creates a text component with the content ofString.valueOf(int).static @NonNull TextComponenttext(int value, @NonNull Style style)Creates a text component with the content ofString.valueOf(int)and styling.static @NonNull TextComponenttext(int value, @Nullable TextColor color)Creates a text component with the content ofString.valueOf(int), and optional color.static @NonNull TextComponenttext(int value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(int), and optional color and decorations.static @NonNull TextComponenttext(int value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(int), and optional color and decorations.static @NonNull TextComponenttext(long value)Creates a text component with the content ofString.valueOf(long).static @NonNull TextComponenttext(long value, @NonNull Style style)Creates a text component with the content ofString.valueOf(long)and styling.static @NonNull TextComponenttext(long value, @Nullable TextColor color)Creates a text component with the content ofString.valueOf(long), and optional color.static @NonNull TextComponenttext(long value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(long), and optional color and decorations.static @NonNull TextComponenttext(long value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(long), and optional color and decorations.static @NonNull TextComponenttext(@NonNull String content)Creates a text component with content.static @NonNull TextComponenttext(@NonNull String content, @NonNull Style style)Creates a text component with content and styling.static @NonNull TextComponenttext(@NonNull String content, @Nullable TextColor color)Creates a text component with content, and optional color.static @NonNull TextComponenttext(@NonNull String content, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with content, and optional color and decorations.static @NonNull TextComponenttext(@NonNull String content, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with content, and optional color and decorations.static @NonNull TextComponenttext(@NonNull Consumer<? super TextComponent.Builder> consumer)Creates a text component by applying configuration fromconsumer.static @NonNull TranslatableComponent.Buildertranslatable()Creates a translatable component builder.static @NonNull TranslatableComponenttranslatable(@NonNull String key)Creates a translatable component with a translation key.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @NonNull List<? extends ComponentLike> args)Creates a translatable component with a translation key and arguments.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @NonNull ComponentLike @NonNull ... args)Creates a translatable component with a translation key and arguments.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @NonNull Style style)Creates a translatable component with a translation key and styling.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @NonNull Style style, @NonNull List<? extends ComponentLike> args)Creates a translatable component with a translation key and styling.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @NonNull Style style, @NonNull ComponentLike @NonNull ... args)Creates a translatable component with a translation key and styling.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @Nullable TextColor color)Creates a translatable component with a translation key, and optional color.static TranslatableComponenttranslatable(@NonNull String key, @Nullable TextColor color, @NonNull List<? extends ComponentLike> args)Creates a translatable component with a translation key, arguments, and optional color.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a translatable component with a translation key, and optional color and decorations.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations, @NonNull List<? extends ComponentLike> args)Creates a translatable component with a translation key, arguments, and optional color and decorations.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations, @NonNull ComponentLike @NonNull ... args)Creates a translatable component with a translation key, arguments, and optional color and decorations.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @Nullable TextColor color, @NonNull ComponentLike @NonNull ... args)Creates a translatable component with a translation key, arguments, and optional color.static @NonNull TranslatableComponenttranslatable(@NonNull String key, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a translatable component with a translation key, and optional color and decorations.static @NonNull TranslatableComponenttranslatable(@NonNull Consumer<? super TranslatableComponent.Builder> consumer)Creates a translatable component by applying configuration fromconsumer.
- 
Method Details- 
emptyGets an empty component.- Returns:
- an empty component
- Since:
- 4.0.0
 
- 
newlineGets a text component with a new line character as the content.- Returns:
- a text component with a new line character as the content
- Since:
- 4.0.0
 
- 
spaceGets a text immutable component with a single space as the content.- Returns:
- a text component with a single space as the content
- Since:
- 4.0.0
 
- 
joinstatic @NonNull TextComponent join(@NonNull ComponentLike separator, @NonNull ComponentLike @NonNull ... components)Joinscomponentsusingseparator.- Parameters:
- separator- the separator
- components- the components
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
joinstatic @NonNull TextComponent join(@NonNull ComponentLike separator, Iterable<? extends ComponentLike> components)Joinscomponentsusingseparator.- Parameters:
- separator- the separator
- components- the components
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
blockNBTCreates a block NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
 
- 
blockNBTstatic @NonNull BlockNBTComponent blockNBT(@NonNull Consumer<? super BlockNBTComponent.Builder> consumer)Creates a block NBT component by applying configuration fromconsumer.- Parameters:
- consumer- the builder configurator
- Returns:
- a block NBT component
- Since:
- 4.0.0
 
- 
blockNBTstatic @NonNull BlockNBTComponent blockNBT(@NonNull String nbtPath, @NonNull BlockNBTComponent.Pos pos)Creates a block NBT component with a position.- Parameters:
- nbtPath- the nbt path
- pos- the block position
- Returns:
- a block NBT component
- Since:
- 4.0.0
 
- 
blockNBTstatic @NonNull BlockNBTComponent blockNBT(@NonNull String nbtPath, boolean interpret, @NonNull BlockNBTComponent.Pos pos)Creates a block NBT component with a position.- Parameters:
- nbtPath- the nbt path
- interpret- whether to interpret
- pos- the block position
- Returns:
- a block NBT component
- Since:
- 4.0.0
 
- 
entityNBTCreates an entity NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
 
- 
entityNBTstatic @NonNull EntityNBTComponent entityNBT(@NonNull Consumer<? super EntityNBTComponent.Builder> consumer)Creates a entity NBT component by applying configuration fromconsumer.- Parameters:
- consumer- the builder configurator
- Returns:
- an entity NBT component
- Since:
- 4.0.0
 
- 
entityNBTCreates a entity NBT component with a position.- Parameters:
- nbtPath- the nbt path
- selector- the selector
- Returns:
- an entity NBT component
- Since:
- 4.0.0
 
- 
keybindCreates a keybind component builder.- Returns:
- a builder
- Since:
- 4.0.0
 
- 
keybindstatic @NonNull KeybindComponent keybind(@NonNull Consumer<? super KeybindComponent.Builder> consumer)Creates a keybind component by applying configuration fromconsumer.- Parameters:
- consumer- the builder configurator
- Returns:
- the keybind component
- Since:
- 4.0.0
 
- 
keybindCreates a keybind component with a keybind.- Parameters:
- keybind- the keybind
- Returns:
- the keybind component
- Since:
- 4.0.0
 
- 
keybindCreates a keybind component with a keybind and styling.- Parameters:
- keybind- the keybind
- style- the style
- Returns:
- the keybind component
- Since:
- 4.0.0
 
- 
keybindCreates a keybind component with a keybind, and optional color.- Parameters:
- keybind- the keybind
- color- the color
- Returns:
- the keybind component
- Since:
- 4.0.0
 
- 
keybindstatic @NonNull KeybindComponent keybind(@NonNull String keybind, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
- keybind- the keybind
- color- the color
- decorations- the decorations
- Returns:
- the keybind component
- Since:
- 4.0.0
 
- 
keybindstatic @NonNull KeybindComponent keybind(@NonNull String keybind, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
- keybind- the keybind
- color- the color
- decorations- the decorations
- Returns:
- the keybind component
- Since:
- 4.0.0
 
- 
scoreCreates a score component builder.- Returns:
- a builder
- Since:
- 4.0.0
 
- 
scoreCreates a score component by applying configuration fromconsumer.- Parameters:
- consumer- the builder configurator
- Returns:
- a score component
- Since:
- 4.0.0
 
- 
scoreCreates a score component with a name and objective.- Parameters:
- name- the score name
- objective- the score objective
- Returns:
- a score component
- Since:
- 4.0.0
 
- 
scorestatic @NonNull ScoreComponent score(@NonNull String name, @NonNull String objective, @Nullable String value)Creates a score component with a name, objective, and optional value.- Parameters:
- name- the score name
- objective- the score objective
- value- the value
- Returns:
- a score component
- Since:
- 4.0.0
 
- 
selectorCreates a selector component builder.- Returns:
- a builder
- Since:
- 4.0.0
 
- 
selectorstatic @NonNull SelectorComponent selector(@NonNull Consumer<? super SelectorComponent.Builder> consumer)Creates a selector component by applying configuration fromconsumer.- Parameters:
- consumer- the builder configurator
- Returns:
- a selector component
- Since:
- 4.0.0
 
- 
selectorCreates a selector component with a pattern.- Parameters:
- pattern- the selector pattern
- Returns:
- a selector component
- Since:
- 4.0.0
 
- 
storageNBTCreates an storage NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
 
- 
storageNBTstatic @NonNull StorageNBTComponent storageNBT(@NonNull Consumer<? super StorageNBTComponent.Builder> consumer)Creates a storage NBT component by applying configuration fromconsumer.- Parameters:
- consumer- the builder configurator
- Returns:
- a storage NBT component
- Since:
- 4.0.0
 
- 
storageNBTCreates a storage NBT component with a path and an storage ID.- Parameters:
- nbtPath- the nbt path
- storage- the identifier of the storage
- Returns:
- a storage NBT component
- Since:
- 4.0.0
 
- 
storageNBTstatic @NonNull StorageNBTComponent storageNBT(@NonNull String nbtPath, boolean interpret, @NonNull Key storage)Creates a storage NBT component with a path and an storage ID.- Parameters:
- nbtPath- the nbt path
- interpret- whether to interpret
- storage- the identifier of the storage
- Returns:
- a storage NBT component
- Since:
- 4.0.0
 
- 
textCreates a text component builder.- Returns:
- a builder
- Since:
- 4.0.0
 
- 
textCreates a text component by applying configuration fromconsumer.- Parameters:
- consumer- the builder configurator
- Returns:
- the text component
- Since:
- 4.0.0
 
- 
textCreates a text component with content.- Parameters:
- content- the plain text content
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with content and styling.- Parameters:
- content- the plain text content
- style- the style
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with content, and optional color.- Parameters:
- content- the plain text content
- color- the color
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(@NonNull String content, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with content, and optional color and decorations.- Parameters:
- content- the plain text content
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(@NonNull String content, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with content, and optional color and decorations.- Parameters:
- content- the plain text content
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(boolean).- Parameters:
- value- the boolean value
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(boolean)and styling.- Parameters:
- value- the boolean value
- style- the style
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(boolean), and optional color.- Parameters:
- value- the boolean value
- color- the color
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(boolean value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(boolean), and optional color and decorations.- Parameters:
- value- the boolean value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(boolean value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(boolean), and optional color and decorations.- Parameters:
- value- the boolean value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(char).- Parameters:
- value- the char value
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(char)and styling.- Parameters:
- value- the char value
- style- the style
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(char), and optional color.- Parameters:
- value- the char value
- color- the color
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(char value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(char), and optional color and decorations.- Parameters:
- value- the char value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(char value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(char), and optional color and decorations.- Parameters:
- value- the char value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(double).- Parameters:
- value- the double value
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(double)and styling.- Parameters:
- value- the double value
- style- the style
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(double), and optional color.- Parameters:
- value- the double value
- color- the color
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(double value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(double), and optional color and decorations.- Parameters:
- value- the double value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(double value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(double), and optional color and decorations.- Parameters:
- value- the double value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(float).- Parameters:
- value- the float value
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(float)and styling.- Parameters:
- value- the float value
- style- the style
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(float), and optional color.- Parameters:
- value- the float value
- color- the color
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(float value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(float), and optional color and decorations.- Parameters:
- value- the float value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(float value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(float), and optional color and decorations.- Parameters:
- value- the float value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(int).- Parameters:
- value- the int value
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(int)and styling.- Parameters:
- value- the int value
- style- the style
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(int), and optional color.- Parameters:
- value- the int value
- color- the color
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(int value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(int), and optional color and decorations.- Parameters:
- value- the int value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(int value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(int), and optional color and decorations.- Parameters:
- value- the int value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(long).- Parameters:
- value- the long value
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(long)and styling.- Parameters:
- value- the long value
- style- the style
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textCreates a text component with the content ofString.valueOf(long), and optional color.- Parameters:
- value- the long value
- color- the color
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(long value, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a text component with the content ofString.valueOf(long), and optional color and decorations.- Parameters:
- value- the long value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
textstatic @NonNull TextComponent text(long value, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a text component with the content ofString.valueOf(long), and optional color and decorations.- Parameters:
- value- the long value
- color- the color
- decorations- the decorations
- Returns:
- a text component
- Since:
- 4.0.0
 
- 
translatableCreates a translatable component builder.- Returns:
- a builder
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull Consumer<? super TranslatableComponent.Builder> consumer)Creates a translatable component by applying configuration fromconsumer.- Parameters:
- consumer- the builder configurator
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatableCreates a translatable component with a translation key.- Parameters:
- key- the translation key
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatableCreates a translatable component with a translation key and styling.- Parameters:
- key- the translation key
- style- the style
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatableCreates a translatable component with a translation key, and optional color.- Parameters:
- key- the translation key
- color- the color
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @Nullable TextColor color, TextDecoration @NonNull ... decorations)Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
- key- the translation key
- color- the color
- decorations- the decorations
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations)Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
- key- the translation key
- color- the color
- decorations- the decorations
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @NonNull ComponentLike @NonNull ... args)Creates a translatable component with a translation key and arguments.- Parameters:
- key- the translation key
- args- the translation arguments
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @NonNull Style style, @NonNull ComponentLike @NonNull ... args)Creates a translatable component with a translation key and styling.- Parameters:
- key- the translation key
- style- the style
- args- the translation arguments
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @Nullable TextColor color, @NonNull ComponentLike @NonNull ... args)Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
- key- the translation key
- color- the color
- args- the translation arguments
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations, @NonNull ComponentLike @NonNull ... args)Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
- key- the translation key
- color- the color
- decorations- the decorations
- args- the translation arguments
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @NonNull List<? extends ComponentLike> args)Creates a translatable component with a translation key and arguments.- Parameters:
- key- the translation key
- args- the translation arguments
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @NonNull Style style, @NonNull List<? extends ComponentLike> args)Creates a translatable component with a translation key and styling.- Parameters:
- key- the translation key
- style- the style
- args- the translation arguments
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic TranslatableComponent translatable(@NonNull String key, @Nullable TextColor color, @NonNull List<? extends ComponentLike> args)Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
- key- the translation key
- color- the color
- args- the translation arguments
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
translatablestatic @NonNull TranslatableComponent translatable(@NonNull String key, @Nullable TextColor color, @NonNull Set<TextDecoration> decorations, @NonNull List<? extends ComponentLike> args)Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
- key- the translation key
- color- the color
- decorations- the decorations
- args- the translation arguments
- Returns:
- a translatable component
- Since:
- 4.0.0
 
- 
childrenGets the unmodifiable list of children.- Returns:
- the unmodifiable list of children
- Since:
- 4.0.0
 
- 
childrenSets the list of children.The contents of childrenwill be copied.- Parameters:
- children- the children
- Returns:
- a component with the children set
- Since:
- 4.0.0
 
- 
containsChecks if this component contains a component.- Parameters:
- that- the other component
- Returns:
- trueif this component contains the provided component,- falseotherwise
- Since:
- 4.0.0
 
- 
detectCyclePrevents a cycle between this component and the provided component.- Parameters:
- that- the other component
- Since:
- 4.0.0
 
- 
appendAppends a component to this component.- Parameters:
- component- the component to append
- Returns:
- a component with the component added
- Since:
- 4.0.0
 
- 
appendAppends a component to this component.- Parameters:
- component- the component to append
- Returns:
- a component with the component added
- Since:
- 4.0.0
 
- 
appendAppends a component to this component.- Parameters:
- builder- the component to append
- Returns:
- a component with the component added
- Since:
- 4.0.0
 
- 
style@NonNull Style style()Gets the style of this component.- Returns:
- the style of this component
- Since:
- 4.0.0
 
- 
styleSets the style of this component.- Parameters:
- style- the style
- Returns:
- a component
- Since:
- 4.0.0
 
- 
styleSets the style of this component.- Parameters:
- consumer- the style consumer
- Returns:
- a component
- Since:
- 4.0.0
 
- 
styledefault @NonNull Component style(@NonNull Consumer<Style.Builder> consumer, @NonNull Style.Merge.Strategy strategy)Sets the style of this component.- Parameters:
- consumer- the style consumer
- strategy- the merge strategy
- Returns:
- a component
- Since:
- 4.0.0
 
- 
styleSets the style of this component.- Parameters:
- style- the style
- Returns:
- a component
- Since:
- 4.0.0
 
- 
mergeStyleMerges from another style into this component's style.- Parameters:
- that- the other style
- Returns:
- a component
- Since:
- 4.0.0
 
- 
mergeStyledefault @NonNull Component mergeStyle(@NonNull Component that, @NonNull Style.Merge @NonNull ... merges)Merges from another style into this component's style.- Parameters:
- that- the other style
- merges- the style parts to merge
- Returns:
- a component
- Since:
- 4.0.0
 
- 
mergeStyleMerges from another style into this component's style.- Parameters:
- that- the other style
- merges- the style parts to merge
- Returns:
- a component
- Since:
- 4.0.0
 
- 
colorGets the color of this component.- Returns:
- the color of this component
- Since:
- 4.0.0
 
- 
colorSets the color of this component.- Parameters:
- color- the color
- Returns:
- a component
- Since:
- 4.0.0
 
- 
colorIfAbsentSets the color if there isn't one set already.- Parameters:
- color- the color
- Returns:
- this builder
- Since:
- 4.0.0
 
- 
hasDecorationTests if this component has a decoration.- Parameters:
- decoration- the decoration
- Returns:
- trueif this component has the decoration,- falseif this component does not have the decoration
- Since:
- 4.0.0
 
- 
decorateSets the state ofdecorationtoTextDecoration.State.TRUEon this component.- Parameters:
- decoration- the decoration
- Returns:
- a component
- Since:
- 4.0.0
 
- 
decorationGets the state of a decoration on this component.- Parameters:
- decoration- the decoration
- Returns:
- TextDecoration.State.TRUEif this component has the decoration,- TextDecoration.State.FALSEif this component does not have the decoration, and- TextDecoration.State.NOT_SETif not set
- 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:
- a component
- Since:
- 4.0.0
 
- 
decorationdefault @NonNull Component decoration(@NonNull TextDecoration decoration, @NonNull TextDecoration.State state)Sets 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:
- a component
- Since:
- 4.0.0
 
- 
decorationsGets a set of decorations this component has.- Returns:
- a set of decorations this component has
- Since:
- 4.0.0
 
- 
decorationsdefault @NonNull Component decorations(@NonNull Map<TextDecoration,TextDecoration.State> decorations)Sets decorations for this component's style using the specifieddecorationsmap.If a given decoration does not have a value explicitly set, the value of that particular decoration is not changed. - Parameters:
- decorations- a set of default values
- Returns:
- a component
- Since:
- 4.0.0
 
- 
clickEventGets the click event of this component.- Returns:
- the click event
- Since:
- 4.0.0
 
- 
clickEventSets the click event of this component.- Parameters:
- event- the click event
- Returns:
- a component
- Since:
- 4.0.0
 
- 
hoverEventGets the hover event of this component.- Returns:
- the hover event
- Since:
- 4.0.0
 
- 
hoverEventSets the hover event of this component.- Parameters:
- source- the hover event source
- Returns:
- a component
- Since:
- 4.0.0
 
- 
insertionGets the string to be inserted when this component is shift-clicked.- Returns:
- the insertion string
- Since:
- 4.0.0
 
- 
insertionSets the string to be inserted when this component is shift-clicked.- Parameters:
- insertion- the insertion string
- Returns:
- a component
- Since:
- 4.0.0
 
- 
hasStylingdefault boolean hasStyling()Tests if this component has any styling.- Returns:
- trueif this component has any styling,- falseif this component does not have any styling
- Since:
- 4.0.0
 
- 
replaceTextFinds and replaces any text with this or childComponents using the configured options.- Parameters:
- configurer- the configurer
- Returns:
- a modified copy of this component
- Since:
- 4.2.0
 
- 
replaceTextFinds and replaces any text with this or childComponents using the provided options.- Parameters:
- config- the replacement config
- Returns:
- a modified copy of this component
- Since:
- 4.2.0
 
- 
replaceText@Deprecated default @NonNull Component replaceText(@NonNull String search, @Nullable ComponentLike replacement)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.Finds and replaces text within anyComponents using a string literal.- Parameters:
- search- a string literal
- replacement- a- ComponentLiketo replace each match
- Returns:
- a modified copy of this component
- Since:
- 4.0.0
 
- 
replaceText@Deprecated default @NonNull Component replaceText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.Finds and replaces text within anyTextComponents using a regex pattern.- Parameters:
- pattern- a regex pattern
- replacement- a function to replace each match
- Returns:
- a modified copy of this component
- Since:
- 4.0.0
 
- 
replaceFirstText@Deprecated default @NonNull Component replaceFirstText(@NonNull String search, @Nullable ComponentLike replacement)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.Finds and replaces the first occurrence of text within anyComponents using a string literal.- Parameters:
- search- a string literal
- replacement- a- ComponentLiketo replace the first match
- Returns:
- a modified copy of this component
- Since:
- 4.0.0
 
- 
replaceFirstText@Deprecated default @NonNull Component replaceFirstText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.Finds and replaces the first occurrence of text within anyTextComponents using a regex pattern.- Parameters:
- pattern- a regex pattern
- replacement- a function to replace the first match
- Returns:
- a modified copy of this component
- Since:
- 4.0.0
 
- 
replaceText@Deprecated default @NonNull Component replaceText(@NonNull String search, @Nullable ComponentLike replacement, int numberOfReplacements)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.Finds and replacesninstances of text within anyTextComponents using a string literal.- Parameters:
- search- a string literal
- replacement- a- ComponentLiketo replace the first match
- numberOfReplacements- the amount of matches that should be replaced
- Returns:
- a modified copy of this component
- Since:
- 4.0.0
 
- 
replaceText@Deprecated default @NonNull Component replaceText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement, int numberOfReplacements)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.Finds and replacesninstances of text within anyTextComponents using a regex pattern.- Parameters:
- pattern- a regex pattern
- replacement- a function to replace each match
- numberOfReplacements- the amount of matches that should be replaced
- Returns:
- a modified copy of this component
- Since:
- 4.0.0
 
- 
replaceText@Deprecated default @NonNull Component replaceText(@NonNull String search, @Nullable ComponentLike replacement, @NonNull IntFunction2<PatternReplacementResult> fn)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.Finds and replacesninstances of text within anyTextComponents using a string literal.Utilises an IntFunction2to determine if each instance should be replaced.- Parameters:
- search- a string literal
- replacement- a- ComponentLiketo replace the first match
- fn- a function of (index, replaced) used to determine if matches should be replaced, where "replaced" is the number of successful replacements
- Returns:
- a modified copy of this component
- Since:
- 4.0.0
 
- 
replaceText@Deprecated default @NonNull Component replaceText(@NonNull Pattern pattern, @NonNull Function<TextComponent.Builder,@Nullable ComponentLike> replacement, @NonNull IntFunction2<PatternReplacementResult> fn)Deprecated.for removal since 4.2.0, usereplaceText(Consumer)orreplaceText(TextReplacementConfig)instead.Finds and replaces text using a regex pattern.Utilises an IntFunction2to determine if each instance should be replaced.- Parameters:
- pattern- a regex pattern
- replacement- a function to replace the first match
- fn- a function of (index, replaced) used to determine if matches should be replaced, where "replaced" is the number of successful replacements
- Returns:
- a modified copy of this component
- 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
 
- 
asHoverEventDescription copied from interface:HoverEventSourceCreates a hover event with value derived from this object.The event value will be passed through the provided callback to allow transforming the original value of the event. - Specified by:
- asHoverEventin interface- HoverEventSource<Component>
- Parameters:
- op- transformation on value
- Returns:
- a hover event
 
 
-