Package com.mojang.serialization
Interface Codec.ResultFunction<A>
- Type Parameters:
A
- the type to encode and decode
public static interface Codec.ResultFunction<A>
An operator on the result a codec, describing how to transform the result on both encoding and decoding.
-
Method Summary
Modifier and TypeMethodDescription<T> DataResult<Pair<A,
T>> apply
(DynamicOps<T> ops, T input, DataResult<Pair<A, T>> a) Transforms the result of decoding.<T> DataResult<T>
coApply
(DynamicOps<T> ops, A input, DataResult<T> t) Transforms the result of encoding.
-
Method Details
-
apply
Transforms the result of decoding.- Type Parameters:
T
- the type of the serialized form- Parameters:
ops
- aDynamicOps
for the serialized forminput
- the original dataa
- the result of the original decoding, holding a pair of the decoded data and the remaining serialized data- Returns:
- a result holding a pair of the decoded data and the remaining serialized data
-
coApply
Transforms the result of encoding.- Type Parameters:
T
- the type of the serialized form- Parameters:
ops
- aDynamicOps
for the serialized forminput
- the original datat
- the result of the original encoding, holding the serialized data- Returns:
- a result holding serialized data
-