TransWikia.com

Would it be possible to make a command block that has commands set when placed?

Arqade Asked by Eris Starmaster on July 8, 2021

Some backstory. I wanted to make a command block that had a simple command when placed: Kill all users and set block to air to stop the trigger.
However, I had no idea how to make it so a command block had commands already input on place.
Is this possible? (Version 1.16.5)

2 Answers

You can do this from scratch with /setblock:

setblock 12 23 34 minecraft:command_block[]{Command:"…"}

Your command goes inside those quotation marks right there.

If you are looking to get this command block as an inventory item, use BlockEntityTag like so:

give @p minecraft:command_block{BlockEntityTag:{Command:"…"}}

Beware as you will need to escape quotation marks in your inner command, which can lead to messes like these!

Correct answer by ExpertCoder14 on July 8, 2021

So make the command block with the command to make it so it kills when placed and set to always active then I think it hold shift and click the block and the code should stay in the command block.

Answered by Bobzilla07 on July 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP