Interface TextVisitor<T>

Type Parameters:
T - the optional short circuit return type, to match the semantics of StringVisitable.Visitor and StringVisitable.StyledVisitor.
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 TextVisitor<T>
An extension of StringVisitable.StyledVisitor with access to the underlying Text objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    accept(net.minecraft.text.Text text, net.minecraft.text.Style style, String string)
     
    static ArrayDeque<net.minecraft.text.Text>
    collectSiblings(net.minecraft.text.Text text)
    Collapses the tree of Text siblings into a one dimensional FIFO Queue.
    static <T> Optional<T>
    visit(net.minecraft.text.Text text, TextVisitor<T> visitor, net.minecraft.text.Style baseStyle)
     
  • Method Details

    • accept

      Optional<T> accept(net.minecraft.text.Text text, net.minecraft.text.Style style, String string)
    • visit

      static <T> Optional<T> visit(net.minecraft.text.Text text, TextVisitor<T> visitor, net.minecraft.text.Style baseStyle)
    • collectSiblings

      static ArrayDeque<net.minecraft.text.Text> collectSiblings(net.minecraft.text.Text text)
      Collapses the tree of Text siblings into a one dimensional FIFO Queue. To match the behaviours of the Text.visit(StringVisitable.Visitor) and Text.visit(StringVisitable.StyledVisitor, Style) methods, texts with empty contents (created from Text.empty()) are ignored but their siblings are still processed.
      Parameters:
      text - the text
      Returns:
      the text and its siblings in the order they appear when rendered.