E
- the registry's element typepublic final class RegistryCodec<E> extends Object implements com.mojang.serialization.Codec<SimpleRegistry<E>>
SimpleRegistry
.
Compared to regular codec, this codec performs additional work when decoding, loading its elements from the given resource manager's JSON files.
RegistryElementCodec
,
RegistryOps
Modifier and Type | Field and Description |
---|---|
private com.mojang.serialization.Codec<SimpleRegistry<E>> |
delegate |
private com.mojang.serialization.Codec<E> |
elementCodec |
private RegistryKey<? extends Registry<E>> |
registryRef |
Modifier | Constructor and Description |
---|---|
private |
RegistryCodec(RegistryKey<? extends Registry<E>> registryRef,
com.mojang.serialization.Lifecycle lifecycle,
com.mojang.serialization.Codec<E> codec) |
Modifier and Type | Method and Description |
---|---|
<T> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<SimpleRegistry<E>,T>> |
decode(com.mojang.serialization.DynamicOps<T> ops,
T input) |
<T> com.mojang.serialization.DataResult<T> |
encode(SimpleRegistry<E> simpleRegistry,
com.mojang.serialization.DynamicOps<T> dynamicOps,
T t) |
static <E> RegistryCodec<E> |
of(RegistryKey<? extends Registry<E>> registryRef,
com.mojang.serialization.Lifecycle lifecycle,
com.mojang.serialization.Codec<E> codec) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
checkRange, comapFlatMap, compoundList, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, doubleRange, either, fieldOf, flatComapMap, flatXmap, floatRange, intRange, list, listOf, mapEither, mapPair, mapResult, of, of, of, of, optionalField, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, pair, partialDispatch, promotePartial, simpleMap, stable, unboundedMap, unit, unit, withLifecycle, xmap
private final com.mojang.serialization.Codec<SimpleRegistry<E>> delegate
private final RegistryKey<? extends Registry<E>> registryRef
private final com.mojang.serialization.Codec<E> elementCodec
private RegistryCodec(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Lifecycle lifecycle, com.mojang.serialization.Codec<E> codec)
public static <E> RegistryCodec<E> of(RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Lifecycle lifecycle, com.mojang.serialization.Codec<E> codec)
public <T> com.mojang.serialization.DataResult<T> encode(SimpleRegistry<E> simpleRegistry, com.mojang.serialization.DynamicOps<T> dynamicOps, T t)
encode
in interface com.mojang.serialization.Encoder<SimpleRegistry<E>>
public <T> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<SimpleRegistry<E>,T>> decode(com.mojang.serialization.DynamicOps<T> ops, T input)
decode
in interface com.mojang.serialization.Decoder<SimpleRegistry<E>>