#Is there a way to automatically alter an items nbt data if it's in a players inventory?

7 messages · Page 1 of 1 (latest)

shy knot
#

Pretty much just title. Like an item comes out of a recipe with a certain nbt tag but if the player picks it up it removes that nbt tag from it? Trying to create a system that requires an item to be fully automated from start to finish without any player interaction

finite anchorBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

autumn obsidian
#

Short story;
Yes

Long story;
I'll have a look when I'm homeheh

autumn obsidian
autumn obsidian
#
onEvent('player.inventory.changed', event => {
    const {item} = event
    const itemsToCheck = ['minecraft:stick', 'minecraft:potion', 'minecraft:enchanted_book']
    if (!itemsToCheck.toString().includes(item.id)) return
    if(item.nbt == {}) return
    if(item.nbt?.StoredEnchantments.toString() == '[{id:"minecraft:protection",lvl:2s}]') item.nbt = {}
})```
#

that should work

shy knot
#

That does work, thank you very much :)