3

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.

4
  • Get air. or something useless. or something unused and use command blocks to autoremove that from player.
    – ave
    Commented Aug 24, 2015 at 16:05
  • 1
    Can I ask what the use-case for this villager will be?
    – MrLemon
    Commented Aug 24, 2015 at 16:38
  • 1
    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
    Commented Aug 24, 2015 at 19:17
  • 1
    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
    Commented Aug 24, 2015 at 23:09

2 Answers 2

3

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 :)

2
  • 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
    Commented Aug 27, 2015 at 15:01
  • Well with this solution you do not need to redo anything, your commandblock checking the trade will be fully working :) Commented Aug 28, 2015 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}}]}}

1
  • 3
    Except the asker is trying to summon a villager that he can give items to. You've defined it as completely empty.
    – user114997
    Commented Aug 27, 2015 at 8:38

You must log in to answer this question.

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