Minecraft to test for multiple items in a slot?

Ro
3

I would like to execute a command for an adventuremap when the player holds a sword. So for all sword variants for performance reasons, I wanted to know if it is possible to test for all sword variants using a single command.

Ta

No, that's not easy. But there's a way: Item tags

I have only given blocks tags so far, but for items it should work similarly. You need a datapack containing a function. But more exactly, as I can describe it, everything stands here: https://minecraft-de.gamepedia.com/...Aliasdaten

Hope that helps you!

Ro

Thanks first for the answer, I have created the day, but how can I test now after this? I have / execute as @a [nbt = {SelectedItem: {"tag": "#swords"}}] at @s run… Tried, but it does not work.

Ta

Hmm… I'm unfortunately over-asked. As I said, I have done so far only with blocks. I'm sorry.