-1

I want to know how to make a villager buy custom banners and I also want to know what the problem with my code is so that I don't make the same mistake again.

This is what I typed:

/summon villager ~ ~1 ~    {VillagerData:{profession:nitwit,level:2,type:plains},NoAI:1,Offers:{Recipes:[{buy:{id:white_banner,Count:1,tag:{BlockEntityTag:{Patterns:[{Pattern:"mr",Color:13},{Pattern:"bs",Color:12},{Pattern:"cs",Color:1},{Pattern:"bo",Color:12},{Pattern:"ms",Color:15},sell:{id:gold_ingot,Count:5}]}}},maxUses:9999999}]}}

1 Answer 1

2

Here is what your NBT looks like, expanded:

{
  VillagerData: {
    profession: nitwit,
    level: 2,
    type: plains
  },
  NoAI: 1,
  Offers: {
    Recipes: [
      {
        buy: {
          id: white_banner,
          Count: 1,
          tag: {
            BlockEntityTag: {
              Patterns: [
                {Pattern: "mr", Color: 13},
                {Pattern: "bs", Color: 12},
                {Pattern: "cs", Color: 1},
                {Pattern: "bo", Color: 12},
                {Pattern: "ms", Color: 15},
                sell:{id:gold_ingot,Count:5}
              ]
            }
          }
        },
        maxUses: 9999999
      }
    ]
  }
}

The problem is that you put the data for your sell item into the Patterns of the banner. You need to move it out and have it sit alongside buy:

{
  NoAI: 1b,
  VillagerData: {
    profession: "minecraft:nitwit",
    type: "minecraft:plains",
    level: 2
  },
  Offers: {
    Recipes: [
      {
        maxUses: 2147483647,
        buy: {
          id: "minecraft:white_banner",
          Count: 1,
          tag: {
            BlockEntityTag: {
              Patterns: [
                {Pattern: "mr", Color: 13},
                {Pattern: "bs", Color: 12},
                {Pattern: "cs", Color: 1},
                {Pattern: "bo", Color: 12},
                {Pattern: "ms", Color: 15}
              ]
            }
          }
        },
        sell: {id: "minecraft:gold_ingot", Count: 5b}
      }
    ]
  }
}

When minified, the NBT you require looks like this:

{NoAI:1b,VillagerData:{profession:"minecraft:nitwit",type:"minecraft:plains",level:2},Offers:{Recipes:[{maxUses:2147483647,buy:{id:"minecraft:white_banner",Count:1,tag:{BlockEntityTag:{Patterns:[{Pattern:"mr",Color:13},{Pattern:"bs",Color:12},{Pattern:"cs",Color:1},{Pattern:"bo",Color:12},{Pattern:"ms",Color:15}]}}},sell:{id:"minecraft:gold_ingot",Count:5b}}]}}
2
  • I still don't completely understand what I should do code wise. can you show me what I should type in the command block.
    – Alex
    Apr 11 at 0:31
  • @Alex I've added a minified version of the NBT. Substitute in the current NBT code with what I have there. So first type /summon villager ~ ~1 ~ , then that code that I added. Apr 11 at 2:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .