Class TextVisitFactory

java.lang.Object
net.minecraft.text.TextVisitFactory

public class TextVisitFactory extends Object
A utility class for visiting the characters of strings, handling surrogate code points and formatting codes.
Mappings:
Namespace Name
official apz
intermediary net/minecraft/class_5223
named net/minecraft/text/TextVisitFactory
  • Field Details

    • REPLACEMENT_CHARACTER

      private static final char REPLACEMENT_CHARACTER
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lapz;a:C
      intermediary field_29861 Lnet/minecraft/class_5223;field_29861:C
      named REPLACEMENT_CHARACTER Lnet/minecraft/text/TextVisitFactory;REPLACEMENT_CHARACTER:C
    • VISIT_TERMINATED

      private static final Optional<Object> VISIT_TERMINATED
      Mappings:
      Namespace Name Mixin selector
      official b Lapz;b:Ljava/util/Optional;
      intermediary field_24215 Lnet/minecraft/class_5223;field_24215:Ljava/util/Optional;
      named VISIT_TERMINATED Lnet/minecraft/text/TextVisitFactory;VISIT_TERMINATED:Ljava/util/Optional;
  • Constructor Details

    • TextVisitFactory

      public TextVisitFactory()
  • Method Details

    • visitRegularCharacter

      private static boolean visitRegularCharacter(Style style, CharacterVisitor visitor, int index, char c)
      Mappings:
      Namespace Name Mixin selector
      official a Lapz;a(Luf;Laow;IC)Z
      intermediary method_27477 Lnet/minecraft/class_5223;method_27477(Lnet/minecraft/class_2583;Lnet/minecraft/class_5224;IC)Z
      named visitRegularCharacter Lnet/minecraft/text/TextVisitFactory;visitRegularCharacter(Lnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;IC)Z
    • visitForwards

      public static boolean visitForwards(String text, Style style, CharacterVisitor visitor)
      Visits the code points of a string in forward (left to right) direction.
      Parameters:
      text - the string
      style - the style of the string
      visitor - the visitor of characters
      Returns:
      true if the full string was visited, or false indicating the visitor terminated half-way
      Mappings:
      Namespace Name Mixin selector
      official a Lapz;a(Ljava/lang/String;Luf;Laow;)Z
      intermediary method_27474 Lnet/minecraft/class_5223;method_27474(Ljava/lang/String;Lnet/minecraft/class_2583;Lnet/minecraft/class_5224;)Z
      named visitForwards Lnet/minecraft/text/TextVisitFactory;visitForwards(Ljava/lang/String;Lnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z
    • visitBackwards

      public static boolean visitBackwards(String text, Style style, CharacterVisitor visitor)
      Visits the code points of a string in backward (right to left) direction.
      Parameters:
      text - the string
      style - the style of the string
      visitor - the visitor
      Returns:
      true if the full string was visited, or false indicating the visitor terminated half-way
      Mappings:
      Namespace Name Mixin selector
      official b Lapz;b(Ljava/lang/String;Luf;Laow;)Z
      intermediary method_27478 Lnet/minecraft/class_5223;method_27478(Ljava/lang/String;Lnet/minecraft/class_2583;Lnet/minecraft/class_5224;)Z
      named visitBackwards Lnet/minecraft/text/TextVisitFactory;visitBackwards(Ljava/lang/String;Lnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z
    • visitFormatted

      public static boolean visitFormatted(String text, Style style, CharacterVisitor visitor)
      Visits the code points of a string, applying the formatting codes within.

      The visit is in forward direction.

      Parameters:
      text - the string visited
      style - the style of the string
      visitor - the visitor
      Returns:
      true if the full string was visited, or false indicating the visitor terminated half-way
      Mappings:
      Namespace Name Mixin selector
      official c Lapz;c(Ljava/lang/String;Luf;Laow;)Z
      intermediary method_27479 Lnet/minecraft/class_5223;method_27479(Ljava/lang/String;Lnet/minecraft/class_2583;Lnet/minecraft/class_5224;)Z
      named visitFormatted Lnet/minecraft/text/TextVisitFactory;visitFormatted(Ljava/lang/String;Lnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z
    • visitFormatted

      public static boolean visitFormatted(String text, int startIndex, Style style, CharacterVisitor visitor)
      Visits the code points of a string, applying the formatting codes within.

      The visit is in forward direction.

      Parameters:
      text - the string visited
      startIndex - the starting index of the visit
      style - the style of the string
      Returns:
      true if the full string was visited, or false indicating the visitor terminated half-way
      Mappings:
      Namespace Name Mixin selector
      official a Lapz;a(Ljava/lang/String;ILuf;Laow;)Z
      intermediary method_27472 Lnet/minecraft/class_5223;method_27472(Ljava/lang/String;ILnet/minecraft/class_2583;Lnet/minecraft/class_5224;)Z
      named visitFormatted Lnet/minecraft/text/TextVisitFactory;visitFormatted(Ljava/lang/String;ILnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z
    • visitFormatted

      public static boolean visitFormatted(String text, int startIndex, Style startingStyle, Style resetStyle, CharacterVisitor visitor)
      Visits the code points of a string, applying the formatting codes within.

      The visit is in forward direction.

      Parameters:
      text - the string visited
      startIndex - the starting index of the visit
      startingStyle - the style of the string when the visit starts
      resetStyle - the style to reset to when a §r formatting code is encountered
      visitor - the visitor
      Returns:
      true if the full string was visited, or false indicating the visitor terminated half-way
      Mappings:
      Namespace Name Mixin selector
      official a Lapz;a(Ljava/lang/String;ILuf;Luf;Laow;)Z
      intermediary method_27473 Lnet/minecraft/class_5223;method_27473(Ljava/lang/String;ILnet/minecraft/class_2583;Lnet/minecraft/class_2583;Lnet/minecraft/class_5224;)Z
      named visitFormatted Lnet/minecraft/text/TextVisitFactory;visitFormatted(Ljava/lang/String;ILnet/minecraft/text/Style;Lnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z
    • visitFormatted

      public static boolean visitFormatted(StringVisitable text, Style style, CharacterVisitor visitor)
      Visits the code points for every literal string and the formatting codes supplied by the renderable.

      The visit is in forward direction.

      Returns:
      true if the full string was visited, or false indicating the visitor terminated half-way
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lapz;a(Ltn;Luf;Laow;)Z
      intermediary method_27476 Lnet/minecraft/class_5223;method_27476(Lnet/minecraft/class_5348;Lnet/minecraft/class_2583;Lnet/minecraft/class_5224;)Z
      named visitFormatted Lnet/minecraft/text/TextVisitFactory;visitFormatted(Lnet/minecraft/text/StringVisitable;Lnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z
    • validateSurrogates

      public static String validateSurrogates(String text)
      Returns a new string that has all surrogate characters within. The characters are validated from an original string text.
      Parameters:
      text - the original string
      Returns:
      a new string that has all surrogate characters within
      Mappings:
      Namespace Name Mixin selector
      official a Lapz;a(Ljava/lang/String;)Ljava/lang/String;
      intermediary method_27471 Lnet/minecraft/class_5223;method_27471(Ljava/lang/String;)Ljava/lang/String;
      named validateSurrogates Lnet/minecraft/text/TextVisitFactory;validateSurrogates(Ljava/lang/String;)Ljava/lang/String;
    • removeFormattingCodes

      public static String removeFormattingCodes(StringVisitable text)
      Mappings:
      Namespace Name Mixin selector
      official a Lapz;a(Ltn;)Ljava/lang/String;
      intermediary method_31402 Lnet/minecraft/class_5223;method_31402(Lnet/minecraft/class_5348;)Ljava/lang/String;
      named removeFormattingCodes Lnet/minecraft/text/TextVisitFactory;removeFormattingCodes(Lnet/minecraft/text/StringVisitable;)Ljava/lang/String;