#Write/read some sort of data into an item
12 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
(Internal.ItemStack).nbt.some_data_key = some_data_value
Thanks, I will have a look at it
[19:31:52] [ERROR] ! mystery_lands_loot.js#11: Error occurred while handling event 'BlockEvents.broken': TypeError: Cannot set property "test" of null to "test"
if(e.entity.mainHandItem.hasTag("sky_technology:mystery_lands_pickaxes")) {
e.entity.mainHandItem.nbt.test = 'test'
}
})```
You need to Check that the Item has nbt before you can overwrite it
So event.entity.mainHandItem.nbt == null
And need to do something different based in the result
How would I add new nbt data then?
event.entity.mainHandItem.nbt = {test: "test"}
Ah ok thanks a lot