2

How to do " syntax in the "Command" nbt tag?

Duckwizard_76 6/9/21 1:43 am
513
6/10/2021 9:29 pm
I am trying to get a command block to summon a command block minecart that creates a command block with a command that gives speed to any player wearing certain boots. I can't figure out the syntax to put quotation marks in the command. Here is the command that I want to run in the command block.
This is the original command that can run in a command block just fine

execute as @a at @a[nbt={Inventory:[{Slot:100b,id:"minecraft:netherite_boots",tag:{display:{Name:'{"text":"Jump Boots","color":"red","bold":true,"strikethrough":true,"obfuscated":false}',Lore:['{"text":"MOD TOOL","color":"gold","italic":true,"bold":false}','{"text":"12345678910","color":"black","obfuscated":true}']}}}]}] run effect give @s minecraft:speed 1 5 true

This command works by itself. However, it doesn't translate to when it is inside of the original command block

/summon falling_block ~ ~ ~ {BlockState:{Name:"minecraft:activator_rail"},Time:1,Passengers:[{id:"minecraft:command_block_minecart",Command:"setblock ~ ~ ~ repeating_command_block {Command:\"COMMAND HERE\"}}"}]}

It starts as a command block that will summon the minecart that creates the command block
This is the same command with the command I want in it which works with simple commands like "say hello world"

Here is the problem

/summon falling_block ~ ~ ~ {BlockState:{Name:"minecraft:activator_rail"},Time:1,Passengers:[{id:"minecraft:command_block_minecart",Command:"setblock ~ ~ ~ repeating_command_block {Command:\"execute as @a at @a[nbt={Inventory:[{Slot:100b,id:\"minecraft:netherite_boots\",tag:{display:{Name:'{\"text\":\"Jump Boots\",\"color\":\"red\",\"bold\":true,\"strikethrough\":true,\"obfuscated\":false}',Lore:['{\"text\":\"MOD TOOL\",\"color\":\"gold\",\"italic\":true,\"bold\":false}','{\"text\":\"12345678910\",\"color\":\"black\",\"obfuscated\":true}']}}}]}] run effect give @s minecraft:speed 1 5 true\"}}"}]}

This command does not work because of the quotation syntax. I don't know how to represent quotations other than " --- " and \" --- \"

How do you do this?
Posted by
Duckwizard_76
Level 1 : New Miner
0

  Have something to say?

JoinSign in

5

Duckwizard_76
06/10/2021 9:29 pm
Level 1 : New Miner
I figured out the problem by looking at another command that I know works. Then seeing I just need more slashes. I then adjusted the # of slashes after it didn't work. This was pure guess work and I learned nothing but it works.

working command \/

,{id:command_block_minecart,Command:"setblock ~6 ~-1 ~-1 repeating_command_block{auto:1,Command:\"execute as @a at @a[nbt={Inventory:[{Slot:100b,id:\\\"minecraft:netherite_boots\\\",tag:{display:{Name:'{\\\"text\\\":\\\"Jump Boots\\\",\\\"color\\\":\\\"red\\\",\\\"bold\\\":true,\\\"strikethrough\\\":true,\\\"obfuscated\\\":false}',Lore:['{\\\"text\\\":\\\"MOD TOOL\\\",\\\"color\\\":\\\"gold\\\",\\\"italic\\\":true,\\\"bold\\\":false}','{\\\"text\\\":\\\"12345678910\\\",\\\"color\\\":\\\"black\\\",\\\"obfuscated\\\":true}']}}}]}] run effect give @s minecraft:speed 1 5 true\"}"}

Somewhere along the process of me developing the command I added a pair of quotate marks that act weird. When added in the initial command block it places the command block correctly however when the command is placed it shows up as gray and the command doesn't function. If you replace the quotation marks it then turns red saying the command has a syntax error somewhere. If you then add the slashes around the new quotation marks it will function properly. This happened around the " "Minecraft:netherite_boots" " in my command. Here are the two different quotation marks. This really threw me off.

fake equations the show up as working > <
real quotation marks that will correctly show errors and produce results > " <
1
HoboMaggot
06/09/2021 7:55 am
Level 55 : Grandmaster Blob
You dont need to put a bunch of backslashes in the json parts of the commands
Something like this is valid and will spawn without errors:
/summon item ~ ~ ~ {Item:{id:"minecraft:loom",Count:1b,tag:{display:{Name:'{"text":"Hi"}'}}}}

Also why are you summoning a command block minecart? Cant you use a datapack or just execute commands from the world origin/forced chunks?
1
Duckwizard_76
06/10/2021 1:10 am
Level 1 : New Miner
1. You are right, /summon item ~ ~ ~ {Item:{id:"minecraft:loom",Count:1b,tag:{display:{Name:'{"text":"Hi"}'}}}} does work when it is put into a command block. But (as far as I know) it doesn't allow you to run the command when you are trying to run it from inside a command block you are creating in the original command. When you are using the "Command:" tag. It makes you use \"--\" instead of "--", I think so it can easily know the difference between the actual command and the command in the command. In other words, the command block minecart causes it to not work. That means that when I do just use ". It won't run

summon minecraft:falling_block ~ ~.5 ~ {Time:1,BlockState:{Name:activator_rail,Properties:{powered:"true"}},Passengers:[{id:command_block_minecart,Command:"setblock ~2 ~0 ~-1 repeating_command_block{auto:1,Command:\"execute as @a at @a[nbt={Inventory:[{Slot:100b,id:"minecraft:netherite_boots",tag:{display:{Name:'{"text":"Jump Boots","color":"red","bold":true,"strikethrough":true,"obfuscated":false}',Lore:['{"text":"MOD TOOL","color":"gold","italic":true,"bold":false}','{"text":"12345678910","color":"black","obfuscated":true}']}}}]}] run effect give @s minecraft:speed 1 5 true\"}"}]}

2. I am not using a data pack because I don't know how to make a data pack and I don't use commands enough to learn.
1
HoboMaggot
06/10/2021 7:19 am
Level 55 : Grandmaster Blob
Well its a lot less laggier and more useful than summoning falling blocks like in the pre 1.13 versions.
You can follow BertieCrafter's guide to learn abt datapacks:
https://www.planetminecraft.com/forums/minecraft/datapacks/function-data-packs-for-dummies-a-tutorial-blog-series-604217/
1
Duckwizard_76
06/10/2021 11:44 am
Level 1 : New Miner
Thanks!
1

Welcome