Interface ComponentLike
- All Known Subinterfaces:
BlockNBTComponent, BlockNBTComponent.Builder, Component, ComponentBuilder<C,B>, EntityNBTComponent, EntityNBTComponent.Builder, KeybindComponent, KeybindComponent.Builder, NBTComponent<C>, NBTComponentBuilder<C, B>, ObjectComponent, ObjectComponent.Builder, ScopedComponent<C>, ScoreComponent, ScoreComponent.Builder, SelectorComponent, SelectorComponent.Builder, StorageNBTComponent, StorageNBTComponent.Builder, TextComponent, TextComponent.Builder, TranslatableComponent, TranslatableComponent.Builder, TranslationArgument, TranslationArgumentLike, VirtualComponent
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Something that can be represented as a
Component.- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionGets aComponentrepresentation.asComponents(List<? extends ComponentLike> likes) Converts a list ofComponentLikes to a list ofComponents.asComponents(List<? extends ComponentLike> likes, @Nullable Predicate<? super Component> filter) Converts a list ofComponentLikes to a list ofComponents.static @Nullable Componentunbox(@Nullable ComponentLike like) Fetches aComponentfrom aComponentLike.
-
Method Details
-
asComponents
Converts a list ofComponentLikes to a list ofComponents.- Parameters:
likes- the component-likes- Returns:
- the components
- Since:
- 4.8.0
-
asComponents
static List<Component> asComponents(List<? extends ComponentLike> likes, @Nullable Predicate<? super Component> filter) Converts a list ofComponentLikes to a list ofComponents.Only components that match
filterwill be returned.- Parameters:
likes- the component-likesfilter- the component filter- Returns:
- the components
- Since:
- 4.8.0
-
unbox
@Contract("null -> null; !null -> !null") static @Nullable Component unbox(@Nullable ComponentLike like) Fetches aComponentfrom aComponentLike.- Parameters:
like- the component-like- Returns:
- a component, or
null - Since:
- 4.8.0
-
asComponent
-