Interface TextVisitor<T>
- Type Parameters:
T- the optional short circuit return type, to match the semantics ofStringVisitable.VisitorandStringVisitable.StyledVisitor.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An extension of
StringVisitable.StyledVisitor with access to the underlying Text objects.-
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayDeque<net.minecraft.text.Text> collectSiblings(net.minecraft.text.Text text) Collapses the tree ofTextsiblings into a one dimensional FIFOQueue.static <T> Optional<T> visit(net.minecraft.text.Text text, TextVisitor<T> visitor, net.minecraft.text.Style baseStyle)
-
Method Details
-
accept
-
visit
static <T> Optional<T> visit(net.minecraft.text.Text text, TextVisitor<T> visitor, net.minecraft.text.Style baseStyle) -
collectSiblings
Collapses the tree ofTextsiblings into a one dimensional FIFOQueue. To match the behaviours of theText.visit(StringVisitable.Visitor)andText.visit(StringVisitable.StyledVisitor, Style)methods, texts with empty contents (created fromText.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.
-