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 encodingA- the type encoded from and decoded to
- Enclosing class:
CacheMetaCodec<A>
A single type of metadata to process while encoding.
-
Method Summary
Modifier and TypeMethodDescription<T> com.mojang.serialization.DataResult<T> encode(A input, CacheMetaDynamicOps<T> ops, com.mojang.serialization.DataResult<T> result) static <D,A> CacheMetaCodec.SingleCacheType <D, A> of(DataConsumer<D, A> dataConsumer, String cacheKey, Class<? super D> dataClass) Creates a newCacheMetaCodec.SingleCacheTypewith the provided behaviour, multiple of which can be accumulated onto a single caching codec.
-
Method Details
-
of
public static <D,A> CacheMetaCodec.SingleCacheType<D,A> of(DataConsumer<D, A> dataConsumer, String cacheKey, Class<? super D> dataClass) Creates a newCacheMetaCodec.SingleCacheTypewith the provided behaviour, multiple of which can be accumulated onto a single caching codec.- Type Parameters:
D- the type of metadata to process while encodingA- the type encoded from and decoded to- Parameters:
dataConsumer- provides encodable data given the context of the encoding and the object to encodecacheKey- the key to use for the metadata in the encoded valuedataClass- the class of the metadata to process while encoding- Returns:
- a new
CacheMetaCodec.SingleCacheTypewith the provided behaviour
-
encode
public <T> com.mojang.serialization.DataResult<T> encode(A input, CacheMetaDynamicOps<T> ops, com.mojang.serialization.DataResult<T> result)
-