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.
Anyways, I am pretty sure I have some silly syntax error somewhere but any help is much appreciated. Thanks.
33 Answers
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.
3You certainly do have several syntax errors and omissions. Several of the mistakes are the same. (I am guessing you used copy/paste which created multiples) Lets look at those.
Here is a single buy portion of your code:
buy:{id:"gold_nugget",display:{Name:"Gold Coin",Lore:["$1",Count:32}]}The ,Count:32} is on the inside of Lore:[...] and also the inside of display:{...}. Lets put that in it's correct place inside buy:{...}. That gives us:
buy:{id:"gold_nugget",display:{Name:"Gold Coin",Lore:["$1"]},Count:32}Next, the display:{...} portion needs to be inside tag:{...} which gives us:
buy:{id:"gold_nugget",tag:{display:{Name:"Gold Coin",Lore:["$1"]}},Count:32}Fix these issues with every instance of buy:{...} and sell:{...} and you get:
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",tag:{display:{Name:"Gold Coin",Lore:["$1"]}},Count:32},maxUses:9999999,sell:{id:"leather_chestplate",tag:{display:{Name:"Shoddy Leather Jacket",Lore:["Lv.1"]}},Count:1},rewardExp:false},{buy:{id:"gold_nugget",tag:{display:{Name:"Gold Coin",Lore:["$1"]}},Count:24},maxUses:9999999,sell:{id:"leather_helmet",tag:{display:{Name:"Shoddy Leather Hat",Lore:["Lv.1"]}},Count:1},rewardExp:false},{buy:{id:"gold_nugget",tag:{display:{Name:"Gold Coin",Lore:["$1"]}},Count:28},maxUses:9999999,sell:{id:"leather_leggings",tag:{display:{Name:"Shoddy Leather Greaves",Lore:["Lv.1"]}},Count:1},rewardExp:false},{buy:{id:"gold_nugget",tag:{display:{Name:"Gold Coin",Lore:["$1"]}},Count:20},maxUses:9999999,sell:{id:"leather_boots",tag:{display:{Name:"Shoddy Leather Boots",Lore:["Lv.1"]}},Count:1},rewardExp:false}]}}Which gives us this guy:
Also, just to note, when working with large commands like this, I highly recommend this JSON viewer, as it has the ability to format which makes it much easier to understand and see mistakes.
You should try mcstacker.bimbimma.com - its a website that allows you to type in what you want to happen or select what you want to give or what it can place on etc. You can summon any entity and choose what is it wearing and so on.
In this instance you could use it to build a 'summon' command for a villager then have a custom trade for it.
It is a very handy tool for making maps, as I am making a huge map revolved around command blocks and this is very helpful.
5