How to add 1 extra trade to a villager, without changing the other trades [duplicate]

What I wanted to make was a villager that depending on what other actions you do (let’s simplify that to clicking buttons) gets extra trades. I figured out how to set the trades of a villager:

/entitydata @e[type=Villager] {Offers:{Recipes:[{rewardExp:0b,maxUses:2147483647,uses:0,buy:{id:diamond,Count:1},buyB:{id:emerald,Count:5}}]}}

But I cannot figure out how to add a trade to this without removing, or having to re-specify this trade, add another trade to this villager. Is there a way of doing this?

Answer

It makes it harder that you’re using /entitydata, but try using the /summon command:

/summon Villager ~1 ~ ~ {Profession:0,CustomName:"[VillagerNameHere]",CustomNameVisible:1,Career:1,CareerLevel:42,CanPickUpLoot:0,PersistenceRequired:1,Invulnerable:1,Offers:{Recipes:[{buy:{id:"diamond_sword",Count:1},maxUses:9999999,buyB;{id:emerald,Count:5},sell:{id:"[put item you want to sell here]",Count:1},rewardExp:false}]}}

Attribution
Source : Link , Question Author : Seoaros , Answer Author : Vemonus

Leave a Comment