getWrapper

inline fun <P : Any, C : Any> ItemStack.getWrapper(key: NamespacedKey, dataType: PersistentDataType<P, C>): DataWrapper<P, C>?

Retrieves a DataWrapper from the ItemStack's PersistentDataContainer.

Return

A DataWrapper containing the retrieved value and its associated PersistentDataType, 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.