#how to find if a specific nbt is inside of an array, but comparing it to other storage
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
<@&935561184806060073> <@&1202694677766348840>
Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)
you can use execute store success to compare nbt elements. it works by you copying the element you wanna compare and replacing it with another element you want to compare it with, storing the success of this action will tell you whether the nbt elements are the same or different.
i think i was not clear, i want to check if a specific item exists anywhere in a array
so kinda like
if (item in array)
execute if data storage test:data some_array[{id:”minecraft:stone”}]
You mean like this?
yes but instead of writing the id i would get the id of a storage
You could use macros, which would send the id through to a function and you would replace the minecraft:stone with “$(id)”
uhm i need this datapack to be compatible with minecraft 1.20.1 though
Then you would need to iterate through a copy of the array and use the method above that eeyuh mentioned
alright thanks