/fill command help 1.12.2 (discriminating blocks)

BrucePicasso7/13/18 11:21 pm
2 emeralds 5.3k 4
7/14/2018 8:53 pm
Hey guys.

I need help with using the /fill command in Java 1.12.2.

My question is if there is a way to discriminate or leave out certain types of blocks when using the /fill command. I've looked through several forums about this, and I can't find a solution. If there is a certain command threshold, can anyone post an example of this?

Please note: It would be helpful if this worked in 1.12.2.

Posted by avatar
Level 1 : New Miner

Create an account or sign in to comment.


07/13/2018 11:53 pm
Level 39 : Artisan Loremaster
Giancarlovan avatar
I often find fill to be a less powerful version of WorldEdit, which I highly recommend using over vanilla Minecraft.

But after doing some snooping, try this :

/fill 50 10 60 100 20 120 minecraft:melon_block 0 replace minecraft:diamond_block
What this does is that it should replace all the diamond blocks (57) in the selected area with melon blocks (103)

I haven't tested it out cuz I use World Edit, but you could try that. :)
07/14/2018 7:21 am
Level 1 : New Miner
BrucePicasso avatar
Thx for replying. :))

Regarding the command you've posted I understand it but why would the end of melon_block be 0? Is this meant to be the ID of the block, or am I meant to use 0 at the end of the first block every single time?
07/14/2018 2:08 pm
Level 27 : Expert Engineer
SUPERIONtheKnight avatar
The 0 represents the data value of the block, this is used to figure out what variant of the block you are wanting to use. As the melon_block doesn't have any other variants, I'm going to use wool as an example. White wool has a data value of 0, purple wool has a data value of 10, red wool has a data value of 14, etc. If you enable Advanced Tooltips with F3 + H, You can see what data value a block has when you hover your mouse over the item(It's the value to the right of the /). Here's an example command that places purple wool.
/setblock ~ ~ ~ wool 10
In the case that you are testing for a block and don't care about what the data value is, use * or -1.
/testforblock ~ ~ ~ wool *
With that said, data values are going to be removed in 1.13. They are fine to use for 1.12, but if you ever need to update your command, just remove the number/asterisk and update the id's of the blocks.

Hope this helps!
07/14/2018 8:53 pm
Level 1 : New Miner
BrucePicasso avatar
THANK YOU! It worked!
Planet Minecraft


© 2010 - 2022