0

I need to check for three or more cobblestone in a player's inventory using command blocks, I know how to check for the exact amount but not or more. let's say the player has 3 cobblestone in their inventory, the command "execute at @a[nbt={Inventory:[{id:"minecraft:cobblestone",Count:3b}]}] run say hi" works great, but if the player has 10 it doesn't work.

1

1 Answer 1

0

We are going to make it so it clears three cobblestone from their inv. If it’s successful we give them back the three stone and execute a command

First set a command block with the code:

/clear @p cobblestone 3

Then place a conditional chain with the code:

/give @p cobblestone

Place another chain condition command block with the code of your choice

That’s it!

5
  • 1
    I’m not exactly sure what your preferences are so I just put down an example. Oct 25, 2021 at 5:26
  • I'm looking for a way to check for 3 or more Cobble in the players inventory Oct 27, 2021 at 2:04
  • Wait, I think I just found an error in the command. Because what the code listed is doing is also taking it the cobblestone and not giving it back. I will add a new answer later but it will have to use /scoreboard Oct 27, 2021 at 4:31
  • /give @p oak_sign{BlockEntityTag: {Text1: "{\"text\":\"You Pay You Get\",\"italic\":true,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"scoreboard players set @p SHOP 1\"}}",Text2: "{\"text\":\"2x 30x\",\"bold\":true,\"color\":\"white\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/playsound ui.button.click master @a ~ ~ ~ .4 1.7\"}}",Text3: "{\"text\":\"line 3\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/execute if @p[nbt={Inventory:[{id:\"minecraft:cobblestone\",Count:2b}]}] run say U got items\"}}"}, display:{Name: "Bank Sign"}} 1 Oct 29, 2021 at 0:41
  • I tried this the first two lines work, the third however does not. Oct 29, 2021 at 0:43

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