5

When making a custom adventure map, usually you only want the trades you programmed into a villager to show up. By default, however, the game will try to spawn new trades when the last one is made. The classic way I'm seeing in tutorials to prevent new trades is to make the last trade untradeable; however, with the release of 1.7, a lot of the old item IDs that were unobtainable have been removed from the game altogether, and following the tutorial I have crashes the game when the trade interface is scrolled to the last trade.

So there's two parts to this question:

  1. Is there a better way to prevent new trades with the 1.7 mechanics? Or with the snapshots of 1.8 mechanics?
  2. If not, what is a safe data ID to use to prevent the last trade from being a real trade as of 1.7?
3

One of you said that the max career level is 4, so I used this command

/summon Villager ~ ~1 ~ {Profession:0,Career:2,CareerLevel:4,Offers:{Recipes:[{rewardExp:0b,maxUses:2147483647,uses:0,buy:{id:double_plant,Count:8,tag:{display:{Name:"Coin"}}},sell:{id:wooden_sword,Count:1,tag:{Unbreakable:1,display:{Name:"Sturdy Stick"}}}},{rewardExp:0b,maxUses:2147483647,uses:0,buy:{id:double_plant,Count:12,tag:{display:{Name:"Coin"}}},sell:{id:golden_sword,Count:1,tag:{AttributeModifiers:[{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:-.10,Operation:1,UUIDLeast:112181,UUIDMost:524106}],Unbreakable:1,ench:[{id:16,lvl:1}]}}},{rewardExp:0b,maxUses:2147483647,uses:0,buy:{id:double_plant,Count:2,tag:{display:{Name:"Coin"}}},sell:{id:leather,Count:1}}]},Attributes:[{Name:generic.movementSpeed,Base:0}],PersistenceRequired:1,ActiveEffects:[{Id:10,Amplifier:50,Duration:133333333333320,ShowParticles:0b},{Id:21,Amplifier:60,Duration:1333333333333333200}]} 

and set the career level at 4, this spawns a villager with a career level of 4 that will trade sunflowers named Coin for certain items. Now I tested this multiple times to make sure I was correct, and I was, setting the career level at 4 will prevent new trades from appearing. I am not sure if this works in 1.9, 1.10 or 1.11 because I still play in 1.8.9.

3

I don't know much about custom villager trading, and a cursory glance over the NBT structure of villagers didn't reveal anything new to me.

As for your second point, there's a perfect technical block that should work for the newer versions: The Barrier.

Not only is it unobtainable without creative/commands, but it's icon is this:

enter image description here

It's itemID is barrier, so you can try

/summon Villager ~ ~ ~ {
  Offers:{Recipes:[
    {maxUses:1337,buy:{id:diamond},sell:{id:emerald}},
    {maxUses:1,buy:{id:barrier,tag:{display:{Name:No More Trades}}},sell:{id:barrier,tag:{display:{Name:No More Trades}}}}
  ]}}

Which sells renamed Barriers for renamed Barriers. You might need to use minecraft:barrier instead of just barrier, I'm not sure about that.

2

I'm almost one hundred percent certain that the other comment won't work. However, what will work is this:

/summon Villager ~ ~ ~ {CustomName:Billy,Profession:4,CareerLevel:6,Offers:{Recipes:[{maxUses:99999,buy:{id:"minecraft:emerald",Damage:0,Count:10},buyB:{id:"minecraft:book",Damage:0,Count:1},sell:{id:"minecraft:dye",Damage:5,Count:20}}]}}

When this command is triggered, it will summon a villager with the name Billy, who wears a white apron. He will trade you 20 purple dyes for 10 emeralds and 1 book. An odd trade to be sure, but it works.

I know you've probably either given up or found a work around by now, but this is for those who stumble across this question/answer later.

  • How does this at all answer the question? I've seen the other answer applied in adventure maps and it works. – Elias Benevedes Jan 8 '15 at 21:58
  • 1
    How do I prevent new villager trades from spawning? That is the question. I've tried copy-pasting that command, and it doesn't work. It gives the option to sell the villager a barrier block. However, each time a villager gets a new trade, it adds to its career level. It's career level determines what new trades it offers. The maximum career level is 4. By putting it at 6, it will try to obtain more trades, but can't because there are no trades for that level. Thus, no purple sparkles and thus no new trades. – user3377318 Jan 10 '15 at 1:24
  • From what I understand, I don't think villagers will create new trades unless the last trade is done at least once. Since players can't acquire barrier blocks, they can't do the last trade. – Elias Benevedes Jan 10 '15 at 18:35
  • That was how it was pre-1.8 update. As of 1.8 update, any trade from the most recent career level will allow them to rank up. – user3377318 Jan 12 '15 at 3:49
0

You can't make them stop spawning in new trades, I made a lucky block that spawns a lucky villager but he keeps leveling up his trades.

-1

Use entitydata each time player is traded using scoreboard of stat.tradedWithVillager to reset the trade of the villager. It could lag if there is too much villager, but I think this is the best way to prevent from new trade.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.