Detect a number of specific items in the inventory
I need help for detecting a number of specific items in my inventory whether it's stack or not.
This is the command I used:
execute if entity @a[nbt={Inventory:[{id:"minecraft:apple",Count:64b}]}] run command
But the command only detects a stack of items.
Solution 1:
There is more than one step to this. First, create a dummy objective.
/scoreboard objectives add count dummy
Now run this command and your item count will be stored in the objective.
/execute as @a store result score @s count run clear @s apple 0
The amount of apples you have will be stored in the count objective. You can then do:
/execute if entity @a[scores={count=64}] run...