Package net.minecraft.util.dynamic
Class RegistryElementCodec<E>
java.lang.Object
net.minecraft.util.dynamic.RegistryElementCodec<E>
- Type Parameters:
E
- the element type
- All Implemented Interfaces:
com.mojang.serialization.Codec<Supplier<E>>
,com.mojang.serialization.Decoder<Supplier<E>>
,com.mojang.serialization.Encoder<Supplier<E>>
public final class RegistryElementCodec<E>
extends Object
implements com.mojang.serialization.Codec<Supplier<E>>
A codec for registry elements. Will prefer to encode/decode objects as
identifiers if they exist in a registry and falls back to full encoding/
decoding behavior if it cannot do so.
The codec's saves and loads Supplier<E>
in order to avoid early
loading from registry before a registry is fully loaded from a codec.
- See Also:
- Mappings:
Namespace Name official yb
intermediary net/minecraft/class_5381
named net/minecraft/util/dynamic/RegistryElementCodec
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mojang.serialization.Codec
com.mojang.serialization.Codec.ResultFunction<A extends Object>
-
Field Summary
Modifier and TypeFieldDescriptionprivate final boolean
private final com.mojang.serialization.Codec<E>
private final RegistryKey<? extends Registry<E>>
Fields inherited from interface com.mojang.serialization.Codec
BOOL, BYTE, BYTE_BUFFER, DOUBLE, EMPTY, FLOAT, INT, INT_STREAM, LONG, LONG_STREAM, PASSTHROUGH, SHORT, STRING
-
Constructor Summary
ModifierConstructorDescriptionprivate
RegistryElementCodec
(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> elementCodec, boolean allowInlineDefinitions) -
Method Summary
Modifier and TypeMethodDescriptiondecode
(com.mojang.serialization.DynamicOps<T> ops, T input) <T> com.mojang.serialization.DataResult<T>
method_31194
(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> elementCodec) static <E> RegistryElementCodec<E>
of
(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> elementCodec) private static <E> RegistryElementCodec<E>
of
(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> elementCodec, boolean allowInlineDefinitions) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mojang.serialization.Codec
comapFlatMap, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, fieldOf, flatComapMap, flatXmap, listOf, mapResult, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, partialDispatch, promotePartial, stable, withLifecycle, xmap
Methods inherited from interface com.mojang.serialization.Decoder
boxed, decode, flatMap, map, parse, parse, simple, terminal
Methods inherited from interface com.mojang.serialization.Encoder
comap, encodeStart, flatComap
-
Field Details
-
registryRef
- Mappings:
Namespace Name Mixin selector official a
Lyb;a:Lyg;
intermediary field_25507
Lnet/minecraft/class_5381;field_25507:Lnet/minecraft/class_5321;
named registryRef
Lnet/minecraft/util/dynamic/RegistryElementCodec;registryRef:Lnet/minecraft/util/registry/RegistryKey;
-
elementCodec
- Mappings:
Namespace Name Mixin selector official b
Lyb;b:Lcom/mojang/serialization/Codec;
intermediary field_25508
Lnet/minecraft/class_5381;field_25508:Lcom/mojang/serialization/Codec;
named elementCodec
Lnet/minecraft/util/dynamic/RegistryElementCodec;elementCodec:Lcom/mojang/serialization/Codec;
-
allowInlineDefinitions
private final boolean allowInlineDefinitions- Mappings:
Namespace Name Mixin selector official c
Lyb;c:Z
intermediary field_26758
Lnet/minecraft/class_5381;field_26758:Z
named allowInlineDefinitions
Lnet/minecraft/util/dynamic/RegistryElementCodec;allowInlineDefinitions:Z
-
-
Constructor Details
-
RegistryElementCodec
private RegistryElementCodec(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> elementCodec, boolean allowInlineDefinitions) - Mappings:
Namespace Name Mixin selector official <init>
Lyb;<init>(Lyg;Lcom/mojang/serialization/Codec;Z)V
intermediary <init>
Lnet/minecraft/class_5381;<init>(Lnet/minecraft/class_5321;Lcom/mojang/serialization/Codec;Z)V
named <init>
Lnet/minecraft/util/dynamic/RegistryElementCodec;<init>(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/Codec;Z)V
-
-
Method Details
-
of
public static <E> RegistryElementCodec<E> of(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> elementCodec) - Mappings:
Namespace Name Mixin selector official a
Lyb;a(Lyg;Lcom/mojang/serialization/Codec;)Lyb;
intermediary method_29749
Lnet/minecraft/class_5381;method_29749(Lnet/minecraft/class_5321;Lcom/mojang/serialization/Codec;)Lnet/minecraft/class_5381;
named of
Lnet/minecraft/util/dynamic/RegistryElementCodec;of(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/Codec;)Lnet/minecraft/util/dynamic/RegistryElementCodec;
-
method_31194
public static <E> com.mojang.serialization.Codec<List<Supplier<E>>> method_31194(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> elementCodec) - Mappings:
Namespace Name Mixin selector official b
Lyb;b(Lyg;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
intermediary method_31194
Lnet/minecraft/class_5381;method_31194(Lnet/minecraft/class_5321;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
named method_31194
Lnet/minecraft/util/dynamic/RegistryElementCodec;method_31194(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/Codec;)Lcom/mojang/serialization/Codec;
-
of
private static <E> RegistryElementCodec<E> of(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> elementCodec, boolean allowInlineDefinitions) - Mappings:
Namespace Name Mixin selector official a
Lyb;a(Lyg;Lcom/mojang/serialization/Codec;Z)Lyb;
intermediary method_31192
Lnet/minecraft/class_5381;method_31192(Lnet/minecraft/class_5321;Lcom/mojang/serialization/Codec;Z)Lnet/minecraft/class_5381;
named of
Lnet/minecraft/util/dynamic/RegistryElementCodec;of(Lnet/minecraft/util/registry/RegistryKey;Lcom/mojang/serialization/Codec;Z)Lnet/minecraft/util/dynamic/RegistryElementCodec;
-
encode
public <T> com.mojang.serialization.DataResult<T> encode(Supplier<E> supplier, com.mojang.serialization.DynamicOps<T> dynamicOps, T t) - Specified by:
encode
in interfacecom.mojang.serialization.Encoder<E>
- Mappings:
Namespace Name Mixin selector official a
Lyb;a(Ljava/util/function/Supplier;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;
intermediary method_29748
Lnet/minecraft/class_5381;method_29748(Ljava/util/function/Supplier;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;
named encode
Lnet/minecraft/util/dynamic/RegistryElementCodec;encode(Ljava/util/function/Supplier;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;
-
decode
public <T> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<Supplier<E>,T>> decode(com.mojang.serialization.DynamicOps<T> ops, T input) - Specified by:
decode
in interfacecom.mojang.serialization.Decoder<E>
- Mappings:
Namespace Name Mixin selector official decode
Lyb;decode(Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;
intermediary decode
Lnet/minecraft/class_5381;decode(Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;
named decode
Lnet/minecraft/util/dynamic/RegistryElementCodec;decode(Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;
-
toString
-