Class Text.Serializer

java.lang.Object
net.minecraft.text.Text.Serializer
All Implemented Interfaces:
JsonDeserializer<MutableText>, JsonSerializer<Text>
Enclosing interface:
Text

public static class Text.Serializer extends Object implements JsonDeserializer<MutableText>, JsonSerializer<Text>
A JSON serializer for Text.
Mappings:
Namespace Name
official sw$a
intermediary net/minecraft/class_2561$class_2562
named net/minecraft/text/Text$Serializer
  • Field Details

    • GSON

      private static final Gson GSON
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a:Lcom/google/gson/Gson;
      intermediary field_11754 Lnet/minecraft/class_2561$class_2562;field_11754:Lcom/google/gson/Gson;
      named GSON Lnet/minecraft/text/Text$Serializer;GSON:Lcom/google/gson/Gson;
    • JSON_READER_POS

      private static final Field JSON_READER_POS
      Mappings:
      Namespace Name Mixin selector
      official b Lsw$a;b:Ljava/lang/reflect/Field;
      intermediary field_11753 Lnet/minecraft/class_2561$class_2562;field_11753:Ljava/lang/reflect/Field;
      named JSON_READER_POS Lnet/minecraft/text/Text$Serializer;JSON_READER_POS:Ljava/lang/reflect/Field;
    • JSON_READER_LINE_START

      private static final Field JSON_READER_LINE_START
      Mappings:
      Namespace Name Mixin selector
      official c Lsw$a;c:Ljava/lang/reflect/Field;
      intermediary field_11752 Lnet/minecraft/class_2561$class_2562;field_11752:Ljava/lang/reflect/Field;
      named JSON_READER_LINE_START Lnet/minecraft/text/Text$Serializer;JSON_READER_LINE_START:Ljava/lang/reflect/Field;
  • Constructor Details

    • Serializer

      public Serializer()
  • Method Details

    • deserialize

      public MutableText deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException
      Specified by:
      deserialize in interface JsonDeserializer<MutableText>
      Throws:
      JsonParseException
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Ltj;
      intermediary method_10871 Lnet/minecraft/class_2561$class_2562;method_10871(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/class_5250;
      named deserialize Lnet/minecraft/text/Text$Serializer;deserialize(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/text/MutableText;
    • optimizeArgument

      private static Object optimizeArgument(Object text)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Ljava/lang/Object;)Ljava/lang/Object;
      intermediary method_43474 Lnet/minecraft/class_2561$class_2562;method_43474(Ljava/lang/Object;)Ljava/lang/Object;
      named optimizeArgument Lnet/minecraft/text/Text$Serializer;optimizeArgument(Ljava/lang/Object;)Ljava/lang/Object;
    • getSeparator

      private Optional<Text> getSeparator(Type type, JsonDeserializationContext context, JsonObject json)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;Lcom/google/gson/JsonObject;)Ljava/util/Optional;
      intermediary method_36329 Lnet/minecraft/class_2561$class_2562;method_36329(Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;Lcom/google/gson/JsonObject;)Ljava/util/Optional;
      named getSeparator Lnet/minecraft/text/Text$Serializer;getSeparator(Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;Lcom/google/gson/JsonObject;)Ljava/util/Optional;
    • addStyle

      private void addStyle(Style style, JsonObject json, JsonSerializationContext context)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Lts;Lcom/google/gson/JsonObject;Lcom/google/gson/JsonSerializationContext;)V
      intermediary method_10875 Lnet/minecraft/class_2561$class_2562;method_10875(Lnet/minecraft/class_2583;Lcom/google/gson/JsonObject;Lcom/google/gson/JsonSerializationContext;)V
      named addStyle Lnet/minecraft/text/Text$Serializer;addStyle(Lnet/minecraft/text/Style;Lcom/google/gson/JsonObject;Lcom/google/gson/JsonSerializationContext;)V
    • serialize

      public JsonElement serialize(Text text, Type type, JsonSerializationContext jsonSerializationContext)
      Specified by:
      serialize in interface JsonSerializer<Text>
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Lsw;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
      intermediary method_10874 Lnet/minecraft/class_2561$class_2562;method_10874(Lnet/minecraft/class_2561;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
      named serialize Lnet/minecraft/text/Text$Serializer;serialize(Lnet/minecraft/text/Text;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;
    • addSeparator

      private void addSeparator(JsonSerializationContext context, JsonObject json, Optional<Text> optionalSeparator)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Lcom/google/gson/JsonSerializationContext;Lcom/google/gson/JsonObject;Ljava/util/Optional;)V
      intermediary method_36328 Lnet/minecraft/class_2561$class_2562;method_36328(Lcom/google/gson/JsonSerializationContext;Lcom/google/gson/JsonObject;Ljava/util/Optional;)V
      named addSeparator Lnet/minecraft/text/Text$Serializer;addSeparator(Lcom/google/gson/JsonSerializationContext;Lcom/google/gson/JsonObject;Ljava/util/Optional;)V
    • toJson

      public static String toJson(Text text)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Lsw;)Ljava/lang/String;
      intermediary method_10867 Lnet/minecraft/class_2561$class_2562;method_10867(Lnet/minecraft/class_2561;)Ljava/lang/String;
      named toJson Lnet/minecraft/text/Text$Serializer;toJson(Lnet/minecraft/text/Text;)Ljava/lang/String;
    • toSortedJsonString

      public static String toSortedJsonString(Text text)
      Mappings:
      Namespace Name Mixin selector
      official b Lsw$a;b(Lsw;)Ljava/lang/String;
      intermediary method_43858 Lnet/minecraft/class_2561$class_2562;method_43858(Lnet/minecraft/class_2561;)Ljava/lang/String;
      named toSortedJsonString Lnet/minecraft/text/Text$Serializer;toSortedJsonString(Lnet/minecraft/text/Text;)Ljava/lang/String;
    • toJsonTree

      public static JsonElement toJsonTree(Text text)
      Mappings:
      Namespace Name Mixin selector
      official c Lsw$a;c(Lsw;)Lcom/google/gson/JsonElement;
      intermediary method_10868 Lnet/minecraft/class_2561$class_2562;method_10868(Lnet/minecraft/class_2561;)Lcom/google/gson/JsonElement;
      named toJsonTree Lnet/minecraft/text/Text$Serializer;toJsonTree(Lnet/minecraft/text/Text;)Lcom/google/gson/JsonElement;
    • fromJson

      @Nullable public static @Nullable MutableText fromJson(String json)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Ljava/lang/String;)Ltj;
      intermediary method_10877 Lnet/minecraft/class_2561$class_2562;method_10877(Ljava/lang/String;)Lnet/minecraft/class_5250;
      named fromJson Lnet/minecraft/text/Text$Serializer;fromJson(Ljava/lang/String;)Lnet/minecraft/text/MutableText;
    • fromJson

      @Nullable public static @Nullable MutableText fromJson(JsonElement json)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Lcom/google/gson/JsonElement;)Ltj;
      intermediary method_10872 Lnet/minecraft/class_2561$class_2562;method_10872(Lcom/google/gson/JsonElement;)Lnet/minecraft/class_5250;
      named fromJson Lnet/minecraft/text/Text$Serializer;fromJson(Lcom/google/gson/JsonElement;)Lnet/minecraft/text/MutableText;
    • fromLenientJson

      @Nullable public static @Nullable MutableText fromLenientJson(String json)
      Mappings:
      Namespace Name Mixin selector
      official b Lsw$a;b(Ljava/lang/String;)Ltj;
      intermediary method_10873 Lnet/minecraft/class_2561$class_2562;method_10873(Ljava/lang/String;)Lnet/minecraft/class_5250;
      named fromLenientJson Lnet/minecraft/text/Text$Serializer;fromLenientJson(Ljava/lang/String;)Lnet/minecraft/text/MutableText;
    • fromJson

      public static MutableText fromJson(com.mojang.brigadier.StringReader reader)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Lcom/mojang/brigadier/StringReader;)Ltj;
      intermediary method_10879 Lnet/minecraft/class_2561$class_2562;method_10879(Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/class_5250;
      named fromJson Lnet/minecraft/text/Text$Serializer;fromJson(Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/text/MutableText;
    • getPosition

      private static int getPosition(JsonReader reader)
      Mappings:
      Namespace Name Mixin selector
      official a Lsw$a;a(Lcom/google/gson/stream/JsonReader;)I
      intermediary method_10880 Lnet/minecraft/class_2561$class_2562;method_10880(Lcom/google/gson/stream/JsonReader;)I
      named getPosition Lnet/minecraft/text/Text$Serializer;getPosition(Lcom/google/gson/stream/JsonReader;)I