Minecraft – Execute fill command relative to player

minecraft-commandsminecraft-java-edition

How can I execute the fill command relative to the player? If you are wondering why I am asking this, and for more information, reference my earlier question here: How to make a block disappear after a certain period of time Look to the bottom section for the info you want. Also, I don't want it to just fill the selected areas, I just want to replace wool with air.

Best Answer

Try: /execute <selector> ~ ~ ~ fill <relative coordinates> air 0 replace wool

[EDIT]

If you are wanting the block to disappear after a certain amount of time, say, 30 redstone ticks (60 game ticks), you could summon a WitherSkull below the player and use the execute command on it.

To make the block disappear, you would add a new scoreboard command, lifetime, for instance, and run /scoreboard players add @e[type=WitherSkull] lifetime 1 with a setblock or fill clock, then execute another fill command on every wither skull with a certain lifetime value, like:

/execute @e[type=WitherSkull,score_lifetime_min=31] ~ ~ ~ /fill ~ ~ ~ ~ ~ ~ wool 0 replace air.

Then, you would kill the wither skull: /kill @e[type=WitherSkull,score_lifetime_min=35].

Here is a screenshot of what I did:

Adding the ability to walk on blocks.