Class CacheMetaCodec.SingleCacheType<D,A>

java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.cache.CacheMetaCodec.SingleCacheType<D,A>
Type Parameters:
D - the type of metadata to process while encoding
A - the type encoded from and decoded to
Enclosing class:
CacheMetaCodec<A>

public static final class CacheMetaCodec.SingleCacheType<D,A> extends Object
A single type of metadata to process while encoding.
  • Method Details

    • of

      public static <D, A> CacheMetaCodec.SingleCacheType<D,A> of(DataConsumer<D,A> dataConsumer, String cacheKey, Class<? super D> dataClass)
      Creates a new CacheMetaCodec.SingleCacheType with the provided behaviour, multiple of which can be accumulated onto a single caching codec.
      Type Parameters:
      D - the type of metadata to process while encoding
      A - the type encoded from and decoded to
      Parameters:
      dataConsumer - provides encodable data given the context of the encoding and the object to encode
      cacheKey - the key to use for the metadata in the encoded value
      dataClass - the class of the metadata to process while encoding
      Returns:
      a new CacheMetaCodec.SingleCacheType with the provided behaviour
    • encode

      public <T> com.mojang.serialization.DataResult<T> encode(A input, CacheMetaDynamicOps<T> ops, com.mojang.serialization.DataResult<T> result)