4

I've tried A LOT of different syntaxes and nothing has allowed me to reach my goal. I want to create a Villager that A) sells spawners (I've been able to do this) and B) have those spawners spawn mobs other than pigs. So like a zombie or something. From there I could name him a "Zombie Spawner Trader" or something like that. Keep in mind, my villager is being created no problem and he's buying and selling things according to what I've programmed, all that's wrong is that the spawner is only spawning pigs. I have tried NBT tags: "Entity", "EntityId" and "SpawnData" with their proper syntaxes according to the wiki, and none of them worked. It proceeded to give me a pig spawner as usual.

Some code:

/summon villager ~ ~1 ~ {CustomName:"Zombie Spawner Merchant",CustomNameVisible:1b,NoAI:1b,Invulnerable:1b,Offers:{Recipes:[{buy:{id:"minecraft:gold_nugget",tag:{display:{Name:"Gold Coin",Lore:["$1"]}},Count:32},sell:{id:"minecraft:mob_spawner",Count:15,tag:{SpawnData:{id:"minecraft:zombie"}}}]}}
  • I don't believe this is possible currently. I believe any NBT data you save to the spawner item is eliminated when the spawner is placed and converts to a block. People have long been asking how to use the give command to give a monster spawner with custom spawns and I have never seen any answer except mods/plugins. The only way it could be done is by having the villager trade a spawn egg to convert a regular spawner. – IronAnvil Nov 26 '17 at 2:22
  • @IronAnvil It is possible; I just posted an answer explaining it. – pppery yesterday
0

This command will summon villager that will trade 32 coins for two zombie spawn eggs. It will also trade 1 zombie spawn egg for a monster spawner. The player can then combine the two to make a zombie spawner.

/summon villager ~ ~1 ~ {Invulnerable:1b,CustomName:"Zombie Spawner Merchant",CustomNameVisible:1b,NoAI:1b,CareerLevel:1,Offers:{Recipes:[{buy:{id:"minecraft:spawn_egg",Count:1b,tag:{CanPlaceOn:["minecraft:mob_spawner"],EntityTag:{id:"minecraft:zombie"}}},sell:{id:"minecraft:mob_spawner",Count:15b}},{buy:{id:"minecraft:gold_nugget",Count:32b,tag:{display:{Name:"Gold Coin",Lore:["$1"]}}},sell:{id:"minecraft:spawn_egg",Count:2b,tag:{CanPlaceOn:["minecraft:mob_spawner"],EntityTag:{id:"minecraft:zombie"}}}}]}}

Its a bit hacky I know, but I'm pretty sure that villagers wont trade for custom spawners.

  • I think it is possible for villagers to trade for custom spawners – pppery Jul 9 at 4:27
  • Are you sure this actually works in non-creative mode? – pppery yesterday
0

To summon a villager that sells Spawners spawning specific mobs:

/summon villager ~ ~ ~ {Offers:{Recipes:[{buy:<item to buy>,sell:{id:"minecraft:spawner",tag:{BlockEntityTag:{SpawnPotentials:[{Entity:{id:"<entity that the spawners spawn>"}}],Delay:-1}},Count:<number of spawners to sell>}}]}}

Note that, when placed, the spawners will appear to spawn pigs for the first second or so, but it will quickly correct itself to spawn the desired entity type.

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.