getValue

inline fun <T : Any> ItemStack.getValue(key: NamespacedKey, dataType: PersistentDataType<T, T>): T?

Retrieves a value from the ItemStack's PersistentDataContainer.

Return

The retrieved value, or null if the data is not found.

Parameters

key

The NamespacedKey used to locate the data within the PersistentDataContainer.

dataType

The PersistentDataType that specifies the type of data being retrieved.