Class EnumCodec<T extends Enum<?>>

java.lang.Object
foundry.veil.api.util.EnumCodec<T>
Type Parameters:
T - The enum type to encode/decode
All Implemented Interfaces:
com.mojang.serialization.Codec<T>, com.mojang.serialization.Decoder<T>, com.mojang.serialization.Encoder<T>

public class EnumCodec<T extends Enum<?>> extends Object implements com.mojang.serialization.Codec<T>
Codec for serializing/deserializing enum constants.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Builder for creating a new EnumCodec.

    Nested classes/interfaces inherited from interface com.mojang.serialization.Codec

    com.mojang.serialization.Codec.RecursiveCodec<T>, com.mojang.serialization.Codec.ResultFunction<A>

    Nested classes/interfaces inherited from interface com.mojang.serialization.Decoder

    com.mojang.serialization.Decoder.Boxed<A>, com.mojang.serialization.Decoder.Simple<A>, com.mojang.serialization.Decoder.Terminal<A>
  • Field Summary

    Fields inherited from interface com.mojang.serialization.Codec

    BOOL, BYTE, BYTE_BUFFER, DOUBLE, EMPTY, FLOAT, INT, INT_STREAM, LONG, LONG_STREAM, PASSTHROUGH, SHORT, STRING
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Enum<?>>
    EnumCodec.Builder<T>
     
    <T1> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<T,T1>>
    decode(com.mojang.serialization.DynamicOps<T1> ops, T1 input)
     
    <T1> com.mojang.serialization.DataResult<T1>
    encode(T input, com.mojang.serialization.DynamicOps<T1> ops, T1 prefix)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.mojang.serialization.Codec

    comapFlatMap, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, fieldOf, flatComapMap, flatXmap, lenientOptionalFieldOf, lenientOptionalFieldOf, lenientOptionalFieldOf, lenientOptionalFieldOf, listOf, listOf, mapResult, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, partialDispatch, promotePartial, sizeLimitedListOf, stable, validate, 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
  • Method Details

    • decode

      public <T1> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<T,T1>> decode(com.mojang.serialization.DynamicOps<T1> ops, T1 input)
      Specified by:
      decode in interface com.mojang.serialization.Decoder<T extends Enum<?>>
    • encode

      public <T1> com.mojang.serialization.DataResult<T1> encode(T input, com.mojang.serialization.DynamicOps<T1> ops, T1 prefix)
      Specified by:
      encode in interface com.mojang.serialization.Encoder<T extends Enum<?>>
    • builder

      public static <T extends Enum<?>> EnumCodec.Builder<T> builder(String name)