Minecraft Maps / Redstone Device

Execute Commands Relative To Blocks (@b) [14w21b]

  • 5,839 views, 3 today
  • 68 downloads, 0 today
  • 10
  • 2
  • 4
Lmeagno's Avatar Lmeagno
Level 66 : High Grandmaster Button Pusher
119
Here are a series of commands that will allow you to /execute relative to a specific block. (Tested in 14w21b)
Remember to leave a Diamond to show your support!
______________________________________________________________________________
                                             
/scoreboard objectives add BlockExecute dummy

/fill ~7 ~-1 ~ ~ ~-1 ~ redstone_block
/fill ~7 ~1 ~ ~ ~1 ~ <bedrock>

/execute @a ~-2 ~-2 ~-2 /fill ~ ~ ~ ~4 ~4 ~4 double_plant 0 replace
/execute @a ~-4 ~-4 ~-4 /fill ~ ~ ~ ~8 ~8 ~8 double_plant 0 replace

/scoreboard players set @e[type=Item] BlockExecute 1 {Age:0s,Item:{id:minecraft:double_plant}}

/execute @e[score_BlockExecute=1,score_BlockExecute_min=1] ~ ~ ~ <COMMAND(S)> 

(optional) /execute @e[score_BlockExecute=1,score_BlockExecute_min=1] ~ ~ ~ /setblock ~ ~ ~ <BLOCK>

/kill @e[score_BlockExecute=1,score_BlockExecute_min=1]

/scoreboard players reset * BlockExecute
______________________________________________________________________________

EXPLAINATION:
Relative to the player, a /fill replace command is executed. This replaces all of the blocks of the player's choosing with a "double_plant" block. When updated, the double_plant block will break into an item and from this entity we execute our commands.
After the commands have been executed the double_plant item is destroyed and the scoreboard is reset.


Special thanks to dandamannnnn for his Destroy Specific Blocks command set up.
______________________________________________________________________________
Progress100% complete
Tags

3 Update Logs

Schematic Update : by Lmeagno 06/14/2014 11:07:57 amJun 14th, 2014

The schematic is now available!
LOAD MORE LOGS

Create an account or sign in to comment.

Jmal116
05/16/2014 8:43 am
Level 34 : Artisan Engineer
Jmal116's Avatar
It's a cool idea, but its a bit over complicated. The tildes (~) after the execute part are there for a reason, they allow you to offset where the command is executed. So what you could do is place an invulnerable squid (or some other non-moving mob) below a block, and then simply use execute on the mob, just with a offset of about 5 block up, depending on where you put it.
1
Lmeagno
05/16/2014 8:51 am
Level 66 : High Grandmaster Button Pusher
Lmeagno's Avatar
That is true, and that is the technique I used fo my last two designs. However, this is a command that will execute at any block in the world, even ones placed by the player, without any need to manually spawn the entity.
1
TechProGaming3000
04/23/2014 9:45 am
Level 18 : Journeyman Engineer
TechProGaming3000's Avatar
Nice idea, but it would be more useful if it was multiplayer-friendly...
1
Lmeagno
04/23/2014 3:02 pm
Level 66 : High Grandmaster Button Pusher
Lmeagno's Avatar
It technically is possible. But it could be more complicated and require more command blocks.
Summon a WitherSkull relative to where the block is (i.e. instead of the /particle command) and have the WitherSkull set a score of the player who summoned it so the command would only activate for players with that score.
However, if I did this there would be twice as many command blocks and the time it would take to activate would be both longer and unreliable.
1

Welcome