How do I make a Villager Trade a Spawn Egg [duplicate]

Solution 1:

Use the Damage: value. This is the command you should run in a command block:

/summon Villager ~ ~2 ~ {Invulnerable:1,CustomName:Spawner_Vendor,Profession:2,Career:1,Offers:{Recipes:[{buy:{id:gold_nugget,Count:8},sell:{id:spawn_egg,Count:1,Damage:92}}]}}

Solution 2:

How about MCStacker 2? MCStacker 2 is a no-download and free command generator. Here is a 1.12 example I got from it:/summon villager ~ ~ ~ {CustomName:"Spawn Egg Sal",Profession:0,Career:3,CareerLevel:100,Willing:1b,Offers:{Recipes:[{buy:{id:"minecraft:bone",Count:10b},buyB:{id:"minecraft:rotten_flesh",Count:10b},sell:{id:"minecraft:spawn_egg",Count:1b,tag:{EntityTag:{id:"minecraft:cow"}}}}]}}

1.13:/summon villager ~ ~ ~ {Profession:0,Career:3,CareerLevel:100,Willing:1b,CustomName:"{\"text\":\"Spawn Egg Sal\",\"color\":\"aqua\",\"bold\":true}",Offers:{Recipes:[{buy:{id:"minecraft:bone",Count:10b},buyB:{id:"minecraft:rotten_flesh",Count:10b},sell:{id:"minecraft:cow_spawn_egg",Count:1b}}]}}

MCStacker 2