How do I make a villager trade items with lore and a name

So all ive tried alot of things but i'm not good with commands

summon villager ~ ~ ~
{
  VillagerData: {
    profession:weaponsmith,
    level:5,
    type:swamp
  },
  Invulnerable:1,
  Silent:1,
  NoAI:1,
  CustomName:"\"Bounty board\"",
  Offers: {
    Recipes: [
      {
        buy: {
          id:"minecraft:Arrow",
          Count:1b,
          tag: {
            display: {
              Name:"hercules bow",
              Lore: ["This item is one of a kind"]
            }
          }
        },
        sell: {
          id:"diamond block",
          Count:1
        },
        rewardExp:0b,
        maxUses:1
      }
    ]
  }
}

I'm not sure why this isn't working but could someone help me


Solution 1:

You have multiple syntax errors. Here is a working command, made with a command generator:

/summon villager ~ ~ ~ {VillagerData:{profession:weaponsmith,level:5,type:swamp},Invulnerable:1,Silent:1,NoAI:1,CustomName:'{"text":"Bounty Board"}',Offers:{Recipes:[{buy:{id:"minecraft:arrow",Count:1b,tag:{display:{Name:'{"text":"hercules bow"}',Lore:['{"text":"This item is one of a kind"}']}}},sell:{id:"minecraft:diamond_block",Count:1b},rewardExp:0b,maxUses:1}]}}

Here are the errors your command contained:


/summon villager ~ ~ ~{VillagerData
...

There should be a space between the ~ and the {.


...
CustomName:""Bounty board""
...

This should be in JSON formatting, like so:

CustomName:'{"text":"Bounty Board"}'

...
Offers:{Recipes:[{buy:{id:"minecraft:Arrow",
...

"minecraft:Arrow" should not be capitalized.


...
tag:{display:{Name:"hercules bow",Lore:["This item is one of a kind"]}}}
...

The name and lore should be in JSON formatting, like so:

tag:{display:{Name:'{"text":"hercules bow"}',Lore:['{"text":"This item is one of a kind"}']}}}

...
sell:{id:"diamond block",Count:1}
...

There should be an underscore in the item id, like this: "diamond_block"