Interface Facet<V>
- Type Parameters:
V- a viewer type
- All Known Subinterfaces:
Facet.ActionBar<V,,M> Facet.Book<V,,M, B> Facet.BossBar.Builder<V,,B> Facet.BossBarEntity<V,,P> Facet.Chat<V,,M> Facet.ChatPacket<V,,M> Facet.EntitySound<V,,M> Facet.FakeEntity<V,,P> Facet.Message<V,,M> Facet.Pointers<V>,Facet.Position<V,,P> Facet.Sound<V,,P> Facet.TabList<V,,M> Facet.Title<V,,M, C, T> Facet.TitlePacket<V,,M, C, T> FacetComponentFlattener.Translator<V>
- All Known Implementing Classes:
FacetBase
@Internal
public interface Facet<V>
A unit of functionality for a viewer.
This is not supported API. Subject to change at any time.
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA facet that sends action bars.static interfaceFacet.Book<V,M, B> A facet that opens a book.static interfaceA facet that listens to boss bar changes.static interfaceA facet that listens to boss bar changes, using fake entities.static interfaceA facet that listens to boss bar changes, using packets.static interfaceFacet.Chat<V,M> A facet that sends chat messages.static interfaceA facet that sends chat messages, using packets.static interfaceCreate a sound that follows a certain entity.static interfaceA facet for spawning client-side entities.static interfaceA facet that converts components between formats.static interfaceMethods for building pointers.static interfaceA facet that requires a 3D vector.static interfaceA facet that plays and stops sounds.static interfaceMethods for working with the player tab list.static interfaceFacet.Title<V,M, C, T> A facet that shows, clears, and resets titles.static interfaceA facet that sends titles, using packets. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanisApplicable(V viewer) Gets whether this handler is applicable to a particular viewer.default booleanGets whether this handler is supported by the current runtime.static <V,F extends Facet<V>>
Fof(@Nullable Collection<F> facets, V viewer) Gets the first applicable facet for a viewer.static <V,F extends Facet<? extends V>>
@NotNull Collection<F> Creates a collection of supported facets.
-
Method Details
-
of
@SafeVarargs @NotNull static <V,F extends Facet<? extends V>> @NotNull Collection<F> of(@NotNull @NotNull Supplier<F>... suppliers) Creates a collection of supported facets.- Type Parameters:
V- a viewer typeF- a facet type- Parameters:
suppliers- an array of facet suppliers- Returns:
- a collection of facets
- Since:
- 4.0.0
-
of
@Nullable static <V,F extends Facet<V>> F of(@Nullable @Nullable Collection<F> facets, @Nullable V viewer) Gets the first applicable facet for a viewer.- Type Parameters:
V- a viewer typeF- a facet type- Parameters:
facets- a collection of supported facetsviewer- a viewer- Returns:
- a facet or
nullif none are applicable - Since:
- 4.0.0
-
isSupported
default boolean isSupported()Gets whether this handler is supported by the current runtime.If not, this can be discarded since it will fail for all viewers.
- Returns:
- if this handler is supported
- Since:
- 4.0.0
-
isApplicable
Gets whether this handler is applicable to a particular viewer.This should only be invoked if
isSupported()istrue.- Parameters:
viewer- a viewer- Returns:
- if this handler is applicable to a viewer
- Since:
- 4.0.0
-