#running functions for plugin custom items
1 messages · Page 1 of 1 (latest)
yes you can, the exact syntax depends on the item. For both vanilla and modded items, it is usually easy to first from chat do a /data get entity @s SelectedItem while holding said item in your mainhand to see what the item nbt looks like.
if the item has its own id you can simply check for that id and it would be enough. Some mods/plugins or items might have more components or data on it that you want to check to make sure it is the right type of item.
in a function that you added to tick.json you can check if a player has a specific item in their mainhand and then run some command or function by doing:
execute as @a if items entity @s weapon.mainhand * run ...
Perfect thx