getContainerValue

fun <Z : Any, T : Any> getContainerValue(item: ItemStack, key: NamespacedKey, type: PersistentDataType<T, Z>): Z?

Reads key of the given type from the item's PDC, or null if absent/no meta.


fun <Z : Any, T : Any> getContainerValue(holder: PersistentDataHolder, key: NamespacedKey, type: PersistentDataType<T, Z>): Z?

Reads key of the given type from the holder's PDC (entity, block state, …), or null.


fun <Z : Any, T : Any> getContainerValue(container: PersistentDataContainer, key: NamespacedKey, type: PersistentDataType<T, Z>): Z?

Reads key of the given type directly from a PersistentDataContainer, or null.


inline fun <T : Any> getContainerValue(item: ItemStack, key: NamespacedKey): T?

Reads key from the item's PDC, inferring the PersistentDataType from T.

Throws

if T has no supported PDC type


inline fun <T : Any> getContainerValue(holder: PersistentDataHolder, key: NamespacedKey): T?

Reads key from the holder's PDC, inferring the type from T.


inline fun <T : Any> getContainerValue(container: PersistentDataContainer, key: NamespacedKey): T?

Reads key from a PersistentDataContainer, inferring the type from T.