Can you have both Attribute modifiers and displays on an item? [duplicate]
I'm making an adventure map where I have a Villager "merchant" that sells custom armour for the price of a custom currency (All of this works fine. In a previous arqade question (You can see it here) I had a problem with this but it works like a charm) I wanted to add another feature to this armour now that i have the villager working. Lone behold, I have yet another issue. I have tried fiddling around with tags and formatting. Nothing seems to be able to allow me to have a villager that sells a custom named item that also has it's own modified attributes. It seems I can only have the item to have a custom attribute (but no custom display) or a custom display (but no custom attributes) My current command displays a custom name and lore but has no attributes:
/summon villager ~ ~1 ~
{
CustomName:"Lv.1 Gear Merchant"
,CustomNameVisible:1b
,NoAI:1b
,Invulnerable:1b
,Offers:
{
Recipes:
[
{
buy:
{
id:"minecraft:gold_nugget"
,tag:
{
display:
{
Name:"Gold Coin"
,Lore:
[
"$1"
]
}
}
,Count:32
}
,sell:
{
id:"minecraft:leather_chestplate"
,tag:
{
display:
{
Name:"Shoddy Leather Jacket"
,Lore:
[
"Lv.1"
]
}
}
,Count:1
}
,tag:
{
AttributeModifiers:
[
{
AttributeName:generic.maxHealth
,Amount:1
,Operation:0
,Name:Health+
,UUIDLeast:999
,UUIDMost:999
,Slot:"chest"
}
]
}
,maxUses:9999999
}
]
}
}
Again in this draft I have no errors, it just doesn't seem to want to apply my attribute changes. I created another draft that seemed to result in the exact opposite. The command:
/summon villager ~ ~1 ~
{
CustomName:"Lv.1 Gear Merchant"
,CustomNameVisible:1b
,NoAI:1b
,Invulnerable:1b
,Offers:
{
Recipes:
[
{
buy:
{
id:"minecraft:gold_nugget"
,tag:
{
display:
{
Name:"Gold Coin"
,Lore:
[
"$1"
]
}
}
,Count:32
}
,sell:
{id:"minecraft:leather_chestplate"
,tag:
{
AttributeModifiers:
[
{
AttributeName:generic.maxHealth
,Amount:1
,Operation:0
,Name:Health+
,UUIDLeast:999
,UUIDMost:999
,Slot:"chest"
}
]
}
,display:
{
Name:"Shoddy Leather Jacket"
,Lore:
[
"Lv.1"
]
}
,Count:1
}
,maxUses:9999999
}
]
}
}
Now the health is working but the display is kaputz. This feels like a game of whack-a-mole that's making me pretty TRIGGERED. Anyways, I suck at commands and hopefully with the help of anyone who sees this, I can learn. Thanks.
In both of the commands you posted, you made a mistake. In the first one you had this:
sell: {
id: "minecraft:leather_chestplate",
tag: {
display: {
Name: "Shoddy Leather Jacket",
Lore: ["Lv.1"]
}
},
Count: 1
},
tag: {
AttributeModifiers: [
{
AttributeName: "generic.maxHealth",
Amount: 1,
Operation: 0,
Name: "Health+",
UUIDLeast: 999,
UUIDMost: 999,
Slot: "chest"
}
]
},
In the second one you had this:
sell: {
id: "minecraft:leather_chestplate",
tag: {
AttributeModifiers: [
{
AttributeName: "generic.maxHealth",
Amount: 1,
Operation: 0,
Name: "Health+",
UUIDLeast: 999,
UUIDMost: 999,
Slot: "chest"
}
]
},
display: {
Name: "Shoddy Leather Jacket",
Lore: ["Lv.1"]
},
Count: 1
},
The AttributeModifiers
and the display
need to go inside the same tag
, and it has to be inside the sell
item. This is your corrected command:
/summon villager ~ ~1 ~ {CustomName:"Lv.1 Gear Merchant",CustomNameVisible:1b,NoAI:1b,Invulnerable:1b,Offers:{Recipes:[{buy:{id:"minecraft:gold_nugget",tag:{display:{Name:"Gold Coin",Lore:["$1"]}},Count:32},sell:{id:"minecraft:leather_chestplate",tag:{display:{Name:"Shoddy Leather Jacket",Lore:["Lv.1"]},AttributeModifiers:[{AttributeName:"generic.maxHealth",Amount:1,Operation:0,Name:"Health+",UUIDLeast:999,UUIDMost:999,Slot:"chest"}]},Count:1},maxUses:9999999}]}}