E - the element typepublic final class RegistryElementCodec<E> extends Object implements com.mojang.serialization.Codec<Supplier<E>>
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.
RegistryCodec,
RegistryReadingOps,
RegistryOps| Modifier and Type | Field and Description |
|---|---|
private com.mojang.serialization.MapCodec<E> |
elementCodec |
private RegistryKey<Registry<E>> |
registryRef |
| Modifier | Constructor and Description |
|---|---|
private |
RegistryElementCodec(RegistryKey<Registry<E>> registryRef,
com.mojang.serialization.MapCodec<E> mapCodec) |
| Modifier and Type | Method and Description |
|---|---|
<T> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<Supplier<E>,T>> |
decode(com.mojang.serialization.DynamicOps<T> ops,
T input) |
<T> com.mojang.serialization.DataResult<T> |
encode(Supplier<E> supplier,
com.mojang.serialization.DynamicOps<T> dynamicOps,
T t) |
static <E> RegistryElementCodec<E> |
of(RegistryKey<Registry<E>> registryRef,
com.mojang.serialization.MapCodec<E> mapCodec) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcomapFlatMap, compoundList, deprecated, dispatch, dispatch, dispatchDeprecated, dispatchDeprecated, dispatchDeprecatedMap, dispatchDeprecatedMap, dispatchMap, dispatchMap, dispatchStable, dispatchStable, dispatchStableMap, dispatchStableMap, either, fieldOf, flatComapMap, flatXmap, list, listOf, mapEither, mapPair, mapResult, of, of, of, of, optionalField, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, pair, partialDispatch, partialDispatchMap, promotePartial, simpleMap, stable, unboundedMap, unit, unit, withDefault, withDefault, withDefault, withDefault, withDefault, withDefault, withLifecycle, xmapprivate final RegistryKey<Registry<E>> registryRef
private final com.mojang.serialization.MapCodec<E> elementCodec
private RegistryElementCodec(RegistryKey<Registry<E>> registryRef, com.mojang.serialization.MapCodec<E> mapCodec)
public static <E> RegistryElementCodec<E> of(RegistryKey<Registry<E>> registryRef, com.mojang.serialization.MapCodec<E> mapCodec)
public <T> com.mojang.serialization.DataResult<T> encode(Supplier<E> supplier, com.mojang.serialization.DynamicOps<T> dynamicOps, T t)
public <T> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<Supplier<E>,T>> decode(com.mojang.serialization.DynamicOps<T> ops, T input)