Im rather confused on how item tags work, i am trying to add two tags to automatically spoil food if it sits in the inventory too long. I have the following
event.modify('/.*:.*/', item => {
let blacklist = []
if (item.isEdible()) {
if (item.foodProperties != null) {
if (blacklist.includes(item.name) == false) {
item.setNbt({'age':0, 'spoiled':false})
console.log(item.nbt)
}
}}
})
})```
It then crashes saying that certain food items do not have NBT data, is there a different function I should be using?