Question:
Is there any way I can save the count of the following If Command in a scoreboard.
Command:
/ execute as @a if entity @s [nbt = {Inventory: [{id: "minecraft: diamond_block"}]}]
Yes there's:
/ execute as @a store result score @s count run clear @s diamond_block 0
I have now tried the following command
/ execute store result score @s diamond_count if entity @s [nbt = {Inventory: [{id: "minecraft: diamond_block"}]}]
In general it works
But now he only says count 1 because he only found it with one player.
But I want the scoreboard to show how many diamond blocks it has in its inventory.
So has my command now done what it should or not?
No
Then you have to replace @s with @a. Then it should work.
No, that's not what I mean, @s is already right… (I'm for it, yes)
but if I have 32 diamond blocks in the inventory then only a 1 is displayed in the scoreboard because the command only found one player and therefore the test gives a 1 …
but i want it to come out 32 so the number of slide blocks in the inventory
I see the correct number. Which scoreboard objective type did you choose?
Dummy
The command works fine for me (edited again):
/ execute as @a store result score @s count run clear @s diamond_block 0
But there still has to be some condition
or how should he know which one to save and why always this clear
How should he know which one to save
Which - what exactly - should he save?
why always this clear
The items are counted with the Clear command and no items are deleted with the 0.
In the meantime I finally understood the command xd
Thank you and btw it works
Is there a command that counts how many items you generally have in your inventory…
I've tried this:
/ execute as @a store result score @s itemcount run clear @s
But unfortunately he clears the items anyway
No, unfortunately you have to take a separate command block for each item and then somehow calculate xD
Imagine one would do that for all 361 items xd