ComponentBuilder
A builder interface for creating and manipulating Adventure text components. Provides fluent API methods for appending content, styling, and collecting components.
Properties
Extension property to append this string directly to the component builder. Provides a convenient property-style syntax for appending strings.
Extension property to append this string as a keybind component. Uses this string as the keybind key to display the player's configured key.
Extension property to append this string as a selector component. Uses this string as the entity selector pattern (@a, @p, etc.).
Extension property to append this string as a translatable component. Uses this string as the translation key for localized text.
Functions
Appends any value to this component builder with automatic type conversion. String values are appended as text components, Component values are appended directly, and other types are converted to strings via toString() before appending. Null values are converted to empty strings.
Appends a string content to this component builder.
Appends a component to this component builder.
Sets the text color to aqua.
Sets the text color to black.
Appends a block NBT component with the specified NBT path and builder configuration. Queries and displays NBT data from a block at a specific position.
Sets the text color to blue.
Sets the bold decoration of the last component added to this ComponentBuilder.
Collects all appended components into a single component without a separator.
Collects all appended components into a single component with a string separator.
Collects all appended components into a single component with a component separator.
Conditionally applies one of two consumer lambdas to this component builder based on a predicate result. Evaluates the predicate function and applies the ifTrue consumer if the result is true, or the ifFalse consumer if the result is false.
Creates a new component builder scope with the given consumer.
Sets the text color to dark aqua.
Sets the text color to dark blue.
Sets the text color to dark gray.
Sets the text color to dark green.
Sets the text color to dark purple.
Sets the text color to dark red.
Appends an empty component.
Appends an entity NBT component with the specified NBT path and builder configuration. Queries and displays NBT data from entities matching a selector.
Iterates over the given iterable and applies an action to each element. The action receives both the component builder context and the current element, allowing component building per iteration.
Sets the text color to gold.
Sets the text color to gray.
Sets the text color to green.
Applies a hover event to the last appended component. When the player hovers over this component, the specified hover event will be triggered.
Applies styling if the given value is not null.
Sets the insertion text for the last appended component. When the player shift-clicks this component, the specified text will be inserted into their chat input field.
Applies the given styler to the last appended component.
Applies the given styler to the last appended component. This operator allows for syntax like +"string" { color(RED) }.
Applies the given styler to the last appended component. This operator allows for syntax like +"string" { color(RED) }.
Sets the italic decoration of the last component added to this ComponentBuilder.
Joins all appended components into a single component without a separator.
Joins all appended components into a single component using a join configuration DSL.
Joins all appended components into a single component with a string separator.
Joins all appended components into a single component with a component separator.
Joins all appended components into a single component using a join configuration.
Creates a new component join configuration using a DSL builder.
Appends a keybind component with the specified keybind key. Displays the key binding configured by the player (e.g., "key.inventory", "key.jump").
Appends a keybind component with the specified keybind key and applies additional configuration.
Appends a MiniMessage string content to this component builder with tag resolvers built using a consumer.
Appends a MiniMessage string content to this component builder with optional tag resolvers.
Appends a newline component to this component builder. Inserts a line break in the text display.
Sets the obfuscated decoration of the last component added to this ComponentBuilder.
Sets the text color to light purple.
Sets the text color to red.
Repeats the given action specified number of times.
Applies text replacement to the last appended component using a builder configuration.
Applies text replacement to the last appended component using a pre-built configuration.
Appends a score component with the specified player name and objective.
Appends a score component with the specified player name and objective and applies additional configuration.
Appends a selector component with the specified selector pattern. Selectors target entities in the game world (e.g., "@a" for all players, "@p" for nearest player, "@etype=cow" for cows).
Appends a selector component with the specified selector pattern and applies additional configuration.
Appends a space component to this component builder. Inserts a single space character in the text display.
Appends specified number of space components.
Appends a storage NBT component that queries data from command storage. Displays NBT data from persistent command storage at the specified key (parsed from string).
Appends a storage NBT component that queries data from command storage. Displays NBT data from persistent command storage at the specified key.
Sets the strikethrough decoration of the last component added to this ComponentBuilder.
Retroactively applies a styling consumer to the most recently appended component.
Appends a tab component to this component builder.
Appends a text component with the specified string content.
Appends a text component with the specified string content and applies additional configuration. This method combines appending text with a nested component builder scope, allowing you to build complex component hierarchies in a fluent way.
Appends a text component with multiple text colors applied sequentially. Each color in the formatters array is applied to the component's style.
Appends text and styles parts of it that match the given regular expression.
Appends a text component that runs the given command when clicked.
Appends a text component that copies the given text to the clipboard when clicked.
Appends a text component that shows the given text when hovered.
Appends a text component that shows the given component when hovered.
Appends a text component that suggests the given command when clicked.
Appends a text component that opens the given URL when clicked.
Appends a translatable component with the specified translation key.
Appends a translatable component with arguments built using a consumer lambda.
Appends a translatable component with the specified translation key and a list of component arguments.
Appends a translatable component with the specified translation key and style.
Appends a translatable component with component arguments. The arguments will be substituted into the translation pattern.
Appends a styled translatable component with arguments built using a nested component builder scope.
Appends a translatable component with the specified translation key, style, and list of arguments.
Appends a translatable component with the specified translation key, style, and component arguments.
Appends a translatable component with mixed type arguments. Accepts any type of arguments (String, Number, Component, etc.) which will be converted appropriately.
Operator function that returns this component builder. This is useful for syntax like +"string" { style }.
Operator function to append any value to this component builder using the unary + operator. Accepts nullable values of any type and converts them to components appropriately. String values are appended as text components, Component values are appended directly, and other types are converted to strings via toString() before appending.
Operator function to append a string to this component builder using the unary + operator.
Operator function to append a component to this component builder using the unary + operator.
Sets the underline decoration of the last component added to this ComponentBuilder.
Conditionally applies a consumer lambda to this component builder if the condition is false.
Conditionally applies a consumer lambda to this component builder if the condition is true.
Sets the text color to white.
Sets the color of the last component added to this ComponentBuilder using an integer RGB value.
Sets the color of the last component added to this ComponentBuilder.
Sets the click command of the last component added to this ComponentBuilder.
Sets the copy to clipboard text of the last component added to this ComponentBuilder.
Sets the font of the last component added to this ComponentBuilder using a font key string.
Sets the font of the last component added to this ComponentBuilder.
Sets the hover text of the last component added to this ComponentBuilder.
Sets the hover component of the last component added to this ComponentBuilder.
Applies the given styler to the last appended component. This operator allows for syntax like +"string" { color(RED) }.
Applies a style to the last component added to this ComponentBuilder using a DSL builder pattern.
Sets the suggest command of the last component added to this ComponentBuilder.
Sets the URL of the last component added to this ComponentBuilder.
Sets the text color to yellow.