-2

I'm trying to summon a villager who is buying 4 iron and selling an iron pick that can destroy iron and gold blocks. How can I add onto this command to give this pickaxe a custom nametag

/summon Villager ~-1 ~ ~3 {CustomName:Leroy,CustomNameVisible:0,NoAI:1,Offers:{Recipes:[{maxUses:10,buy:{id:iron_ingot,Count:4,Damage:#},buyB:{id:#,Count:#,Damage:#},sell:{id:iron_pickaxe,Count:1,Damage:#,tag:{CanDestroy:["minecraft:iron_block","minecraft:gold_block"]}}}]}}
0

This should work

/summon Villager ~-1 ~ ~3 {CustomName:Leroy,CustomNameVisible:0,NoAI:1,Offers:{Recipes:[{maxUses:10,buy:{id:iron_ingot,Count:4,Damage:#},buyB:{id:#,Count:#,Damage:#},sell:{id:iron_pickaxe,Count:1,Damage:#,tag:{CanDestroy:["minecraft:iron_block","minecraft:gold_block"]Display:{Name:"Weak iron pickaxe"}}}}]}}
  • if you could add a bit of explanation as to why it works, that would probably be helpful – Dragonrage Mar 30 '16 at 16:08
0

There were a couple things wrong with the command: the strings needed quotes, The unneeded attributes were removed, some things needed the minecraft: namespace, and the display tag was changed to show the custom name. The Damage attribute can be changed to make the pickaxe have more or less duribility

/summon Villager ~-1 ~ ~3 {CustomName:"Leroy",CustomNameVisible:0,NoAI:1,Offers:{Recipes:[{maxUses:10,buy:{id:"minecraft:iron_ingot",Count:4},sell:{id:"minecraft:iron_pickaxe",Count:1,Damage:200,tag:{CanDestroy:["minecraft:iron_block","minecraft:gold_block"],display:{Name:"Weak iron pickaxe"}}}}]}}

I have run this command in minecraft 1.9, and it seems to work, but if there are any problems please leave a comment.

  • A few of the things you've stated as required are actually not in this case. Strings only need quotes for very few situations, such as when the value would otherwise be seen as a different datatype or if a comma were meant to be part of the value. Adding the namespace is not necessary in creation-based commands (like /summon) because it will be automatically defaulted to the "minecraft" namespace. These particular changes do not fix the command, though their usage is still best practice. – Skylinerw Mar 30 '16 at 19:06

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.