I am trying to add a count of 3 to this command :
/execute as @a if entity @s[nbt={Inventory:[{id:"minecraft:diamond"}]}]

Edit: Some may think that this question is a duplicate, but my question is different from How to test for minimum amount of items in inventory and execute a command if true.

The linked question uses tellraw while this one uses an execute command. Someone might need to add a run command and /execute has this built-in.

  • 1
    The linked answer also uses /execute. Combining the information given there, it seems you can produce a command based on your specific demands. – Joachim Sep 23 '19 at 7:27
  • If you're asking how to do it in one command, it cannot be done. You can only check for a specific amount of items in one slot with nbt. You have to do the multi-command process involving /clear listed in the post linked. – Zach K Sep 26 '19 at 2:03