Can someone please help me fix this command?
/setblock -10 15 -42 command_block 0 replace {Command:"/testfor @p[r=7] {Inventory:[{id:"minecraft:magma_cream"}]}"}
Arqade is a question and answer site for passionate videogamers on all platforms. It only takes a minute to sign up.
Sign up to join this communityCan someone please help me fix this command?
/setblock -10 15 -42 command_block 0 replace {Command:"/testfor @p[r=7] {Inventory:[{id:"minecraft:magma_cream"}]}"}
The problem here is that Minecraft will read the Command
string as:
Command:"/testfor @p[r=7] {Inventory:[{id:"
The first "
starts the string where you want to start it, but then the next "
ends it early.
To stop quotation marks from ending a string, you can escape them by putting a \
in front, like this:
{Command:"/testfor @p[r=7] {Inventory:[{id:\"minecraft:magma_cream\"}]}"}
Alternatively, in this situation but not always, you could leave out one or both pairs of quotation marks:
{Command:"/testfor @p[r=7] {Inventory:[{id:minecraft:magma_cream}]}"}
{Command:/testfor @p[r=7] {Inventory:[{id:"minecraft:magma_cream"}]}}
{Command:/testfor @p[r=7] {Inventory:[{id:minecraft:magma_cream}]}}