I figured it has something to do with using the /scoreboard
command to create a scoreboard like this
/scoreboard objectives add example minecraft.used:minecraft.id "example name"
but from there I don't really know where to go. Is there any way to store the location of the block placed? would summoning a tagged entity and placing blocks around that be easier?
Best Answer
I have not tested this method but it should work fine anyway.
Step 1: set up a scoreboard objective that detects when you place a block.
Step 2: let the commands know what block to target when you place a dirt block. We will do this by detecting the first four blocks for dirt, then summoning an armor stand at the dirt.
Repeat this command four times, but replacing the third ^ number with 2 3 and 4, to reach four blocks.
Step 3: finish off the machine by resetting the player's dirt score.
Does this help?
EDIT: If you use the machine above it will keep going past the block, not good for if you're not changing the block into something else. To avoid this, just run the commands like this:
That will tag the player with a tag that prevents the machine from going any further with detecting blocks. Just copy it four times and replace the 1 in the tildes with 2 3 and 4.