- Type Parameters:
T
- The type to be represented by this codec
- All Known Subinterfaces:
DataComponent<T>
,StructCodec<R>
A Codec
represents a combined Encoder
and Decoder
for a value.
Heavily inspired by Mojang/DataFixerUpper, licensed under the MIT license.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec
<byte[]> static final Codec
<int[]> static final Codec
<net.kyori.adventure.key.Key> static final Codec
<long[]> static final Codec
<net.kyori.adventure.nbt.BinaryTag> static final Codec
<net.kyori.adventure.nbt.CompoundBinaryTag> static final Codec
<Codec.RawValue> -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Codec
<T> ForwardRef
(Supplier<Codec<T>> func) list()
list
(int maxSize) listOrSingle
(int maxSize) optional()
static <T> Codec
<T> static <T> StructCodec
<T> RegistryTaggedUnion
(Registries.Selector<StructCodec<? extends T>> registrySelector, Function<T, StructCodec<? extends T>> serializerGetter, String key) static <T> StructCodec
<T> RegistryTaggedUnion
(Registry<StructCodec<? extends T>> registry, Function<T, StructCodec<? extends T>> serializerGetter, String key) set()
set
(int maxSize) default <S> Codec
<S> transform
(ThrowingFunction<T, S> to, ThrowingFunction<S, T> from) default <R,
T1 extends T, TR extends R>
StructCodec<R> default <R,
T1 extends T, TR extends R>
StructCodec<R> unionType
(Function<T, StructCodec<TR>> serializers, Function<R, T1> keyFunc)
-
Field Details
-
RAW_VALUE
-
UNIT
-
BOOLEAN
-
BYTE
-
SHORT
-
INT
-
LONG
-
FLOAT
-
DOUBLE
-
STRING
-
KEY
-
BYTE_ARRAY
-
INT_ARRAY
-
LONG_ARRAY
-
UUID
-
UUID_STRING
-
UUID_COERCED
-
COMPONENT
-
COMPONENT_STYLE
-
BLOCK_POSITION
-
VECTOR3D
-
NBT
-
NBT_COMPOUND
-
-
Method Details
-
Enum
-
Recursive
-
ForwardRef
-
RegistryTaggedUnion
static <T> StructCodec<T> RegistryTaggedUnion(Registry<StructCodec<? extends T>> registry, Function<T, StructCodec<? extends T>> serializerGetter, String key) -
RegistryTaggedUnion
static <T> StructCodec<T> RegistryTaggedUnion(Registries.Selector<StructCodec<? extends T>> registrySelector, Function<T, StructCodec<? extends T>> serializerGetter, String key) -
Either
-
optional
-
optional
-
transform
-
list
-
list
-
listOrSingle
-
listOrSingle
-
set
-
set
-
mapValue
-
mapValue
-
unionType
default <R,T1 extends T, StructCodec<R> unionTypeTR extends R> (Function<T, StructCodec<TR>> serializers, Function<R, T1> keyFunc) -
unionType
default <R,T1 extends T, StructCodec<R> unionTypeTR extends R> (String keyField, Function<T, StructCodec<TR>> serializers, Function<R, T1> keyFunc) -
orElse
-