0

I am trying to use /testforblock around a player so that whatever block it detects will be put in a certain slot in a certain chest with the use of /replaceitem.

How do I send the block data from /testforblock to /replaceitem?

1
  • 1
    I don't think it's possible to do what you want, especially in Bedrock Edition. I also don't usually use testforblock, but I'm pretty sure that's not how it works. The only way I can see of doing this is to create a set of commands for every block you want to to detect.
    – MBraedley
    Jul 20, 2020 at 12:24

2 Answers 2

1

testforblock <position: x y z > <tileName: Block> [dataValue: int]

testforblock will check for a block and the command execution will succeed if it finds the correct block. otherwise it will fail so you would have to make the second command executing conditional on the first one succeeding.

A method to do this is to make replaceitem a conditional command block. which would only make it execute after testforblock found whatever it is you were checking for.

0

Testforblock doesn't check what block is at a certain coordinate, it confirms whether or not the specified block is in the specified position

You must log in to answer this question.

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