Class TextVisitFactory

java.lang.Object
net.minecraft.client.font.TextVisitFactory

@Environment(CLIENT)
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 agh
intermediary net/minecraft/class_5223
named net/minecraft/client/font/TextVisitFactory
  • Field Details

    • VISIT_TERMINATED

      private static final Optional<Object> VISIT_TERMINATED
      Mappings:
      Namespace Name Mixin selector
      official a Lagh;a:Ljava/util/Optional;
      intermediary field_24215 Lnet/minecraft/class_5223;field_24215:Ljava/util/Optional;
      named VISIT_TERMINATED Lnet/minecraft/client/font/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 Lagh;a(Los;Laft;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/client/font/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 Lagh;a(Ljava/lang/String;Los;Laft;)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/client/font/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 Lagh;b(Ljava/lang/String;Los;Laft;)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/client/font/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 Lagh;c(Ljava/lang/String;Los;Laft;)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/client/font/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 Lagh;a(Ljava/lang/String;ILos;Laft;)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/client/font/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 Lagh;a(Ljava/lang/String;ILos;Los;Laft;)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/client/font/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:
      StringVisitable.visit(StringVisitable.StyledVisitor, Style)
      Mappings:
      Namespace Name Mixin selector
      official a Lagh;a(Lol;Los;Laft;)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/client/font/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 validated from an original string.
      Parameters:
      text - the original string
      Mappings:
      Namespace Name Mixin selector
      official a Lagh;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/client/font/TextVisitFactory;validateSurrogates(Ljava/lang/String;)Ljava/lang/String;
    • removeFormattingCodes

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