TransWikia.com

How do I send data from one command block to another

Arqade Asked on November 3, 2021

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?

2 Answers

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

Answered by vain_alibi on November 3, 2021

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.

Answered by Lootjes on November 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP