Interface ITextRenderer<T>

Type Parameters:
T - The output type of the renderer.
All Known Implementing Classes:
ITextRenderer.StringRenderer, TextRendererSpigot

public interface ITextRenderer<T>
Represents an interface that is used to render Text to other formats.

For example, to Strings. See ITextRenderer.StringRenderer.

The renderer receives pieces of either styled or unstyled text in the correct order. For styled text, a renderer may choose to process the embedded ITextDecorators if any exist. However, this is not required.

  • Method Details

    • process

      void process(String text)
      Processes a piece of unstyled text.
      Parameters:
      text - The text to process.
    • process

      void process(String text, TextComponent component)
      Processes a piece of styled text.
      Parameters:
      text - The text to process.
      component - The component containing additional information for the text processing.
    • getRendered

      T getRendered()
      Getter for the rendered text.
      Returns:
      The rendered result.
    • getDecoratorsOfType

      default <U extends ITextDecorator> Stream<U> getDecoratorsOfType(Class<U> clz, TextComponent component)
      Retrieves a stream of all decorators that are an instance of a given type.

      This stream is a filtered (and cast) subset of the decorators in the component.

      Type Parameters:
      U - The type of decorator to retrieve.
      Parameters:
      clz - The decorator class whose instances to retrieve.
      component - The component whose decorators to retrieve.
      Returns:
      The stream of text decorators of the provided type.