7

I'm making a map type thing where you have to get through challenges to win a prize. The problem is that I need to spawn a command block stack, I know who to spawn a command block with a command but I also need to change it so that the command block is set to chain and always active. This is the current command I'm using,

/setblock -585.601 68.00000 -471.700 command_block 0 replace {Command:"/playsound block.piston.extend voice @p"}
1
  • This looks like an interesting concept I don't think I've seen before, I'd love to see if someone is able to answer this well.
    – Jason_
    Dec 19, 2016 at 1:50

3 Answers 3

3

1.13+ answer

Blockstate numbers have been replaced by string blockstates. Also, nbt data is part of the block now. So for commandblocks you could place a block like this instead:

setblock <pos> chain_command_block[facing=up,conditional=true]{Command:"/playsound ...",auto:1b}

Original answer

The things you are looking for are the blockstate (+8 if you want it to be conditional, as @Venya pointed out) and the chain command block, which goes by the name chain_command_block instead of a regular commandblock.
The other thing you're looking for is {auto:1}, the tag that makes the command always active.

So the complete command would be:

/setblock -585.601 68.0 -471.7 chain_command_block 8 replace {Command:"/playsound block.piston.extend voice @p",auto:1}

(I removed the unneccessary numbers from the coordinates as well)

3
  • Trying to figure this out to wow my kids! I get an error saying it doesn't like the final curly-bracket. Anyone able to replicate a currently workin version? I'm on Java server 1.20.1 Jun 28, 2023 at 7:52
  • 1
    @JDMayfield the syntax has changed since the post was posted. I updated it with the current syntax.
    – Plagiatus
    Jun 30, 2023 at 15:02
  • I did get it to work late last night just by experimenting. Figured it was a slight difference in syntax. Thanks for the update though! Jul 1, 2023 at 4:45
0

I haven't been able to test anything yet, but this should have everything you need

https://minecraft.wiki/w/Command_Block#ID

when I get a chance, I'll test it in 1.11

from a little bit of reading it seems like 0-5 are the six directions, and 8-14 are the directions with conditional mode on

note: the directions should be down, up, north, south, west, then east

0

You need to put repeating_command_block instead of command_block for a repeating commandblock and chain_command_block instead of command_block for a chain one.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .