Interface Component
- All Superinterfaces:
ComponentBuilderApplicable, ComponentLike, HoverEventSource<Component>, StyleGetter, StyleSetter<Component>
- All Known Subinterfaces:
BlockNBTComponent, EntityNBTComponent, KeybindComponent, NBTComponent<C>, ObjectComponent, ScopedComponent<C>, ScoreComponent, SelectorComponent, StorageNBTComponent, TextComponent, TranslatableComponent, VirtualComponent
Components can be thought of as the combination of:
- The message the Component wants to display; and
- The
Styleof that message.
The most basic component is the TextComponent,
where the message is a simple String. However, other dynamic
Components are available, which are linked to from here and you
are encouraged to explore to better support your plugin/mod.
Factories and builders for all available component types are
provided via this interface.
Components can be serialized to and deserialized from other
formats via the use of component
serializers. If used within one of our natively supported platforms,
the availability of such serializers may vary, consult the documentation
or support for the given platform should this be the case.
Further information about Components, along with functional examples of how they can be used, can be found on our documentation.
Note: although this interface is sealed, new implementations may be added at any time as and when needed.
- Since:
- 4.0.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BiPredicate<? super Component, ? super Component> A predicate that checks equality of twoComponents usingObjects.equals(Object, Object).static final BiPredicate<? super Component, ? super Component> A predicate that checks equality of twoComponents using identity equality.A predicate that excludesempty(). -
Method Summary
Modifier and TypeMethodDescriptiondefault Componentappend(List<? extends ComponentLike> components) Appends a list of components to this component.default ComponentAppends a component to this component.default Componentappend(ComponentBuilder<?, ?> builder) Appends a component to this component.default Componentappend(ComponentLike like) Appends a component to this component.default Componentappend(ComponentLike... components) Appends components to this component.default ComponentAppends a newline to this component.default ComponentAppends a space to this component.default ComponentapplyFallbackStyle(Style style) Apply a fallback style for this component and its children.default ComponentapplyFallbackStyle(StyleBuilderApplicable... style) Apply a fallback style for this component and its children.default ComponentGets aComponentrepresentation.default HoverEvent<Component> Creates a hover event with value derived from this object.static BlockNBTComponent.BuilderblockNBT()Creates a block NBT component builder.static BlockNBTComponentblockNBT(String nbtPath, boolean interpret, @Nullable ComponentLike separator, BlockNBTComponent.Pos pos) Creates a block NBT component with a position.static BlockNBTComponentblockNBT(String nbtPath, boolean interpret, BlockNBTComponent.Pos pos) Creates a block NBT component with a position.static BlockNBTComponentblockNBT(String nbtPath, BlockNBTComponent.Pos pos) Creates a block NBT component with a position.static BlockNBTComponentblockNBT(Consumer<? super BlockNBTComponent.Builder> consumer) Creates a block NBT component by applying configuration fromconsumer.children()Gets the unmodifiable list of children.children(List<? extends ComponentLike> children) Sets the list of children.default @Nullable ClickEvent<?> Gets the click event of this component.default ComponentclickEvent(@Nullable ClickEvent<?> event) Sets the click event of this component.default @Nullable TextColorcolor()Gets the color of this component.default ComponentSets the color of this component.default ComponentcolorIfAbsent(@Nullable TextColor color) Sets the color if there isn't one set already.default Componentcompact()Create a new component with any redundant style elements or children removed.default ComponentCreate a new component with any redundant style elements or children removed.default voidcomponentBuilderApply(ComponentBuilder<?, ?> component) Applies tocomponent.default booleanChecks if this component contains a component.default booleancontains(Component that, BiPredicate<? super Component, ? super Component> equals) Checks if this component contains a component.default Componentdecorate(TextDecoration decoration) Sets the state ofdecorationtoTextDecoration.State.TRUEon this component.default TextDecoration.Statedecoration(TextDecoration decoration) Gets the state of a decoration on this component.default Componentdecoration(TextDecoration decoration, boolean flag) Sets the state of a decoration on this component.default Componentdecoration(TextDecoration decoration, TextDecoration.State state) Sets the value of a decoration on this component.default ComponentdecorationIfAbsent(TextDecoration decoration, TextDecoration.State state) Sets the state of a decoration on this component tostateif the current state of the decoration isTextDecoration.State.NOT_SET.default Map<TextDecoration, TextDecoration.State> Gets a map of decorations this component has.default Componentdecorations(Map<TextDecoration, TextDecoration.State> decorations) Sets decorations for this component's style using the specifieddecorationsmap.static TextComponentempty()Gets an empty component.static EntityNBTComponent.BuilderCreates an entity NBT component builder.static EntityNBTComponentCreates a entity NBT component with a position.static EntityNBTComponententityNBT(Consumer<? super EntityNBTComponent.Builder> consumer) Creates a entity NBT component by applying configuration fromconsumer.default @Nullable Keyfont()Gets the font.default ComponentSets the font.default booleanhasDecoration(TextDecoration decoration) Tests if this component has a decoration.default booleanTests if this component has any styling.default @Nullable HoverEvent<?> Gets the hover event of this component.default ComponenthoverEvent(@Nullable HoverEventSource<?> source) Sets the hover event of this component.default @Nullable StringGets the string to be inserted when this component is shift-clicked.default ComponentSets the string to be inserted when this component is shift-clicked.iterable(ComponentIteratorType type, Set<ComponentIteratorFlag> flags) Returns an iterable view of this component.iterable(ComponentIteratorType type, ComponentIteratorFlag @Nullable ... flags) Returns an iterable view of this component.iterator(ComponentIteratorType type, Set<ComponentIteratorFlag> flags) Returns an iterator for this component.iterator(ComponentIteratorType type, ComponentIteratorFlag @Nullable ... flags) Returns an iterator for this component.static Componentjoin(JoinConfiguration.Builder configBuilder, Iterable<? extends ComponentLike> components) Joinscomponentsusing the configuration inconfigBuilder.static Componentjoin(JoinConfiguration.Builder configBuilder, ComponentLike... components) Joinscomponentsusing the configuration inconfigBuilder.static Componentjoin(JoinConfiguration config, Iterable<? extends ComponentLike> components) Joinscomponentsusing the configuration inconfig.static Componentjoin(JoinConfiguration config, ComponentLike... components) Joinscomponentsusing the configuration inconfig.static KeybindComponent.Builderkeybind()Creates a keybind component builder.static KeybindComponentCreates a keybind component with a keybind.static KeybindComponentCreates a keybind component with a keybind, and optional color.static KeybindComponentkeybind(String keybind, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a keybind component with a keybind, and optional color and decorations.static KeybindComponentkeybind(String keybind, @Nullable TextColor color, TextDecoration... decorations) Creates a keybind component with a keybind, and optional color and decorations.static KeybindComponentCreates a keybind component with a keybind and styling.static KeybindComponentkeybind(Consumer<? super KeybindComponent.Builder> consumer) Creates a keybind component by applying configuration fromconsumer.static KeybindComponentkeybind(KeybindComponent.KeybindLike keybind) Creates a keybind component with a keybind.static KeybindComponentkeybind(KeybindComponent.KeybindLike keybind, @Nullable TextColor color) Creates a keybind component with a keybind, and optional color.static KeybindComponentkeybind(KeybindComponent.KeybindLike keybind, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a keybind component with a keybind, and optional color and decorations.static KeybindComponentkeybind(KeybindComponent.KeybindLike keybind, @Nullable TextColor color, TextDecoration... decorations) Creates a keybind component with a keybind, and optional color and decorations.static KeybindComponentkeybind(KeybindComponent.KeybindLike keybind, Style style) Creates a keybind component with a keybind and styling.default ComponentmergeStyle(Component that) Merges from another style into this component's style.default ComponentmergeStyle(Component that, Set<Style.Merge> merges) Merges from another style into this component's style.default ComponentmergeStyle(Component that, Style.Merge... merges) Merges from another style into this component's style.static TextComponentnewline()Gets a text component with a new line character as the content.static ObjectComponent.Builderobject()Creates an object component builder.static ObjectComponentobject(Consumer<? super ObjectComponent.Builder> consumer) Creates an object component by applying configuration fromconsumer.static ObjectComponentobject(ObjectContents objectContents) Creates an object component with the given contents.default ComponentreplaceText(Consumer<TextReplacementConfig.Builder> configurer) Finds and replaces any text with this or childComponents using the configured options.default ComponentreplaceText(TextReplacementConfig config) Finds and replaces any text with this or childComponents using the provided options.static ScoreComponent.Builderscore()Creates a score component builder.static ScoreComponentCreates a score component with a name and objective.static ScoreComponentCreates a score component with a name and objective.static ScoreComponentscore(Consumer<? super ScoreComponent.Builder> consumer) Creates a score component by applying configuration fromconsumer.static SelectorComponent.Builderselector()Creates a selector component builder.static SelectorComponentCreates a selector component with a pattern.static SelectorComponentselector(String pattern, @Nullable ComponentLike separator) Creates a selector component with a pattern.static SelectorComponentselector(Consumer<? super SelectorComponent.Builder> consumer) Creates a selector component by applying configuration fromconsumer.default @Nullable ShadowColorGets the shadow color.default ComponentshadowColor(@Nullable ARGBLike argb) Sets the shadow color of this component.default ComponentshadowColorIfAbsent(@Nullable ARGBLike argb) Sets the shadow color if there isn't one set already.static TextComponentspace()Gets a text immutable component with a single space as the content.default Spliterator<Component> spliterator(ComponentIteratorType type, Set<ComponentIteratorFlag> flags) Returns a spliterator for this component.default Spliterator<Component> spliterator(ComponentIteratorType type, ComponentIteratorFlag @Nullable ... flags) Returns a spliterator for this component.static StorageNBTComponent.BuilderCreates an storage NBT component builder.static StorageNBTComponentstorageNBT(String nbtPath, boolean interpret, Key storage) Creates a storage NBT component with a path and an storage ID.static StorageNBTComponentstorageNBT(String nbtPath, boolean interpret, @Nullable ComponentLike separator, Key storage) Creates a storage NBT component with a path and an storage ID.static StorageNBTComponentstorageNBT(String nbtPath, Key storage) Creates a storage NBT component with a path and an storage ID.static StorageNBTComponentstorageNBT(Consumer<? super StorageNBTComponent.Builder> consumer) Creates a storage NBT component by applying configuration fromconsumer.style()Gets the style of this component.default Componentstyle(Consumer<Style.Builder> consumer) Sets the style of this component.default Componentstyle(Consumer<Style.Builder> consumer, Style.Merge.Strategy strategy) Sets the style of this component.Sets the style of this component.default Componentstyle(Style.Builder style) Sets the style of this component.static TextComponent.Buildertext()Creates a text component builder.static TextComponenttext(boolean value) Creates a text component with the content ofString.valueOf(boolean).static TextComponentCreates a text component with the content ofString.valueOf(boolean), and optional color.static TextComponenttext(boolean value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(boolean), and optional color and decorations.static TextComponenttext(boolean value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(boolean), and optional color and decorations.static TextComponentCreates a text component with the content ofString.valueOf(boolean)and styling.static TextComponenttext(char value) Creates a text component with the content ofString.valueOf(char).static TextComponentCreates a text component with the content ofString.valueOf(char), and optional color.static TextComponenttext(char value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(char), and optional color and decorations.static TextComponenttext(char value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(char), and optional color and decorations.static TextComponentCreates a text component with the content ofString.valueOf(char)and styling.static TextComponenttext(double value) Creates a text component with the content ofString.valueOf(double).static TextComponentCreates a text component with the content ofString.valueOf(double), and optional color.static TextComponenttext(double value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(double), and optional color and decorations.static TextComponenttext(double value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(double), and optional color and decorations.static TextComponentCreates a text component with the content ofString.valueOf(double)and styling.static TextComponenttext(float value) Creates a text component with the content ofString.valueOf(float).static TextComponentCreates a text component with the content ofString.valueOf(float), and optional color.static TextComponenttext(float value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(float), and optional color and decorations.static TextComponenttext(float value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(float), and optional color and decorations.static TextComponentCreates a text component with the content ofString.valueOf(float)and styling.static TextComponenttext(int value) Creates a text component with the content ofString.valueOf(int).static TextComponentCreates a text component with the content ofString.valueOf(int), and optional color.static TextComponenttext(int value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(int), and optional color and decorations.static TextComponenttext(int value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(int), and optional color and decorations.static TextComponentCreates a text component with the content ofString.valueOf(int)and styling.static TextComponenttext(long value) Creates a text component with the content ofString.valueOf(long).static TextComponentCreates a text component with the content ofString.valueOf(long), and optional color.static TextComponenttext(long value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(long), and optional color and decorations.static TextComponenttext(long value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(long), and optional color and decorations.static TextComponentCreates a text component with the content ofString.valueOf(long)and styling.static TextComponentCreates a text component with content.static TextComponentCreates a text component with content, and optional color.static TextComponenttext(String content, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with content, and optional color and decorations.static TextComponenttext(String content, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with content, and optional color and decorations.static TextComponentCreates a text component with content and styling.static TextComponenttext(Consumer<? super TextComponent.Builder> consumer) Creates a text component by applying configuration fromconsumer.static TextComponenttextOfChildren(ComponentLike... components) Creates a text component withcomponentsas the children.ComponentBuilder<?, ?> Returns a builder for this component.static Collector<Component, ? extends ComponentBuilder<?, ?>, Component> Create a collector that will join components without a separator.static Collector<Component, ? extends ComponentBuilder<?, ?>, Component> toComponent(Component separator) Create a collector that will join components using the provided separator.Creates a translatable component builder.static TranslatableComponenttranslatable(String key) Creates a translatable component with a translation key.static TranslatableComponenttranslatable(String key, @Nullable String fallback) Creates a translatable component with a translation key and an optional fallback string.static TranslatableComponenttranslatable(String key, @Nullable String fallback, List<? extends ComponentLike> args, Iterable<StyleBuilderApplicable> style) Creates a translatable component with a translation key, optional fallback string, and arguments.static TranslatableComponenttranslatable(String key, @Nullable String fallback, List<? extends ComponentLike> args, StyleBuilderApplicable... style) Creates a translatable component with a translation key, optional fallback string, and arguments.static TranslatableComponenttranslatable(String key, @Nullable String fallback, ComponentLike... args) Creates a translatable component with a translation key, optional fallback string, and arguments.static TranslatableComponenttranslatable(String key, @Nullable String fallback, Style style) Creates a translatable component with a translation key, optional fallback string, and styling.static TranslatableComponenttranslatable(String key, @Nullable String fallback, StyleBuilderApplicable... style) Creates a translatable component with a translation key, optional fallback string, and styling.static TranslatableComponenttranslatable(String key, @Nullable String fallback, Style style, List<? extends ComponentLike> args) Creates a translatable component with a translation key, optional fallback string, and arguments.static TranslatableComponenttranslatable(String key, @Nullable String fallback, Style style, ComponentLike... args) Creates a translatable component with a translation key, optional fallback string, and styling.static TranslatableComponenttranslatable(String key, List<? extends ComponentLike> args) Creates a translatable component with a translation key and arguments.static TranslatableComponenttranslatable(String key, ComponentLike... args) Creates a translatable component with a translation key and arguments.static TranslatableComponenttranslatable(String key, @Nullable TextColor color) Creates a translatable component with a translation key, and optional color.static TranslatableComponenttranslatable(String key, @Nullable TextColor color, List<? extends ComponentLike> args) Creates a translatable component with a translation key, arguments, and optional color.static TranslatableComponenttranslatable(String key, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a translatable component with a translation key, and optional color and decorations.static TranslatableComponenttranslatable(String key, @Nullable TextColor color, Set<TextDecoration> decorations, List<? extends ComponentLike> args) Creates a translatable component with a translation key, arguments, and optional color and decorations.static TranslatableComponenttranslatable(String key, @Nullable TextColor color, Set<TextDecoration> decorations, ComponentLike... args) Creates a translatable component with a translation key, arguments, and optional color and decorations.static TranslatableComponenttranslatable(String key, @Nullable TextColor color, ComponentLike... args) Creates a translatable component with a translation key, arguments, and optional color.static TranslatableComponenttranslatable(String key, @Nullable TextColor color, TextDecoration... decorations) Creates a translatable component with a translation key, and optional color and decorations.static TranslatableComponenttranslatable(String key, Style style) Creates a translatable component with a translation key and styling.static TranslatableComponenttranslatable(String key, Style style, List<? extends ComponentLike> args) Creates a translatable component with a translation key and styling.static TranslatableComponenttranslatable(String key, Style style, ComponentLike... args) Creates a translatable component with a translation key and styling.static TranslatableComponenttranslatable(Consumer<? super TranslatableComponent.Builder> consumer) Creates a translatable component by applying configuration fromconsumer.static TranslatableComponenttranslatable(Translatable translatable) Creates a translatable component with a translation key.static TranslatableComponenttranslatable(Translatable translatable, @Nullable String fallback) Creates a translatable component with a translation key and an optional fallback string.static TranslatableComponenttranslatable(Translatable translatable, @Nullable String fallback, Iterable<StyleBuilderApplicable> style) Creates a translatable component with a translation key, optional fallback string, and styling.static TranslatableComponenttranslatable(Translatable translatable, @Nullable String fallback, List<? extends ComponentLike> args, Iterable<StyleBuilderApplicable> style) Creates a translatable component with a translation key, optional fallback string, and arguments.static TranslatableComponenttranslatable(Translatable translatable, @Nullable String fallback, List<? extends ComponentLike> args, StyleBuilderApplicable... style) Creates a translatable component with a translation key, optional fallback string, and arguments.static TranslatableComponenttranslatable(Translatable translatable, @Nullable String fallback, ComponentLike... args) Creates a translatable component with a translation key, optional fallback string, and arguments.static TranslatableComponenttranslatable(Translatable translatable, @Nullable String fallback, Style style) Creates a translatable component with a translation key, optional fallback string, and styling.static TranslatableComponenttranslatable(Translatable translatable, @Nullable String fallback, Style style, List<? extends ComponentLike> args) Creates a translatable component with a translation key, optional fallback string, and arguments.static TranslatableComponenttranslatable(Translatable translatable, @Nullable String fallback, Style style, ComponentLike... args) Creates a translatable component with a translation key, optional fallback string, and styling.static TranslatableComponenttranslatable(Translatable translatable, List<? extends ComponentLike> args) Creates a translatable component with a translation key and arguments.static TranslatableComponenttranslatable(Translatable translatable, ComponentLike... args) Creates a translatable component with a translation key and arguments.static TranslatableComponenttranslatable(Translatable translatable, @Nullable TextColor color) Creates a translatable component with a translation key, and optional color.static TranslatableComponenttranslatable(Translatable translatable, @Nullable TextColor color, List<? extends ComponentLike> args) Creates a translatable component with a translation key, arguments, and optional color.static TranslatableComponenttranslatable(Translatable translatable, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a translatable component with a translation key, and optional color and decorations.static TranslatableComponenttranslatable(Translatable translatable, @Nullable TextColor color, Set<TextDecoration> decorations, List<? extends ComponentLike> args) Creates a translatable component with a translation key, arguments, and optional color and decorations.static TranslatableComponenttranslatable(Translatable translatable, @Nullable TextColor color, Set<TextDecoration> decorations, ComponentLike... args) Creates a translatable component with a translation key, arguments, and optional color and decorations.static TranslatableComponenttranslatable(Translatable translatable, @Nullable TextColor color, ComponentLike... args) Creates a translatable component with a translation key, arguments, and optional color.static TranslatableComponenttranslatable(Translatable translatable, @Nullable TextColor color, TextDecoration... decorations) Creates a translatable component with a translation key, and optional color and decorations.static TranslatableComponenttranslatable(Translatable translatable, Style style) Creates a translatable component with a translation key and styling.static TranslatableComponenttranslatable(Translatable translatable, Style style, List<? extends ComponentLike> args) Creates a translatable component with a translation key and styling.static TranslatableComponenttranslatable(Translatable translatable, Style style, ComponentLike... args) Creates a translatable component with a translation key and styling.static <C> VirtualComponentvirtual(Class<C> contextType, VirtualComponentRenderer<C> renderer) Creates a virtual component.static <C> VirtualComponentvirtual(Class<C> contextType, VirtualComponentRenderer<C> renderer, Iterable<StyleBuilderApplicable> style) Creates a virtual component with a value.static <C> VirtualComponentvirtual(Class<C> contextType, VirtualComponentRenderer<C> renderer, Style style) Creates a virtual component with a value.static <C> VirtualComponentvirtual(Class<C> contextType, VirtualComponentRenderer<C> renderer, StyleBuilderApplicable... style) Creates a virtual component with a value.Methods inherited from interface HoverEventSource
asHoverEventMethods inherited from interface StyleSetter
decorate, decorations
-
Field Details
-
EQUALS
A predicate that checks equality of twoComponents usingObjects.equals(Object, Object).- Since:
- 4.8.0
-
EQUALS_IDENTITY
A predicate that checks equality of twoComponents using identity equality.- Since:
- 4.8.0
-
IS_NOT_EMPTY
-
-
Method Details
-
empty
-
newline
Gets 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
-
space
Gets 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
-
join
@Contract(pure=true) static Component join(JoinConfiguration.Builder configBuilder, ComponentLike... components) Joinscomponentsusing the configuration inconfigBuilder.- Parameters:
configBuilder- the join configurationcomponents- the components- Returns:
- the resulting component
- Since:
- 4.14.0
- See Also:
-
join
@Contract(pure=true) static Component join(JoinConfiguration.Builder configBuilder, Iterable<? extends ComponentLike> components) Joinscomponentsusing the configuration inconfigBuilder.- Parameters:
configBuilder- the join configurationcomponents- the components- Returns:
- the resulting component
- Since:
- 4.14.0
- See Also:
-
join
Joinscomponentsusing the configuration inconfig.- Parameters:
config- the join configurationcomponents- the components- Returns:
- the resulting component
- Since:
- 4.9.0
- See Also:
-
join
@Contract(pure=true) static Component join(JoinConfiguration config, Iterable<? extends ComponentLike> components) Joinscomponentsusing the configuration inconfig.- Parameters:
config- the join configurationcomponents- the components- Returns:
- the resulting component
- Since:
- 4.9.0
- See Also:
-
toComponent
Create a collector that will join components without a separator.- Returns:
- a collector that can join components
- Since:
- 4.6.0
-
toComponent
static Collector<Component, ? extends ComponentBuilder<?,?>, Component> toComponent(Component separator) Create a collector that will join components using the provided separator.- Parameters:
separator- the separator to join with- Returns:
- a collector that can join components
- Since:
- 4.6.0
-
blockNBT
Creates a block NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
blockNBT
@Contract("_ -> new") static BlockNBTComponent blockNBT(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
-
blockNBT
@Contract(value="_, _ -> new", pure=true) static BlockNBTComponent blockNBT(String nbtPath, BlockNBTComponent.Pos pos) Creates a block NBT component with a position.- Parameters:
nbtPath- the nbt pathpos- the block position- Returns:
- a block NBT component
- Since:
- 4.0.0
-
blockNBT
@Contract(value="_, _, _ -> new", pure=true) static BlockNBTComponent blockNBT(String nbtPath, boolean interpret, BlockNBTComponent.Pos pos) Creates a block NBT component with a position.- Parameters:
nbtPath- the nbt pathinterpret- whether to interpretpos- the block position- Returns:
- a block NBT component
- Since:
- 4.0.0
-
blockNBT
@Contract(value="_, _, _, _ -> new", pure=true) static BlockNBTComponent blockNBT(String nbtPath, boolean interpret, @Nullable ComponentLike separator, BlockNBTComponent.Pos pos) Creates a block NBT component with a position.- Parameters:
nbtPath- the nbt pathinterpret- whether to interpretseparator- the separatorpos- the block position- Returns:
- a block NBT component
- Since:
- 4.8.0
-
entityNBT
Creates an entity NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
entityNBT
@Contract("_ -> new") static EntityNBTComponent entityNBT(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
-
entityNBT
Creates a entity NBT component with a position.- Parameters:
nbtPath- the nbt pathselector- the selector- Returns:
- an entity NBT component
- Since:
- 4.0.0
-
keybind
Creates a keybind component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
keybind
@Contract("_ -> new") static KeybindComponent keybind(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
-
keybind
Creates a keybind component with a keybind.- Parameters:
keybind- the keybind- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_ -> new", pure=true) static KeybindComponent keybind(KeybindComponent.KeybindLike keybind) Creates a keybind component with a keybind.- Parameters:
keybind- the keybind- Returns:
- the keybind component
- Since:
- 4.9.0
-
keybind
@Contract(value="_, _ -> new", pure=true) static KeybindComponent keybind(String keybind, Style style) Creates a keybind component with a keybind and styling.- Parameters:
keybind- the keybindstyle- the style- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_, _ -> new", pure=true) static KeybindComponent keybind(KeybindComponent.KeybindLike keybind, Style style) Creates a keybind component with a keybind and styling.- Parameters:
keybind- the keybindstyle- the style- Returns:
- the keybind component
- Since:
- 4.9.0
-
keybind
@Contract(value="_, _ -> new", pure=true) static KeybindComponent keybind(String keybind, @Nullable TextColor color) Creates a keybind component with a keybind, and optional color.- Parameters:
keybind- the keybindcolor- the color- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_, _ -> new", pure=true) static KeybindComponent keybind(KeybindComponent.KeybindLike keybind, @Nullable TextColor color) Creates a keybind component with a keybind, and optional color.- Parameters:
keybind- the keybindcolor- the color- Returns:
- the keybind component
- Since:
- 4.9.0
-
keybind
@Contract(value="_, _, _ -> new", pure=true) static KeybindComponent keybind(String keybind, @Nullable TextColor color, TextDecoration... decorations) Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
keybind- the keybindcolor- the colordecorations- the decorations- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_, _, _ -> new", pure=true) static KeybindComponent keybind(KeybindComponent.KeybindLike keybind, @Nullable TextColor color, TextDecoration... decorations) Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
keybind- the keybindcolor- the colordecorations- the decorations- Returns:
- the keybind component
- Since:
- 4.9.0
-
keybind
@Contract(value="_, _, _ -> new", pure=true) static KeybindComponent keybind(String keybind, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
keybind- the keybindcolor- the colordecorations- the decorations- Returns:
- the keybind component
- Since:
- 4.0.0
-
keybind
@Contract(value="_, _, _ -> new", pure=true) static KeybindComponent keybind(KeybindComponent.KeybindLike keybind, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a keybind component with a keybind, and optional color and decorations.- Parameters:
keybind- the keybindcolor- the colordecorations- the decorations- Returns:
- the keybind component
- Since:
- 4.9.0
-
object
Creates an object component builder.- Returns:
- a builder
- Since:
- 4.25.0
-
object
@Contract("_ -> new") static ObjectComponent object(Consumer<? super ObjectComponent.Builder> consumer) Creates an object component by applying configuration fromconsumer.- Parameters:
consumer- the builder configurator- Returns:
- an object component
- Since:
- 4.25.0
-
object
Creates an object component with the given contents.- Parameters:
objectContents- the contents- Returns:
- an object component
- Since:
- 4.25.0
-
score
Creates a score component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
score
@Contract("_ -> new") static ScoreComponent score(Consumer<? super ScoreComponent.Builder> consumer) Creates a score component by applying configuration fromconsumer.- Parameters:
consumer- the builder configurator- Returns:
- a score component
- Since:
- 4.0.0
-
score
@Contract(value="_, _ -> new", pure=true) static ScoreComponent score(String name, String objective) Creates a score component with a name and objective.- Parameters:
name- the score nameobjective- the score objective- Returns:
- a score component
- Since:
- 4.0.0
-
score
@Obsolete @Contract(value="_, _, _ -> new", pure=true) static ScoreComponent score(String name, String objective, @Nullable String value) Creates a score component with a name and objective.- Parameters:
name- the score nameobjective- the score objectivevalue- the score value- Returns:
- a score component
- Since:
- 4.0.0
- Obsolete since Minecraft
- 1.16.5, no longer supported
-
selector
Creates a selector component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
selector
@Contract("_ -> new") static SelectorComponent selector(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
-
selector
Creates a selector component with a pattern.- Parameters:
pattern- the selector pattern- Returns:
- a selector component
- Since:
- 4.0.0
-
selector
@Contract(value="_, _ -> new", pure=true) static SelectorComponent selector(String pattern, @Nullable ComponentLike separator) Creates a selector component with a pattern.- Parameters:
pattern- the selector patternseparator- the separator- Returns:
- a selector component
- Since:
- 4.8.0
-
storageNBT
Creates an storage NBT component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
storageNBT
@Contract("_ -> new") static StorageNBTComponent storageNBT(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
-
storageNBT
@Contract(value="_, _ -> new", pure=true) static StorageNBTComponent storageNBT(String nbtPath, Key storage) Creates a storage NBT component with a path and an storage ID.- Parameters:
nbtPath- the nbt pathstorage- the identifier of the storage- Returns:
- a storage NBT component
- Since:
- 4.0.0
-
storageNBT
@Contract(value="_, _, _ -> new", pure=true) static StorageNBTComponent storageNBT(String nbtPath, boolean interpret, Key storage) Creates a storage NBT component with a path and an storage ID.- Parameters:
nbtPath- the nbt pathinterpret- whether to interpretstorage- the identifier of the storage- Returns:
- a storage NBT component
- Since:
- 4.0.0
-
storageNBT
@Contract(value="_, _, _, _ -> new", pure=true) static StorageNBTComponent storageNBT(String nbtPath, boolean interpret, @Nullable ComponentLike separator, Key storage) Creates a storage NBT component with a path and an storage ID.- Parameters:
nbtPath- the nbt pathinterpret- whether to interpretseparator- the separatorstorage- the identifier of the storage- Returns:
- a storage NBT component
- Since:
- 4.8.0
-
text
Creates a text component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
textOfChildren
Creates a text component withcomponentsas the children.- Parameters:
components- the children- Returns:
- a text component
- Since:
- 4.10.0
-
text
Creates a text component by applying configuration fromconsumer.- Parameters:
consumer- the builder configurator- Returns:
- the text component
- Since:
- 4.0.0
-
text
Creates a text component with content.- Parameters:
content- the plain text content- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with content and styling.- Parameters:
content- the plain text contentstyle- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) static TextComponent text(String content, @Nullable TextColor color) Creates a text component with content, and optional color.- Parameters:
content- the plain text contentcolor- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(String content, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with content, and optional color and decorations.- Parameters:
content- the plain text contentcolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(String content, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with content, and optional color and decorations.- Parameters:
content- the plain text contentcolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(boolean).- Parameters:
value- the boolean value- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(boolean)and styling.- Parameters:
value- the boolean valuestyle- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) static TextComponent text(boolean value, @Nullable TextColor color) Creates a text component with the content ofString.valueOf(boolean), and optional color.- Parameters:
value- the boolean valuecolor- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(boolean value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(boolean), and optional color and decorations.- Parameters:
value- the boolean valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(boolean value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(boolean), and optional color and decorations.- Parameters:
value- the boolean valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(char).- Parameters:
value- the char value- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(char)and styling.- Parameters:
value- the char valuestyle- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) static TextComponent text(char value, @Nullable TextColor color) Creates a text component with the content ofString.valueOf(char), and optional color.- Parameters:
value- the char valuecolor- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(char value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(char), and optional color and decorations.- Parameters:
value- the char valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(char value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(char), and optional color and decorations.- Parameters:
value- the char valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(double).- Parameters:
value- the double value- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(double)and styling.- Parameters:
value- the double valuestyle- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) static TextComponent text(double value, @Nullable TextColor color) Creates a text component with the content ofString.valueOf(double), and optional color.- Parameters:
value- the double valuecolor- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(double value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(double), and optional color and decorations.- Parameters:
value- the double valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(double value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(double), and optional color and decorations.- Parameters:
value- the double valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(float).- Parameters:
value- the float value- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(float)and styling.- Parameters:
value- the float valuestyle- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) static TextComponent text(float value, @Nullable TextColor color) Creates a text component with the content ofString.valueOf(float), and optional color.- Parameters:
value- the float valuecolor- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(float value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(float), and optional color and decorations.- Parameters:
value- the float valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(float value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(float), and optional color and decorations.- Parameters:
value- the float valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(int).- Parameters:
value- the int value- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(int)and styling.- Parameters:
value- the int valuestyle- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) static TextComponent text(int value, @Nullable TextColor color) Creates a text component with the content ofString.valueOf(int), and optional color.- Parameters:
value- the int valuecolor- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(int value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(int), and optional color and decorations.- Parameters:
value- the int valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(int value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(int), and optional color and decorations.- Parameters:
value- the int valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(long).- Parameters:
value- the long value- Returns:
- a text component
- Since:
- 4.0.0
-
text
Creates a text component with the content ofString.valueOf(long)and styling.- Parameters:
value- the long valuestyle- the style- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _ -> new", pure=true) static TextComponent text(long value, @Nullable TextColor color) Creates a text component with the content ofString.valueOf(long), and optional color.- Parameters:
value- the long valuecolor- the color- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(long value, @Nullable TextColor color, TextDecoration... decorations) Creates a text component with the content ofString.valueOf(long), and optional color and decorations.- Parameters:
value- the long valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
text
@Contract(value="_, _, _ -> new", pure=true) static TextComponent text(long value, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a text component with the content ofString.valueOf(long), and optional color and decorations.- Parameters:
value- the long valuecolor- the colordecorations- the decorations- Returns:
- a text component
- Since:
- 4.0.0
-
virtual
@Contract(value="_, _ -> new", pure=true) static <C> VirtualComponent virtual(Class<C> contextType, VirtualComponentRenderer<C> renderer) Creates a virtual component.- Type Parameters:
C- the context type- Parameters:
contextType- the context typerenderer- the renderer- Returns:
- a virtual component
- Since:
- 4.18.0
-
virtual
@Contract(value="_, _, _ -> new", pure=true) static <C> VirtualComponent virtual(Class<C> contextType, VirtualComponentRenderer<C> renderer, Style style) Creates a virtual component with a value.- Type Parameters:
C- the context type- Parameters:
contextType- the context typerenderer- the rendererstyle- the style- Returns:
- a virtual component
- Since:
- 4.18.0
-
virtual
@Contract(value="_, _, _ -> new", pure=true) static <C> VirtualComponent virtual(Class<C> contextType, VirtualComponentRenderer<C> renderer, StyleBuilderApplicable... style) Creates a virtual component with a value.- Type Parameters:
C- the context type- Parameters:
contextType- the context typerenderer- the rendererstyle- the style elements- Returns:
- a virtual component
- Since:
- 4.18.0
-
virtual
@Contract(value="_, _, _ -> new", pure=true) static <C> VirtualComponent virtual(Class<C> contextType, VirtualComponentRenderer<C> renderer, Iterable<StyleBuilderApplicable> style) Creates a virtual component with a value.- Type Parameters:
C- the context type- Parameters:
contextType- the context typerenderer- the rendererstyle- the style elements- Returns:
- a virtual component
- Since:
- 4.18.0
-
translatable
Creates a translatable component builder.- Returns:
- a builder
- Since:
- 4.0.0
-
translatable
@Contract("_ -> new") static TranslatableComponent translatable(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
-
translatable
Creates a translatable component with a translation key.- Parameters:
key- the translation key- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable) Creates a translatable component with a translation key.- Parameters:
translatable- the translatable object to get the key from- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable String fallback) Creates a translatable component with a translation key and an optional fallback string.- Parameters:
key- the translation keyfallback- the fallback string- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable String fallback) Creates a translatable component with a translation key and an optional fallback string.- Parameters:
translatable- the translatable object to get the key fromfallback- the fallback string- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(String key, Style style) Creates a translatable component with a translation key and styling.- Parameters:
key- the translation keystyle- the style- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, Style style) Creates a translatable component with a translation key and styling.- Parameters:
translatable- the translatable object to get the key fromstyle- the style- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable String fallback, Style style) Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
key- the translation keyfallback- the fallback stringstyle- the style- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable String fallback, Style style) Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
translatable- the translatable object to get the key fromfallback- the fallback stringstyle- the style- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable String fallback, StyleBuilderApplicable... style) Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
key- the translation keyfallback- the fallback stringstyle- the style- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable String fallback, Iterable<StyleBuilderApplicable> style) Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
translatable- the translatable object to get the key fromfallback- the fallback stringstyle- the style- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable String fallback, ComponentLike... args) Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
key- the translation keyfallback- the fallback stringargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable String fallback, ComponentLike... args) Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
translatable- the translatable object to get the key fromfallback- the fallback stringargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable String fallback, Style style, ComponentLike... args) Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
key- the translation keyfallback- the fallback stringstyle- the styleargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable String fallback, Style style, ComponentLike... args) Creates a translatable component with a translation key, optional fallback string, and styling.- Parameters:
translatable- the translatable object to get the key fromfallback- the fallback stringstyle- the styleargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.13.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable String fallback, Style style, List<? extends ComponentLike> args) Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
key- the translation keyfallback- the fallback stringstyle- the styleargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable String fallback, Style style, List<? extends ComponentLike> args) Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
translatable- the translatable object to get the key fromfallback- the fallback stringstyle- the styleargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable String fallback, List<? extends ComponentLike> args, Iterable<StyleBuilderApplicable> style) Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
key- the translation keyfallback- the fallback stringargs- the translation argumentsstyle- the style- Returns:
- a translatable component
- Since:
- 4.0.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable String fallback, List<? extends ComponentLike> args, Iterable<StyleBuilderApplicable> style) Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
translatable- the translatable object to get the key fromfallback- the fallback stringargs- the translation argumentsstyle- the style- Returns:
- a translatable component
- Since:
- 4.8.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable String fallback, List<? extends ComponentLike> args, StyleBuilderApplicable... style) Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
key- the translation keyfallback- the fallback stringargs- the translation argumentsstyle- the style- Returns:
- a translatable component
- Since:
- 4.0.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable String fallback, List<? extends ComponentLike> args, StyleBuilderApplicable... style) Creates a translatable component with a translation key, optional fallback string, and arguments.- Parameters:
translatable- the translatable object to get the key fromfallback- the fallback stringargs- the translation argumentsstyle- the style- Returns:
- a translatable component
- Since:
- 4.8.0
- Since Minecraft:
- 1.19.4
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable TextColor color) Creates a translatable component with a translation key, and optional color.- Parameters:
key- the translation keycolor- the color- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable TextColor color) Creates a translatable component with a translation key, and optional color.- Parameters:
translatable- the translatable object to get the key fromcolor- the color- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable TextColor color, TextDecoration... decorations) Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
key- the translation keycolor- the colordecorations- the decorations- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable TextColor color, TextDecoration... decorations) Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
translatable- the translatable object to get the key fromcolor- the colordecorations- the decorations- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
key- the translation keycolor- the colordecorations- the decorations- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable TextColor color, Set<TextDecoration> decorations) Creates a translatable component with a translation key, and optional color and decorations.- Parameters:
translatable- the translatable object to get the key fromcolor- the colordecorations- the decorations- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(String key, ComponentLike... args) Creates a translatable component with a translation key and arguments.- Parameters:
key- the translation keyargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, ComponentLike... args) Creates a translatable component with a translation key and arguments.- Parameters:
translatable- the translatable object to get the key fromargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, Style style, ComponentLike... args) Creates a translatable component with a translation key and styling.- Parameters:
key- the translation keystyle- the styleargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, Style style, ComponentLike... args) Creates a translatable component with a translation key and styling.- Parameters:
translatable- the translatable object to get the key fromstyle- the styleargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable TextColor color, ComponentLike... args) Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
key- the translation keycolor- the colorargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable TextColor color, ComponentLike... args) Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
translatable- the translatable object to get the key fromcolor- the colorargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable TextColor color, Set<TextDecoration> decorations, ComponentLike... args) Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
key- the translation keycolor- the colordecorations- the decorationsargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable TextColor color, Set<TextDecoration> decorations, ComponentLike... args) Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
translatable- the translatable object to get the key fromcolor- the colordecorations- the decorationsargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(String key, List<? extends ComponentLike> args) Creates a translatable component with a translation key and arguments.- Parameters:
key- the translation keyargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, List<? extends ComponentLike> args) Creates a translatable component with a translation key and arguments.- Parameters:
translatable- the translatable object to get the key fromargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, Style style, List<? extends ComponentLike> args) Creates a translatable component with a translation key and styling.- Parameters:
key- the translation keystyle- the styleargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, Style style, List<? extends ComponentLike> args) Creates a translatable component with a translation key and styling.- Parameters:
translatable- the translatable object to get the key fromstyle- the styleargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable TextColor color, List<? extends ComponentLike> args) Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
key- the translation keycolor- the colorargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable TextColor color, List<? extends ComponentLike> args) Creates a translatable component with a translation key, arguments, and optional color.- Parameters:
translatable- the translatable object to get the key fromcolor- the colorargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(String key, @Nullable TextColor color, Set<TextDecoration> decorations, List<? extends ComponentLike> args) Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
key- the translation keycolor- the colordecorations- the decorationsargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.0.0
-
translatable
@Contract(value="_, _, _, _ -> new", pure=true) static TranslatableComponent translatable(Translatable translatable, @Nullable TextColor color, Set<TextDecoration> decorations, List<? extends ComponentLike> args) Creates a translatable component with a translation key, arguments, and optional color and decorations.- Parameters:
translatable- the translatable object to get the key fromcolor- the colordecorations- the decorationsargs- the translation arguments- Returns:
- a translatable component
- Since:
- 4.8.0
-
children
-
children
Sets 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
-
contains
Checks if this component contains a component.This method uses identity comparison when checking for contains. Use
contains(Component, BiPredicate)withEQUALSif you wish to use full equality comparison.- Parameters:
that- the other component- Returns:
trueif this component contains the provided component,falseotherwise- Since:
- 4.0.0
-
contains
Checks if this component contains a component.- Parameters:
that- the other componentequals- the equality tester- Returns:
trueif this component contains the provided component,falseotherwise- Since:
- 4.8.0
-
append
-
append
Appends a component to this component.- Parameters:
like- the component to append- Returns:
- a component with the component added
- Since:
- 4.0.0
-
append
Appends a component to this component.- Parameters:
builder- the component to append- Returns:
- a component with the component added
- Since:
- 4.0.0
-
appendNewline
Appends a newline to this component.- Returns:
- a component with the newline added
- Since:
- 4.12.0
-
appendSpace
Appends a space to this component.- Returns:
- a component with the space added
- Since:
- 4.12.0
-
append
Appends components to this component.- Parameters:
components- the children to add- Returns:
- a component with the children added to the existing children
- Since:
- 4.20.0
-
append
Appends a list of components to this component.- Parameters:
components- the children to add- Returns:
- a component with the children added to the existing children
- Since:
- 4.20.0
-
applyFallbackStyle
Apply a fallback style for this component and its children.This method can be used to set the "default" style for a component, whilst still allowing children of the component to override the style.
- Parameters:
style- style to be used as a fallback- Returns:
- the styled component
- Since:
- 4.10.0
-
applyFallbackStyle
Apply a fallback style for this component and its children.This method can be used to set the "default" style for a component, whilst still allowing children of the component to override the style.
- Parameters:
style- style to be used as a fallback- Returns:
- the styled component
- Since:
- 4.10.0
-
style
-
style
-
style
Sets the style of this component.- Parameters:
consumer- the style consumer- Returns:
- a component
- Since:
- 4.0.0
-
style
@Contract(pure=true) default Component style(Consumer<Style.Builder> consumer, Style.Merge.Strategy strategy) Sets the style of this component.- Parameters:
consumer- the style consumerstrategy- the merge strategy- Returns:
- a component
- Since:
- 4.0.0
-
style
Sets the style of this component.- Parameters:
style- the style- Returns:
- a component
- Since:
- 4.0.0
-
mergeStyle
-
mergeStyle
Merges from another style into this component's style.- Parameters:
that- the other stylemerges- the style parts to merge- Returns:
- a component
- Since:
- 4.0.0
-
mergeStyle
Merges from another style into this component's style.- Parameters:
that- the other stylemerges- the style parts to merge- Returns:
- a component
- Since:
- 4.0.0
-
font
Gets the font.- Specified by:
fontin interfaceStyleGetter- Returns:
- the font of this component
- Since:
- 4.10.0
-
font
Sets the font.- Specified by:
fontin interfaceStyleSetter<Component>- Parameters:
key- a font- Returns:
- a component
- Since:
- 4.10.0
-
color
Gets the color of this component.- Specified by:
colorin interfaceStyleGetter- Returns:
- the color of this component
- Since:
- 4.0.0
-
shadowColor
Description copied from interface:StyleGetterGets the shadow color.- Specified by:
shadowColorin interfaceStyleGetter- Returns:
- the shadow color
-
color
Sets the color of this component.- Specified by:
colorin interfaceStyleSetter<Component>- Parameters:
color- the color- Returns:
- a component
- Since:
- 4.0.0
-
colorIfAbsent
Sets the color if there isn't one set already.- Specified by:
colorIfAbsentin interfaceStyleSetter<Component>- Parameters:
color- the color- Returns:
- a component
- Since:
- 4.0.0
-
shadowColor
Sets the shadow color of this component.- Specified by:
shadowColorin interfaceStyleSetter<Component>- Parameters:
argb- the color- Returns:
- a component
- Since:
- 4.18.0
-
shadowColorIfAbsent
Sets the shadow color if there isn't one set already.- Specified by:
shadowColorIfAbsentin interfaceStyleSetter<Component>- Parameters:
argb- the color- Returns:
- a component
- Since:
- 4.18.0
-
hasDecoration
Tests if this component has a decoration.- Specified by:
hasDecorationin interfaceStyleGetter- Parameters:
decoration- the decoration- Returns:
trueif this component has the decoration,falseif this component does not have the decoration- Since:
- 4.0.0
-
decorate
Sets the state ofdecorationtoTextDecoration.State.TRUEon this component.- Specified by:
decoratein interfaceStyleSetter<Component>- Parameters:
decoration- the decoration- Returns:
- a component
- Since:
- 4.0.0
-
decoration
Gets the state of a decoration on this component.- Specified by:
decorationin interfaceStyleGetter- Parameters:
decoration- the decoration- Returns:
TextDecoration.State.TRUEif this component has the decoration,TextDecoration.State.FALSEif this component does not have the decoration, andTextDecoration.State.NOT_SETif not set- Since:
- 4.0.0
-
decoration
Sets the state of a decoration on this component.- Specified by:
decorationin interfaceStyleSetter<Component>- Parameters:
decoration- the decorationflag-trueif this component should have the decoration,falseif this component should not have the decoration- Returns:
- a component
- Since:
- 4.0.0
-
decoration
@Contract(pure=true) default Component decoration(TextDecoration decoration, TextDecoration.State state) Sets the value of a decoration on this component.- Specified by:
decorationin interfaceStyleSetter<Component>- 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:
- a component
- Since:
- 4.0.0
-
decorationIfAbsent
Sets the state of a decoration on this component tostateif the current state of the decoration isTextDecoration.State.NOT_SET.- Specified by:
decorationIfAbsentin interfaceStyleSetter<Component>- Parameters:
decoration- the decorationstate- the state- Returns:
- a component
- Since:
- 4.12.0
-
decorations
Gets a map of decorations this component has.- Specified by:
decorationsin interfaceStyleGetter- Returns:
- a map of decorations this component has
- Since:
- 4.0.0
-
decorations
@Contract(pure=true) default Component decorations(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.
- Specified by:
decorationsin interfaceStyleSetter<Component>- Parameters:
decorations- a set of default values- Returns:
- a component
- Since:
- 4.0.0
-
clickEvent
Gets the click event of this component.- Specified by:
clickEventin interfaceStyleGetter- Returns:
- the click event
- Since:
- 4.0.0
-
clickEvent
Sets the click event of this component.- Specified by:
clickEventin interfaceStyleSetter<Component>- Parameters:
event- the click event- Returns:
- a component
- Since:
- 4.0.0
-
hoverEvent
Gets the hover event of this component.- Specified by:
hoverEventin interfaceStyleGetter- Returns:
- the hover event
- Since:
- 4.0.0
-
hoverEvent
Sets the hover event of this component.- Specified by:
hoverEventin interfaceStyleSetter<Component>- Parameters:
source- the hover event source- Returns:
- a component
- Since:
- 4.0.0
-
insertion
Gets the string to be inserted when this component is shift-clicked.- Specified by:
insertionin interfaceStyleGetter- Returns:
- the insertion string
- Since:
- 4.0.0
-
insertion
Sets the string to be inserted when this component is shift-clicked.- Specified by:
insertionin interfaceStyleSetter<Component>- Parameters:
insertion- the insertion string- Returns:
- a component
- Since:
- 4.0.0
-
hasStyling
default 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
-
replaceText
@Contract(pure=true) default Component replaceText(Consumer<TextReplacementConfig.Builder> configurer) Finds 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
-
replaceText
Finds 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
-
compact
Create a new component with any redundant style elements or children removed.- Returns:
- the optimized component
- Since:
- 4.9.0
-
compact
Create a new component with any redundant style elements or children removed. It is assumed that the component will inherit the givenparentStyle.- Parameters:
parentStyle- the style of the parent of this component- Returns:
- the optimized component
- Since:
- 4.25.0
-
iterable
default Iterable<Component> iterable(ComponentIteratorType type, ComponentIteratorFlag @Nullable ... flags) Returns an iterable view of this component.- Parameters:
type- the typeflags- the flags- Returns:
- the iterable
- Since:
- 4.9.0
-
iterable
Returns an iterable view of this component.- Parameters:
type- the typeflags- the flags- Returns:
- the iterable
- Since:
- 4.9.0
-
iterator
default Iterator<Component> iterator(ComponentIteratorType type, ComponentIteratorFlag @Nullable ... flags) Returns an iterator for this component.As components are immutable, this iterator does not support removal.
- Parameters:
type- the typeflags- the flags- Returns:
- the iterator
- Since:
- 4.9.0
-
iterator
Returns an iterator for this component.As components are immutable, this iterator does not support removal.
- Parameters:
type- the typeflags- the flags- Returns:
- the iterator
- Since:
- 4.9.0
-
spliterator
default Spliterator<Component> spliterator(ComponentIteratorType type, ComponentIteratorFlag @Nullable ... flags) Returns a spliterator for this component.The resulting spliterator has the
Spliterator.IMMUTABLE,Spliterator.NONNULLandSpliterator.ORDEREDcharacteristics.- Parameters:
type- the typeflags- the flags- Returns:
- the spliterator
- Since:
- 4.9.0
-
spliterator
default Spliterator<Component> spliterator(ComponentIteratorType type, Set<ComponentIteratorFlag> flags) Returns a spliterator for this component.The resulting spliterator has the
Spliterator.IMMUTABLE,Spliterator.NONNULLandSpliterator.ORDEREDcharacteristics.- Parameters:
type- the typeflags- the flags- Returns:
- the spliterator
- Since:
- 4.9.0
-
toBuilder
ComponentBuilder<?,?> toBuilder()Returns a builder for this component.- Returns:
- the builder
- Since:
- 4.26.0
-
componentBuilderApply
Description copied from interface:ComponentBuilderApplicableApplies tocomponent.- Specified by:
componentBuilderApplyin interfaceComponentBuilderApplicable- Parameters:
component- the component builder
-
asComponent
Description copied from interface:ComponentLikeGets aComponentrepresentation.- Specified by:
asComponentin interfaceComponentLike- Returns:
- a component
-
asHoverEvent
Description 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 interfaceHoverEventSource<Component>- Parameters:
op- transformation on value- Returns:
- a hover event
-