customCompoundKey
inline fun <T : Any, NbtType : Tag> customCompoundKey(id: ResourceLocation, crossinline valueToNbt: (value: T) -> NbtType, crossinline nbtToValue: (nbtElement: NbtType) -> T): CompoundKey<T>(source)
Creates a CompoundKey which can be used to read and write data to a PersistentCompound in a typesafe way.
This compound key allows you to specify custom serialization or conversion logic to convert elements of the type T to NbtElements of the type NbtType.
Parameters
id
the unique identifier for this key, this should contain your mod id
inline fun <T : Any> customCompoundKey(id: ResourceLocation, crossinline convertValueToNbtElement: (value: T) -> Tag, crossinline convertNbtElementToValue: (nbtElement: Tag) -> T): CompoundKey<T>(source)
Creates a CompoundKey which can be used to read and write data to a PersistentCompound in a typesafe way.
This compound key allows you to specify custom serialization or conversion logic to convert elements of the type T to NbtElements of the type Tag (this is the version of the customCompoundKey function with no specific NbtElement type).
Parameters
id
the unique identifier for this key, this should contain your mod id