Issue with custom villager trading custom items

I'm having an issue with minecraft commands. I'm creating an RPG style adventure map that revolves around conquering dungeons, selling items for "Gold Coins" and using those coins to purchase higher tier gear. Items like "Shoddy Leather Jacket" (leather chestplate) with the lore "Lv.1" Simple right?

My issue is creating villagers that you can trade in Gold coins for gear. Here is my command:

/summon Villager ~1 ~ ~ 
{Profession:3,
CustomName:"Lv.1 Gear Merchant",
CustomNameVisible:1,
Career:1,
CareerLevel:42,
CanPickUpLoot:0,
PersistenceRequired:1,
NoAI:1,
Invulnerable:1,
Offers:{Recipes:[{buy:{id:"gold_nugget",display:{Name:"Gold Coin",Lore:["$1",Count:32}]},
maxUses:9999999,
sell:{id:"leather_chestplate",display:{Name:"Shoddy Leather Jacket",Lore:["Lv.1",Count:1}]},
rewardExp:false},
{buy:{id:"gold_nugget",display:{Name:"Gold Coin",Lore:["$1",Count:24}]},
maxUses:9999999,
sell:{id:"leather_helmet",display:{Name:"Shoddy Leather Hat",Lore:["Lv.1",Count:1}]},
rewardExp:false},
{buy:{id:"gold_nugget",display:{Name:"Gold Coin",Lore:["$1",Count:28}]},
maxUses:9999999,
sell:{id:"leather_leggings",display:{Name:"Shoddy Leather Greaves",Lore:["Lv.1",Count:1}]},
rewardExp:false},
{buy:{id:"gold_nugget",display:{Name:"Gold Coin",Lore:["$1",Count:20}]},
maxUses:9999999,
sell:{id:"leather_boots",display:{Name:"Shoddy Leather Boots",Lore:["Lv.1",Count:1}]},
rewardExp:false}]}}

The issue I'm having is that no items are showing up where it usually states the trades.

There's a blank spot in the UI where the offered trades should be

Anyways, I am pretty sure I have some silly syntax error somewhere but any help is much appreciated. Thanks.


Solution 1:

Your command looks a little chaotic like this, so I can't quite tell which part causes the items not to display, but I understand what you try to achieve, so I made you a command that summons a villager with 1 custom trade. The first trade in your command to be exact. It looks like this:

/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},
                maxUses:9999999
            }
        ]
    }
}

I tested this and all the trades are visible in the trade menu.

I would like to address some things as well:
- A villager is a passive mob and doesn't need the PersistenceRequired tag.
- Please build your command in steps/iterations. First try to summon a villager. Then try to give him one special trade, without any fancy items. Let him trade a brown mushroom for a red mushroom for example. Then try to do something fancy with the item. Then try to give the villager more trades. After each change, be sure to test your command, so you know that everything works up to that point.

The trades were probably invisible because the Count tag was in the wrong place in your command. You basically asked for 0 items and wanted 0 items in return. 0 items are displayed as nothing. The lore and the custom name wouldn't have been visible if your command worked, because the display tag has to be inside a tag tag.

You can use the command that I provided and I'm sure you can figure out how to add more trades to the villager. It's just a matter of copying and pasting. Make sure that you remove all the white-space characters(tabs and new-lines) inside the NBT data before pasting this command, otherwise it doesn't work.

EDIT: Leaving the maxUses out causes the trade to lock itself every now and then, which is probably not desirable. I removed that suggestion.