So, I got this genius idea to make a crafting table with custom recipes work anywhere, (If you just have /testforblocks running, it would only work at 1 location) using /execute.

My command would look like this:

/execute @a ~ ~ ~ testforblocks ~1 ~ ~ ~1 ~ ~ [Dispenser table coordinates]

But how would I tell it to

/execute @a ~ ~ ~ clone [Dispenser table Coordinates] ~1 ~ ~ ~1 ~ ~ 

but only to the people that match the /testforblocks?


Set up a dummy objective, which we'll make store whether or not a player successfully tested for the dispenser:

/scoreboard objectives add FoundDispenser dummy

When a new player joins (or just on a clock) make the new player (or everyone) set their SuccessCount to store in their dummy score (FoundDispenser in this example), and nudge the dummy score off of Null:

execute @a ~ ~ ~ stats entity @p set SuccessCount @p FoundDispenser
scoreboard players add @a FoundDispenser 0

Run the execute testforblocks command, then run the execute clone command straight afterwards:

execute @a ~ ~ ~ testforblocks ~1 ~ ~ ~1 ~ ~ [Template Coordinates]
execute @a[score_FoundDispenser_min=1] ~ ~ ~ clone [Template Coordinates] ~1 ~ ~ ~1 ~ ~
  • Thanks for the answer, Ill try it out and make a note if anything doesn't work. Tries out commands Sep 6 '15 at 18:49
  • Wait, would this only work for 1 recipie for each scoreboard? Sep 6 '15 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.