How to set a command with a comand block? [duplicate]

How to set a command with a comand block? [duplicate] - Set of red dice stacked together on wooden table placed on sunny terrace in daylight

I want to set a testfor commandblock. This is the command I want in the block: /testforblock 1998 10 657 glass. What is the setblock command to have this in a commandblock?



Best Answer

This is the command to setblock with a command block that has a command:

/setblock <x> <y> <z> command_block 0 {Command:"/testforblock 1998 10 657 glass"}

You just use the command data tag




Pictures about "How to set a command with a comand block? [duplicate]"

How to set a command with a comand block? [duplicate] - Top view of scissors against coil of twine and textiles with wooden block tied with threads on desk
How to set a command with a comand block? [duplicate] - From above of anonymous barefoot boy and girl in casual clothes sitting on floor carpet and playing with wooden blocks of jenga tower game
How to set a command with a comand block? [duplicate] - Unrecognizable child playing jenga at home



How do you use command blocks to duplicate?

To make your command block run multiple commands, you will need to summon FallingSand or falling_block (depending on your version of Minecraft) with command blocks and redstone blocks for each command. The command blocks will be stacked one on top of the other and contain the individual command.



Minecraft /CLONE Command Tutorial [1.19]




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

Images: Matthias Groeneveld, Teona Swift, Ketut Subiyanto, Ketut Subiyanto