Class TCodec
java.lang.Object
com.thecsdev.commonmc.api.serialization.TCodec
Utility
Codec implementations and functions.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> @NotNull com.mojang.serialization.Codec<List<A>> lenientListOf(@NotNull com.mojang.serialization.Codec<A> codec) static <K,V> @NotNull com.mojang.serialization.Codec <Map<K, V>> lenientMap(@NotNull com.mojang.serialization.Codec<K> keyCodec, @NotNull com.mojang.serialization.Codec<V> valueCodec)
-
Field Details
-
URI
-
-
Method Details
-
lenientListOf
@NotNull public static <A> @NotNull com.mojang.serialization.Codec<List<A>> lenientListOf(@NotNull @NotNull com.mojang.serialization.Codec<A> codec) throws NullPointerException Returns aCodecfor aListof elements, that is lenient when encoding/decoding, and simply ignores any elements that fail to encode/decode instead of returning an error for the entireList.- Type Parameters:
A- The list's element type.- Parameters:
codec- TheCodecfor the list's element type.- Throws:
NullPointerException- If the argument isnull.
-
lenientMap
@NotNull public static <K,V> @NotNull com.mojang.serialization.Codec<Map<K,V>> lenientMap(@NotNull @NotNull com.mojang.serialization.Codec<K> keyCodec, @NotNull @NotNull com.mojang.serialization.Codec<V> valueCodec) throws NullPointerException Returns aCodecfor aMap, that is lenient when encoding/decoding, and simply ignores any key-value pairs that fail to encode/decode instead of returning an error for the entireMap.- Type Parameters:
K- TheMap's key type.V- TheMap's value type.- Parameters:
keyCodec- TheCodecfor the map's key type.valueCodec- TheCodecfor the map's value type.- Throws:
NullPointerException- If an argument isnull.
-