3

I'm looking for more information about the /fill command. I want to replace air blocks with another block, but only if they have a stone block below them. The command /fill ~ ~ ~ ~25 ~-5 ~25 air 0 replace dirt will replace every single air block with dirt, and that is obviously not the result that I want.

How can I add a layer of dirt on top of stone blocks, without filling the world with dirt?

5

There is no way to make it with one command, but you can achieve it with 5.

/clone ~ ~ ~ ~25 ~5 ~25 ~ 200 ~ filtered force minecraft:stone
/fill ~ 200 ~ ~5 225 ~5 minecraft:grass 0 replace minecraft:stone
/clone ~ ~ ~ ~25 ~5 ~25 ~ 199 ~ filtered force minecraft:stone
/clone ~ 200 ~ ~25 225 ~25 ~ ~1 ~ filtered force minecraft:grass
/fill ~ 200 ~ ~25 225 ~25 air

It will create a copy of stone in sky, check for having air to place a block, an then return blocks and clear the sky.

  • This looks like it should work. Good job. – MBraedley Jun 4 '16 at 0:59
  • If I understand well, what it does (step by step) is to clone all the stone blocks in the entire structure somewhere else, then change all this fresh-cloned structure's stone into grass, and then re-clone it into the structure but this time a bit shift upward so the new-cloned part top appears. Well, this is sufficient I think! – Kimatuy Jun 5 '16 at 22:24
  • Works very well ! – Kimatuy Jun 7 '16 at 14:35

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.