Class JsonSerializing.TypeHandler<E,​T extends JsonSerializableType<E>>

java.lang.Object
net.minecraft.util.JsonSerializing.TypeHandler<E,​T>
Enclosing class:
JsonSerializing

public static class JsonSerializing.TypeHandler<E,​T extends JsonSerializableType<E>>
extends Object
A handler of JSON serializable types that can either obtain a type from a registry to handle JSON conversion or handle with a custom logic bound to a type.

When the root element read is an object, the handler obtains the type from registry to handle reading; otherwise, it falls back to custom logic.

Mappings:
Namespace Name
official def$a
intermediary net/minecraft/class_5330$class_5331
named net/minecraft/util/JsonSerializing$TypeHandler
  • Field Details

    • registry

      private final Registry<T extends JsonSerializableType<E>> registry
      Mappings:
      Namespace Name Mixin selector
      official a Ldef$a;a:Lgn;
      intermediary field_25192 Lnet/minecraft/class_5330$class_5331;field_25192:Lnet/minecraft/class_2378;
      named registry Lnet/minecraft/util/JsonSerializing$TypeHandler;registry:Lnet/minecraft/util/registry/Registry;
    • rootFieldName

      private final String rootFieldName
      Mappings:
      Namespace Name Mixin selector
      official b Ldef$a;b:Ljava/lang/String;
      intermediary field_25193 Lnet/minecraft/class_5330$class_5331;field_25193:Ljava/lang/String;
      named rootFieldName Lnet/minecraft/util/JsonSerializing$TypeHandler;rootFieldName:Ljava/lang/String;
    • idFieldName

      private final String idFieldName
      Mappings:
      Namespace Name Mixin selector
      official c Ldef$a;c:Ljava/lang/String;
      intermediary field_25194 Lnet/minecraft/class_5330$class_5331;field_25194:Ljava/lang/String;
      named idFieldName Lnet/minecraft/util/JsonSerializing$TypeHandler;idFieldName:Ljava/lang/String;
    • typeIdentification

      private final Function<E,​T extends JsonSerializableType<E>> typeIdentification
      Mappings:
      Namespace Name Mixin selector
      official d Ldef$a;d:Ljava/util/function/Function;
      intermediary field_25195 Lnet/minecraft/class_5330$class_5331;field_25195:Ljava/util/function/Function;
      named typeIdentification Lnet/minecraft/util/JsonSerializing$TypeHandler;typeIdentification:Ljava/util/function/Function;
    • customSerializer

      @Nullable private com.mojang.datafixers.util.Pair<T extends JsonSerializableType<E>,​JsonSerializing.CustomSerializer<? extends E>> customSerializer
      Mappings:
      Namespace Name Mixin selector
      official e Ldef$a;e:Lcom/mojang/datafixers/util/Pair;
      intermediary field_25196 Lnet/minecraft/class_5330$class_5331;field_25196:Lcom/mojang/datafixers/util/Pair;
      named customSerializer Lnet/minecraft/util/JsonSerializing$TypeHandler;customSerializer:Lcom/mojang/datafixers/util/Pair;
    • field_28444

      @Nullable private T extends JsonSerializableType<E> field_28444
      Mappings:
      Namespace Name Mixin selector
      official f Ldef$a;f:Ldep;
      intermediary field_28444 Lnet/minecraft/class_5330$class_5331;field_28444:Lnet/minecraft/class_5336;
      named field_28444 Lnet/minecraft/util/JsonSerializing$TypeHandler;field_28444:Lnet/minecraft/util/JsonSerializableType;
  • Constructor Details

    • TypeHandler

      private TypeHandler​(Registry<T> registry, String rootFieldName, String idFieldName, Function<E,​T> typeIdentification)
      Mappings:
      Namespace Name Mixin selector
      official <init> Ldef$a;<init>(Lgn;Ljava/lang/String;Ljava/lang/String;Ljava/util/function/Function;)V
      intermediary <init> Lnet/minecraft/class_5330$class_5331;<init>(Lnet/minecraft/class_2378;Ljava/lang/String;Ljava/lang/String;Ljava/util/function/Function;)V
      named <init> Lnet/minecraft/util/JsonSerializing$TypeHandler;<init>(Lnet/minecraft/util/registry/Registry;Ljava/lang/String;Ljava/lang/String;Ljava/util/function/Function;)V
  • Method Details

    • method_32385

      public JsonSerializing.TypeHandler<E,​T> method_32385​(T t, JsonSerializing.CustomSerializer<? extends E> customSerializer)
      Mappings:
      Namespace Name Mixin selector
      official a Ldef$a;a(Ldep;Ldef$b;)Ldef$a;
      intermediary method_32385 Lnet/minecraft/class_5330$class_5331;method_32385(Lnet/minecraft/class_5336;Lnet/minecraft/class_5330$class_5332;)Lnet/minecraft/class_5330$class_5331;
      named method_32385 Lnet/minecraft/util/JsonSerializing$TypeHandler;method_32385(Lnet/minecraft/util/JsonSerializableType;Lnet/minecraft/util/JsonSerializing$CustomSerializer;)Lnet/minecraft/util/JsonSerializing$TypeHandler;
    • method_33409

      public JsonSerializing.TypeHandler<E,​T> method_33409​(T t)
      Mappings:
      Namespace Name Mixin selector
      official a Ldef$a;a(Ldep;)Ldef$a;
      intermediary method_33409 Lnet/minecraft/class_5330$class_5331;method_33409(Lnet/minecraft/class_5336;)Lnet/minecraft/class_5330$class_5331;
      named method_33409 Lnet/minecraft/util/JsonSerializing$TypeHandler;method_33409(Lnet/minecraft/util/JsonSerializableType;)Lnet/minecraft/util/JsonSerializing$TypeHandler;
    • createGsonSerializer

      public Object createGsonSerializer()
      Mappings:
      Namespace Name Mixin selector
      official a Ldef$a;a()Ljava/lang/Object;
      intermediary method_29307 Lnet/minecraft/class_5330$class_5331;method_29307()Ljava/lang/Object;
      named createGsonSerializer Lnet/minecraft/util/JsonSerializing$TypeHandler;createGsonSerializer()Ljava/lang/Object;