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 Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A facet that sends action bars.
    static interface 
    A facet that opens a book.
    static interface 
    A facet that listens to boss bar changes.
    static interface 
    A facet that listens to boss bar changes, using fake entities.
    static interface 
    A facet that listens to boss bar changes, using packets.
    static interface 
    A facet that sends chat messages.
    static interface 
    A facet that sends chat messages, using packets.
    static interface 
    Create a sound that follows a certain entity.
    static interface 
    A facet for spawning client-side entities.
    static interface 
    A facet that converts components between formats.
    static interface 
    Methods for building pointers.
    static interface 
    A facet that requires a 3D vector.
    static interface 
    A facet that plays and stops sounds.
    static interface 
    Methods for working with the player tab list.
    static interface 
    A facet that shows, clears, and resets titles.
    static interface 
    A facet that sends titles, using packets.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    isApplicable(V viewer)
    Gets whether this handler is applicable to a particular viewer.
    default boolean
    Gets whether this handler is supported by the current runtime.
    static <V, F extends Facet<? extends V>>
    @NotNull Collection<F>
    of(@NotNull Supplier<F>... suppliers)
    Creates a collection of supported facets.
    static <V, F extends Facet<V>>
    F
    of(@Nullable Collection<F> facets, V viewer)
    Gets the first applicable facet for a viewer.
  • 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 type
      F - 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 type
      F - a facet type
      Parameters:
      facets - a collection of supported facets
      viewer - a viewer
      Returns:
      a facet or null if 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

      default boolean isApplicable(@NotNull V viewer)
      Gets whether this handler is applicable to a particular viewer.

      This should only be invoked if isSupported() is true.

      Parameters:
      viewer - a viewer
      Returns:
      if this handler is applicable to a viewer
      Since:
      4.0.0