how can i search the closest player to see if they have coal block in their inventory, if true then remove 1 block and set a block above the command block. Thanks in advance.
Create an account or sign in to comment.
3
1
I'm going to do this with a scoreboard objective, you can call it whatever you want, but I'm going to call mine 'potatoes'. Once you have your scoreboard set up, just run these commands whenever you want to check (keep them in this order):
I'm assuming you want remove one block of coal from the players inventory, and then place a block of coal over the command block if one is found in the player's inventory. If not, you can change the /clear and /setblock commands to whatever you'd like.
scoreboard players set @p potatoes 1 {Inventory:[{id:"minecraft:coal_block"}]}
clear @p[score_potatoes_min=1] coal_block -1 1
execute @p[score_potatoes_min=1] ~ ~ ~ setblock coal_block x y z
scoreboard players set @a potatoes 0
I'm assuming you want remove one block of coal from the players inventory, and then place a block of coal over the command block if one is found in the player's inventory. If not, you can change the /clear and /setblock commands to whatever you'd like.
1
Easy Peacy. just wait when i make the machine.
1
Help plz?