So basically I'm doing a minecraft datapack for my server, but being really new to that I'm stuck on a problem and I don't know how to solve it:

I've got this line detecting if there is an item frame containing a leather helmet, and then executes a command:

execute as @s if entity @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:leather_helmet"}}] run command

And the caller of the command, the @s is another item_frame, a leather_boots, but with a certain coloration.

So what I would like to do is to take the color into account in my execute line: I'd like to test if the @s entity's color is the same than the @e's one...

It would look like that so I'm sure you understand :

execute as @s if entity @e[type=minecraft:item_frame,nbt={Item:{id:"minecraft:leather_helmet",tag:{display:{color=<@s_Color>}}}}] run command

With <@s_Color> being the color of @s

Maybe I could achieve this by storing the color of @s in the first place? But then again, I'm just a beginner with minecraft commands and don't know if it is possible...

I searched all over the internet but didn't found something similar.

Edit: I'm using colored leather armors because it offers me a high number of variations so I have many [boots - helmets] pairs in order to do what I need. But there could be another way, maybe with a specific block or a named entity? Anyway, I would need a way to compare them

  • execute as @s does nothing. Commented May 10, 2019 at 23:25

1 Answer 1


You need to store the NBT field in a scoreboard with execute store and data get, then subtract one from the other and check for 0.

  • So it would look like this? execute as @s store result score @s NBT_score run data get entity @s But then, if I store the nbt of @s, it won't be the same as the one of @e, because the items IDs are different, no?
    – KyStolos
    Commented May 11, 2019 at 8:08
  • You need to add the NBT path for the colour at the end. Should I write a complete answer? I only wrote down the idea, because I seemed to already know commands well. Commented May 11, 2019 at 9:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .