Being fairly new to command blocks in general, I am currently in need of a way to make a SINGLE command block check specified x,y,z coords. for "air", and, if AIR is detected at that coord. then send a redstone pulse to a different set of coordinates. This needs to be a SINGLE command block - no chaining!
This can REPEAT for as long as AIR is detected at that location (ie. as often as the command block is run (every tick?).
Can this be done in a single command block? Can it even be done at all?
For clarity, here is my objective: I have created a tree farm, where I ALREADY HAVE a way to "harvest" the fully-grown trees. I have also used a (fairly trivial) set of command blocks to allow a "vanilla" dispenser to "plant" saplings, instead of merely "dropping" them onto the ground. The saplings are planted DIRECTLY IN FRONT of each dispenser(s). Now what I require is a way to "trigger" each dispenser to re-plant a new sapling each time a resulting tree has been harvested. Once the fully-grown tree is cleared, the location is front of each dispenser will have NEITHER a sapling nor a "tree" (wood) block present there, thus, it is "empty", and I need a way to detect this situation, and "fire" a redstone pulse back at the pertinent dispenser!
BTW, I COULD simply re-trigger every dispenser at the SAME TIME using a redstone clock, and, if the spot in front was not "empty" for any specific dispenser, then a normal sapling "toss" would result, (ie. it would NOT get "planted" that time around); I could then absorb and return the sapling back to a "collector" inventory (eg. a chest), which would then re-distribute the un-planted saplings as required. I am simply wondering if a command block could be utilized in this particular way, is all!
Thanks for any help here!
121 Answer
/execute @p ~ ~ ~ detect x1 y1 z1 air 0 /setblock x2 y2 z2 redstone_blockWhere point "1" is the block you are testing for air, and "2" is the coordinates of the redstone block to be placed, or output.
Additionally, if you don't want the nearest player to be executed, you could place an armor stand on top of the command block and replace @p with @e[type=armor_stand,r=1]