0

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.

1

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.

  • What do you mean by 'relative coordinates'? Could you give an example? – DatEpicCoderGuyWhoPrograms May 22 '14 at 4:08
  • In this case, as I am assuming you want blocks to be placed under the player, you would do ~ ~-1 ~. – AlfredPersonMc May 22 '14 at 20:20
  • Actually I wanted to make a 7x7x7 hollow "cube", but I already figured out how to do that. Thanks! – DatEpicCoderGuyWhoPrograms May 22 '14 at 20:28
1

To fill an area relative to the player, put the following code into a command block or your chat: /execute @<p,a,r,e> <x> <y> <z> /fill <x1> <y1> <z1> <x2> <y2> <z2> <block> 0 replace <blocktoreplace>. The p, a, r, and e are the selectors.

  • @p is as if you had typed the nearest players name in
  • @a is as if you had put everyone's name tag in
  • @r is as if you had put a random player's name in, and
  • @e is as if you had put every entity's ID in.

The first x, y, and z are the relative coordinates, meaning that they must have the symbol ~ before them, and are relative to the player. The next two sets of x y and z should also be relative otherwise there wouldn't be any use of using execute. The block is now used by it's name with minecraft: before it or what ever mod it comes from with a colon after meaning that items that have the same name won't override each other. The block to replace is just that, the block to replace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.