Help With Custom Commands on villigers with a custom item 1.15.2
I was trying to get an emerald with a custom color added to it and have a villager sell the emerald. I was doing well getting both to spawn but when I tried to combine the two it didn't work. Can you tell me what I have done wrong?
/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:2,type:plains},Offers:{Recipes:[{buy:{id:acacia_boat,Count:1},sell:{id:emerald,Count:1,tag:{display:{Name:"\"aqua\"",Lore:["\"TOKENNNN\""]}}},maxUses:9999999},{buy:{id:acacia_boat,Count:1},buyB:{id:acacia_boat,Count:1},sell:{id:emerald,Count:1,tag:{display:{Name:"\"Token\",\" color\":\"aqua\",\"italic\":true},{\"text\":\"ken\",\"color\":\"aqua\",\"italic\":true}]\",},HideFlags:1}\""}}},maxUses:9999999}]}}
And the expanded command:
/summon villager ~ ~1 ~
{
VillagerData:{ profession:farmer, level:2, type:plains },
Offers:{
Recipes:[
{
buy:{ id:acacia_boat, Count:1 },
sell:{ id:emerald, Count:1,
tag:{ display:{ Name:"\"aqua\"", Lore:[ "\"TOKENNNN\"" ] } }
},
maxUses:9999999
},
{
buy:{ id:acacia_boat, Count:1 },
buyB:{ id:acacia_boat, Count:1 },
sell:{ id:emerald, Count:1,
tag:{ display:{ Name:"\"Token\",\" color\":\"aqua\",\"italic\":true},{\"text\":\"ken\",\"color\":\"aqua\",\"italic\":true}]\",},HideFlags:1}\"" } }
},
maxUses:9999999
}
]
}
}
To specify the issue, it is only reading the "TOKEN" part of it and not the rest
Try this command:
/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:2,type:plains},Offers:{Recipes:[{buy:{id:acacia_boat, Count:1b},sell:{id:emerald,Count:1b,tag:{display:{Name:"\"aqua\"",Lore:["\"TOKENNNN\""]}}},maxUses:9999999},{buy:{id:acacia_boat, Count:1b},buyB:{id:acacia_boat, Count:1b},sell:{id:emerald,Count:1b,tag:{display:{Name:"[{\"text\":\"Token\",\"color\":\"aqua\",\"italic\":true},{\"text\":\"ken\",\"color\":\"aqua\",\"italic\":true}]"},HideFlags:1}},maxUses:9999999}]}}
Expanded:
/summon villager ~ ~1 ~
{
VillagerData: {profession: farmer, level: 2, type: plains},
Offers: {
Recipes: [
{
buy: {id: acacia_boat, Count: 1b},
sell: {
id: emerald,
Count: 1b,
tag: {
display: {
Name: "\"aqua\"",
Lore: ["\"TOKENNNN\""]
}
}
},
maxUses: 9999999
},
{
buy: {id: acacia_boat, Count: 1b},
buyB: {id:acacia_boat, Count: 1b},
sell: {
id: emerald,
Count: 1b,
tag: {
display: {
Name: "[{\"text\":\"Token\",\"color\":\"aqua\",\"italic\":true},{\"text\":\"ken\",\"color\":\"aqua\",\"italic\":true}]"
},
HideFlags: 1
}
},
maxUses: 9999999
}
]
}
}
The main issue was with your JSON text for the second offer. Yours was (unescaped):
"Token"," color":"aqua","italic":true},{"text":"ken","color":"aqua","italic":true}]",},HideFlags:1}"
Not only did you include the HideFlags
NBT tag in the JSON text components, but there are missing brackets and an extra quote and space. The correct JSON is
[
{
"text": "Token",
"color": "aqua",
"italic": true
},
{
"text": "ken",
"color": "aqua",
"italic": true
}
]
Also, you should always include b
or B
after a byte tag (like in Count
).