I've recently added some new commands into a .mcfunction, since 1.12 is now out. What I wanted was that if the player ran directly into a block, it destroys it, now that works with this command:
execute @a ~ ~ ~ detect ~1 ~ ~ minecraft:wool 7 setblock ~1 ~ ~ minecraft:air 0 destroy
But my only problem, is that it only works from 1 side, not all 4 sides of the block. Can anyone help me out? I really only want it to work from the front, left, right and back sides.
Example: (Sorry it's an MS Paint Example. But it's the only way I can kind of explain, the arrows represent which way the player will run into the block.)
Thanks, Daniel
detect ~1 ~ ~
only detects a block on one side of the player (regardless of where he's looking), so it's one out of four to guess correctly and it's always the same side. You can either check all sides of the player or try a command detecting the direction a player is facing.