setContainerValue

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

Writes value under key on the item's PDC (type inferred from T); null removes the key.

Return

the updated stack — use the return value, as it re-applies the meta


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

Writes value under key on the holder's PDC (type inferred from T); null removes the key.


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

Writes value under key on a PersistentDataContainer (type inferred from T); null removes it.


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

Writes value of the given type under key on the item's PDC; null removes the key.

Return

the updated stack — use the return value


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

Writes value of the given type under key on a PersistentDataContainer; null removes it.


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

Writes value of the given type under key on the holder's PDC; null removes the key.