Class CacheMetaCodec<A>

java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.cache.CacheMetaCodec<A>
Type Parameters:
A - the type encoded from and decoded to.
All Implemented Interfaces:
com.mojang.serialization.Codec<A>, com.mojang.serialization.Decoder<A>, com.mojang.serialization.Encoder<A>

public class CacheMetaCodec<A> extends Object implements com.mojang.serialization.Codec<A>
A Codec that adds any metadata provided by a CacheMetaDynamicOps to the encoded value while encoding.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A single type of metadata to process while encoding.

    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
    <T> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<A,T>>
    decode(com.mojang.serialization.DynamicOps<T> ops, T input)
     
    <T> com.mojang.serialization.DataResult<T>
    encode(A input, com.mojang.serialization.DynamicOps<T> ops, T prefix)
     
    static <A> com.mojang.serialization.Codec<A>
    of(com.mojang.serialization.Codec<A> wrapped, List<CacheMetaCodec.SingleCacheType<?,A>> dataConsumers)
    Creates a new codec with the provided behaviour, based on an existing codec.

    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 <T> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<A,T>> decode(com.mojang.serialization.DynamicOps<T> ops, T input)
      Specified by:
      decode in interface com.mojang.serialization.Decoder<A>
    • encode

      public <T> com.mojang.serialization.DataResult<T> encode(A input, com.mojang.serialization.DynamicOps<T> ops, T prefix)
      Specified by:
      encode in interface com.mojang.serialization.Encoder<A>
    • of

      public static <A> com.mojang.serialization.Codec<A> of(com.mojang.serialization.Codec<A> wrapped, List<CacheMetaCodec.SingleCacheType<?,A>> dataConsumers)
      Creates a new codec with the provided behaviour, based on an existing codec.
      Type Parameters:
      A - the type encoded from and decoded to
      Parameters:
      wrapped - the codec to wrap; will be used directly for decoding, and delegated to for encoding
      dataConsumers - the metadata to process while encoding
      Returns:
      a new codec with the provided behaviour