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
?
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.
Testforblock doesn't check what block is at a certain coordinate, it confirms whether or not the specified block is in the specified position
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.