2

I am making an adventure map that includes a sort of redstone clock. I want to set a command block connected to the clock and have it spawn items. Unfortunately, I am not very skilled in command blocks and could use a little help.

This is my command:

/setblock 138 93 254 minecraft:command_block 0 replace {Command:"/summon Item 140 115 245 {Item:{id:"minecraft:gold_nugget",Count:1}}"}

When I execute the command, it returns with this output:

Data tag parsing failed: Unexpected token 'm' at: minecraft:gold_nugget",Count:1}}"

Can anyone please help me? Thank you.

4

You need to escape the middle set of quote marks around the ID by putting backslashes (\) before them, like this:

/setblock 138 93 254 minecraft:command_block 0 replace {Command:"/summon Item 140 115 245 {Item:{id:\"minecraft:gold_nugget\",Count:1}}"}

Otherwise the command parser thinks the block's command is "/summon Item 140 115 245 {Item:{id:" then seeing the word minecraft: when there should have been a close curly bracket (}). Backslashes tell programs to ignore the special function of a symbol and treat it like any other part of a string.
As an alternative, you could enter "/give @p minecraft:command_block" and input the summon command manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.