Arqade Asked by YellowJacket on June 13, 2021
I know this bit here is right
"item": "minecraft:lime_dye",
but I can’t get this part is to work:
"nbt":"{Tags:{Damage: 1, HideFlags: 1, Enchantments: [{lvl: 1, id: "minecraft:depth_strider"}], display: {Name: '[{"text":"Dragon","bold":true,"color":"light_purple"},{"text":"_","color":"#993366"},{"text":"Experience","color":"#00ff66"}]'}}}"
(this nbt data already works as a give command, but I cannot figure out how to work with nbt data in general in .json files. any tips on this, or just in general for .json would be very helpful)
Once you begin to combine NBT and JSON, things become a mess if you can't keep track of them. I have made a few educated guesses along the way, but this is what I've came up with.
There are three problems with your data:
You must escape all double quotes inside JSON strings.
Instead of:
"nbt":"{Enchantments:[{id:"minecraft:depth_strider"}]}"
Try:
"nbt":"{Enchantments:[{id:"minecraft:depth_strider"}]}"
This also applies to the display name!
The NBT data should not be inside a compound labelled Tags
, it should just be there by itself.
Instead of:
"nbt":"{Tags:{display:{Name:'{"text":"Hello, World!"}'}}}"
Try:
"nbt":"{display:{Name:'{"text":"Hello, World!"}'}}"
It's always better to use the built-in JSON for as many different item properties as possible. This also lets you specify built-in min/max counts for different properties.
So, instead of:
"conditions":{
"items":[
{
"item":"minecraft:lime_dye",
"nbt":"{display:{Name:'{"text":"Hello, World!"}'},Enchantments: [{lvl: 1, id: "minecraft:depth_strider"}]}"
}
]
}
Try:
"conditions":{
"items":[
{
"item":"minecraft:lime_dye",
"nbt":"{display:{Name:'{"text":"Hello, World!"}'}",
"enchantments":[
{
"id":"minecraft:depth_strider",
"levels":1
}
]
}
]
}
This becomes a huge hassle, and can get confusing when you're dealing with NBT and JSON inside of each other. For example, here's the code for detecting an item with the custom name My name has some "quotation marks" in it
:
"nbt":"{display:{Name:"{"text":"My name has some \"quotation marks\" in it"}"}}"
That is JSON inside of NBT inside of JSON. As you can see, it can get very complicated if you don't remember to escape your quotes!
Correct answer by ExpertCoder14 on June 13, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP