-1

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.

1 Answer 1

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...
0

You must log in to answer this question.

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