How do I use the /setblock command?

How do I use the /setblock command? - Brown Wooden Blocks With Number 8

Can someone please explain the /setblock command?

I want a command block to set a block if there is clay but not set a block if there is black wool. How do I do this?



Best Answer

The syntax for setblock is as follows:

/setblock <x> <y> <z> <blockName>

The setblock command can only be used for one block at a time. It cannot replace that block based on what it previously was.

Since your situation requires you to (presumably) fill more than one block, the /fill command would be more appropriate.

The syntax for filling only blocks of a certain type is as follows:

/fill [x1] [y1] [z1] [x2] [y2] [z2] [BlockToFill] 0 replace [BlockToBeReplaced]

So to replace all clay in the world, you would use this command:

/fill [x1] [y1] [z1] [x2] [y2] [z2] [BlockToFill] 0 replace minecraft:clay

Simply replace the x y z x2 y2 z2 values with the co-ordinates to fill, and [BlockToFill] with the ID of the block you wish to replace the clay with.




Pictures about "How do I use the /setblock command?"

How do I use the /setblock command? - Scrabble Tiles on White Surface
How do I use the /setblock command? - Photo of Woman Taking Notes
How do I use the /setblock command? - High angle of pensive African American female freelancer in glasses and casual clothes focusing on screen and interacting with netbook while sitting at table with glass of yummy drink on cafe terrace in sunny day



How do you use Setblock command in Minecraft bedrock?

Type the command in the chat window and press the Enter key to run the command. This /fill command would replace all blocks in the fill region, including air. The replaced blocks will be dropped and can then be collected as if they were mined with a pickaxe or shovel.



Using Commands in Minecraft: How to Use /setblock \u0026 /fill to Alter Terrain! | 1.11.2




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Brett Jordan, Brett Jordan, Ivan Samkov, Andrea Piacquadio