2

I want to summon a villager that sells nothing when you sell to him something. For example:

/summon Villager ~ ~1 ~ {Silent:1,NoAI:1,Offers:{Recipes:[{maxUses:1,buy:{id:"minecraft:flint",Count:1},sell:{id:"",Count:0,Damage:0}}]}}

So when I sell him flint, I will get nothing in return. The only problem is whenever I make the trade, my game crashes. The only way I can really think of doing this is by selling a random item (Like TNT) and have a command block on a clock clear that item. But I would rather to use that as a last resort. Any help would be great. Thanks.

  • Get air. or something useless. or something unused and use command blocks to autoremove that from player. – Ave Aug 24 '15 at 16:05
  • Can I ask what the use-case for this villager will be? – MrLemon Aug 24 '15 at 16:38
  • Air also crashes the game. The reason why I want the villager to sell nothing is because I have command blocks testing for when the player trades with the villager. I will probably have to resort to using a random item and having command blocks clear it from the players inventory, but if there was another way, that would be great. – thezi3 Aug 24 '15 at 19:17
  • Air and "" will both crash the game, you can give the player an item with a count of 0 but that will just result in an itemstack with 0 items – ModDL Aug 24 '15 at 23:09
2

You cannot set empty NBT tag nor set something to zero count.

Make it another way - Sell two items and let him give you back the one of it - "renewable token".

So you will sell "anything" + "item you want to sell" , and get "anything" back. Yup, you just lost that thing you wanted to get rid of.

/summon Villager ~ ~1 ~ {Silent:1,NoAI:1,Offers:{Recipes:[{maxUses:7,buy:{id:"minecraft:flint",Count:1},buyb:{id:"minecraft:stone",Count:1},sell:{id:"minecraft:stone",Count:1}}]}}

PS: buyb is the second buy tag, as I remember, cannot check now from work :)

  • You can set the count of an item to zero, but you try to use / place said item it will disappear. I think what I might do is rework the system so that the villager has no offers, and have a command block testing to see if the player is "talking" with the villager. Then I could have another command block testing to see what is in the player selected slot. If it's flint, then I would have it do the exact same thing I was planning on having it do. But thanks for all the help. – thezi3 Aug 27 '15 at 15:01
  • Well with this solution you do not need to redo anything, your commandblock checking the trade will be fully working :) – Antoine Hejlík Aug 28 '15 at 10:54
-4

I think that should do it, /summon Villager ~1 ~ ~ {Profession:0,CustomName:"Useless Trader",CustomNameVisible:0,Career:2,CareerLevel:42,PersistenceRequired:1,Invulnerable:1,Attributes:[{Name:"generic.maxHealth",Base:99999}],Offers:{Recipes:[{buy:{id:"air",Count:0},maxUses:9999999,sell:{id:"air",Count:0}}]}}

  • 2
    Except the asker is trying to summon a villager that he can give items to. You've defined it as completely empty. – nine Aug 27 '15 at 8:38

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.