Package net.kyori.adventure.text
Interface ComponentLike
-
- All Known Subinterfaces:
BlockNBTComponent
,BlockNBTComponent.Builder
,BuildableComponent<C,B>
,Component
,ComponentBuilder<C,B>
,EntityNBTComponent
,EntityNBTComponent.Builder
,KeybindComponent
,KeybindComponent.Builder
,NBTComponent<C,B>
,NBTComponentBuilder<C,B>
,ScopedComponent<C>
,ScoreComponent
,ScoreComponent.Builder
,SelectorComponent
,SelectorComponent.Builder
,StorageNBTComponent
,StorageNBTComponent.Builder
,TextComponent
,TextComponent.Builder
,TranslatableComponent
,TranslatableComponent.Builder
- All Known Implementing Classes:
AbstractComponent
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ComponentLike
Something that can be represented as aComponent
.- Since:
- 4.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Component
asComponent()
Gets aComponent
representation.static @NotNull java.util.List<Component>
asComponents(@NotNull java.util.List<? extends ComponentLike> likes)
Converts a list ofComponentLike
s to a list ofComponent
s.static @NotNull java.util.List<Component>
asComponents(@NotNull java.util.List<? extends ComponentLike> likes, @Nullable java.util.function.Predicate<? super Component> filter)
Converts a list ofComponentLike
s to a list ofComponent
s.static @Nullable Component
unbox(@Nullable ComponentLike like)
Fetches aComponent
from aComponentLike
.
-
-
-
Method Detail
-
asComponents
@NotNull static @NotNull java.util.List<Component> asComponents(@NotNull @NotNull java.util.List<? extends ComponentLike> likes)
Converts a list ofComponentLike
s to a list ofComponent
s.- Parameters:
likes
- the component-likes- Returns:
- the components
- Since:
- 4.8.0
-
asComponents
@NotNull static @NotNull java.util.List<Component> asComponents(@NotNull @NotNull java.util.List<? extends ComponentLike> likes, @Nullable @Nullable java.util.function.Predicate<? super Component> filter)
Converts a list ofComponentLike
s to a list ofComponent
s.Only components that match
filter
will be returned.- Parameters:
likes
- the component-likesfilter
- the component filter- Returns:
- the components
- Since:
- 4.8.0
-
unbox
@Nullable static @Nullable Component unbox(@Nullable @Nullable ComponentLike like)
Fetches aComponent
from aComponentLike
.- Parameters:
like
- the component-like- Returns:
- a component, or
null
- Since:
- 4.8.0
-
-