Problem with multiple commands in one Command Block
I followed the guide here to run multiple commands in one command block. Here is my command:
/summon falling_block ~ ~1 ~ {Block:command_block,Time:1,TileEntityData:{Command:\”/give @s minecraft:bow 1\”},Passengers [{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:\\”/give @s minecraft:arrow 64\\”},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:\\\”/tp @s 384.700 7 400.700\\\”},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:\\\\”/fill ~ ~-5 ~-1 ~~50 ~-1 redstone_block\\\\”},Passengers:[{id:falling_block,Block:redstone_block,Time:1}]}]}]}]}
The command should give the executing player one bow, then 64 arrows, then tp the player to the given coordinates. This is executed through the filled redstone blocks that trigger the multiple falling command blocks created as per the guide.
However, I'm getting the following error message upon triggering the initial command block:
[21:14:41] Data tag parsing failed: Expected value at: ...ock,Time:1,TileEntityData:{Command:<--[HERE]
I realise that this may be tricky to troubleshoot, but any help would be appreciated :)
Solution 1:
My first recommendation would be to use a different method of running three commands. Two other possibilities you could use are chained command blocks or a function. If you absolutely need it in one command block then use a function, otherwise, use a chain of command blocks as it is simpler. To do the latter, place three command blocks next to each other so that they point into each other. Then when putting commands into the final two blocks, click the buttons below until they say Chain / Conditional / Always Active.
If you still want to use the falling block method, there are several problems that I see with your command.
You used escaped quotation marks(\”
) which are not needed in this case and cause a problem. You also used the wrong kind of quotation marks (”
vs "
)
You used the @s
target selector which targets the entity executing the command. The command block would output Entity '@s' cannot be found
. You will have to use an appropriate target selector. You could use @p
to target the player nearest the command blocks.
The first use of Passengers
(Passengers [{id:falling_block
) is missing :
.
The last command block command fill ~ ~-5 ~-1 ~~50 ~-1 redstone_block
has no space between x2 and y2(~~50
should be ~ ~50
). Also, the redstone blocks only need to be next to the blocks that need to be activated. With the current coordinates, you are producing a stack from one below the original command block, all the way to 50 above the last command block. I changed the fill coordinates to ~ ~-3 ~-1 ~ ~-1 ~-1
and it only puts the blocks where they are needed.
Another change. While it is not required to be changed, command block commands do not need to start with /
With all of these changes the command is:
summon falling_block ~ ~1 ~ {Block:command_block,Time:1,TileEntityData:{Command:"give @p minecraft:bow 1"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"give @p minecraft:arrow 64"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"tp @p 384.700 7 400.700"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"fill ~ ~-3 ~-1 ~ ~-1 ~-1 redstone_block"},Passengers:[{id:falling_block,Block:redstone_block,Time:1}]}]}]}]}
Note:This will only successfully run one time. After that, the command blocks and redstone blocks are already in place so if you run it again, it will cause command blocks and redstone blocks to break and be dropped as items.
You could correct this by removing all of the command blocks and redstone blocks that were created by the original command block. Either manually or with another command block.