How do I setblock a command
How do I setblock a command block that's repeating, always active, and has a command? I need it for a one command block creation.
1.12-:
setblock <x> <y> <z> repeating_command_block 0 replace {Command:"Command",auto:1b}
1.13+:
setblock <x> <y> <z> repeating_command_block{Command:"Command",auto:1b}
You can also just change the command block configuration inside the command block GUI.
I wouldn't suggest making a single command block creation in game - try either notepad or this handy tool; https://mrgarretto.com/commanddump
If you where wondering, /summon FallingSand ~ ~1 ~ {Block:redstone_block,Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"/fill ~ ~0 ~1 ~ ~-1 ~1 redstone_block"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"
your command"},Time:1,Riding:{id:"FallingSand",Block:stone,Time:1}}}}
is a good start since it can be manipulated for multiple commands.
For example, two commands:
/summon FallingSand ~ ~1 ~ {Block:redstone_block,Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"/fill ~ ~0 ~1 ~ ~-3 ~1 redstone_block"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"
Command 1"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"\n"},Time:1,Riding:{id:"FallingSand",Block:command_block,TileEntityData:{Command:"
Command 2"},Time:1,Riding:{id:"FallingSand",Block:stone,Time:1}}}}}}
I don't suggest having a repeating command block placed somewhere for a one command block creation.