Forum rules: Do not post bugs or feature requests here! Report bugs to our Issue Tracker and suggestions to Suggest a Feature.

This site is not for solicitation of services or 'purchasing' development. Please do not post requesting side mods/plugins and so on. Your thread will be removed, and you will receive a warning.
User avatar
By norelationstojfk
#129280 After playing in 1.6.4 for Pixelmon for a while, it became quickly obvious there were features I was sorely missing from 1.7. The biomes were one of them, but the other big one was summon commands. I've been waiting forever to be able to use Villager summon commands to create custom shops in Pixelmon, so I've spent much of my day hashing out some command code for this purpose. I made quite a few different ones but I thought I would share an example here for anyone who would like to try making their own.

This example creates a villager that sells what a traditional PokeMart would sell: pokeballs and some basic medicine. He accepts emeralds and emerald blocks as currency. You can even sell back the items he sells. You can copy and paste this right into a command block (it'll ignore the tabs and returns for you).
Code: Select all/summon Villager ~ ~1 ~
{Invulnerable:1,
Offers:
   {Recipes:
      [{maxUses:1000000,buy:{id:133,Count:2},sell:{id:4211,Count:1}},
       {maxUses:1000000,buy:{id:133,Count:3},sell:{id:4212,Count:1}},
       {maxUses:1000000,buy:{id:133,Count:4},sell:{id:4213,Count:1}},
       {maxUses:1000000,buy:{id:133,Count:1},sell:{id:4492,Count:1}},
       {maxUses:1000000,buy:{id:133,Count:2},sell:{id:4493,Count:1}},
       {maxUses:1000000,buy:{id:133,Count:3},sell:{id:4494,Count:1}},
       {maxUses:1000000,buy:{id:133,Count:5},sell:{id:4495,Count:1}},
       {maxUses:1000000,buy:{id:133,Count:8},sell:{id:4500,Count:1}},
       {maxUses:1000000,buy:{id:133,Count:1},sell:{id:4475,Count:1}},

       {maxUses:1000000,buy:{id:4211,Count:1},sell:{id:388,Count:8}},
       {maxUses:1000000,buy:{id:4212,Count:1},sell:{id:133,Count:1}},
       {maxUses:1000000,buy:{id:4213,Count:1},sell:{id:133,Count:2}},
       {maxUses:1000000,buy:{id:4492,Count:1},sell:{id:388,Count:3}},
       {maxUses:1000000,buy:{id:4493,Count:1},sell:{id:388,Count:6}},
       {maxUses:1000000,buy:{id:4494,Count:1},sell:{id:133,Count:1}},
       {maxUses:1000000,buy:{id:4495,Count:1},sell:{id:133,Count:3}},
       {maxUses:1000000,buy:{id:4500,Count:1},sell:{id:133,Count:5}},
       {maxUses:1000000,buy:{id:4475,Count:1},sell:{id:388,Count:5}}]
   },   
Profession:4,
Career:5,
CareerLevel:5,
CustomName:"PokeMart"
}

Giving an explanation of how this works: After specifying what you want to summon (Villager) and at what location (in this case, one block above the command block), you can further customize the Villagers attributes, including what it buys, sells, what skin it has, and what name it has. I have made him invulnerable just so you won't lose your PokeMart clerk to stray zombies if you enable mobs, but you should really fence him off anyway so he doesn't wander away either. Offers and Recipes represents items that he buys and sells. MaxUses is set to a ridiculous number so it is essentially infinitely available. The buy value is what you give him in exchange for the related sell value (so in case of the first one, you give him two emerald blocks for one pokeball). I'm no economist so the prices I have set here may or may not be totally fair. Profession changes the category, but for all intents and purposes, it's just for specifying the skin when it comes to custom shops. Career and CareerLevel are set to "invalid" values (5 and 5 work for all villager Professions) to keep the villager from making new offers and potentially erasing your custom ones. And finally, the CustomName attribute will assign the name you want.

Given how long it can take to make pokeballs, and healing items are hard to come by, I'd say take some time to establish some shops like this one if you want to add a little bit of economy to your Pixelmon world since it might be a while before we see PokeMarts added to the mod officially. It's completely native to Minecraft 1.7, so no extra mods are required. If you want to get into doing more custom Villager shops, I recommend searching for tutorials online and reading up on how command blocks work, but the best way to learn is to play with commands.

User avatar
By norelationstojfk
#129282
Cap_Cod » 29 Jun 2014 20:21 wrote:Nice I never knew you could do this. I always used NBTedit to edit what the Villagers bought/sold.

I've dabbled with external tools like NBT too, and they worked well, but since I write code irl professionally and as a hobby, playing with command blocks is something that I really like doing.
User avatar
By Quakthorn2
#131247
DemonCatLord » 15 Jul 2014 20:01 wrote:Nothing happens when I put this in a command block and trigger it, and yes command blocks are enabled



Do you have Essentials or have NPCs disabled in the server config?

Having it blocked in either one will prevent Villagers from spawning.
By DemonCatLord
#131531 Nothing like that.

I found an error in one of the lines.

anyway, I compiled a /spawn command that lets you spawn an npc that sells you pokeballs and such for emerald and a another that buys pixelmon drops, change the price at your own leisure.

Buy
Code: Select all/summon Villager ~ ~1 ~
{Invulnerable:1,Offers:{Recipes:[
{maxUses:9999999,buy:{id:388,Count:5,Damage:0},sell:{id:4103,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:10,Damage:0},sell:{id:4104,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:20,Damage:0},sell:{id:4105,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:2,Damage:0},sell:{id:4384,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:10,Damage:0},sell:{id:4385,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:15,Damage:0},sell:{id:4386,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:25,Damage:0},sell:{id:4387,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:5,Damage:0},sell:{id:4388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:10,Damage:0},sell:{id:4389,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:15,Damage:0},sell:{id:4390,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:20,Damage:0},sell:{id:4391,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:25,Damage:0},sell:{id:4392,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:25,Damage:0},sell:{id:4393,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:30,Damage:0},sell:{id:4394,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:5,Damage:0},sell:{id:4395,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:10,Damage:0},sell:{id:4396,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:10,Damage:0},sell:{id:4397,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:10,Damage:0},sell:{id:4398,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:10,Damage:0},sell:{id:4399,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:10,Damage:0},sell:{id:4400,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:30,Damage:0},sell:{id:4401,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:30,Damage:0},sell:{id:4402,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:30,Damage:0},sell:{id:4403,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:30,Damage:0},sell:{id:4404,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:30,Damage:0},sell:{id:4405,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:30,Damage:0},sell:{id:4406,Count:1,damage:0}},
{maxUses:9999999,buy:{id:388,Count:1,Damage:0},sell:{id:297,Count:1,damage:0}}]}
,Profession:4,Career:5,CareerLevel:5,CustomName:"Buy"}



Sell
Code: Select all/summon Villager ~ ~1 ~
{Invulnerable:1,Offers:{Recipes:[
{maxUses:9999999,buy:{id:4103,Count:1,Damage:0},sell:{id:388,Count:2,damage:0}},
{maxUses:9999999,buy:{id:4104,Count:1,Damage:0},sell:{id:388,Count:2,damage:0}},
{maxUses:9999999,buy:{id:4105,Count:1,Damage:0},sell:{id:388,Count:6,damage:0}},
{maxUses:9999999,buy:{id:4384,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:4385,Count:1,Damage:0},sell:{id:388,Count:3,damage:0}},
{maxUses:9999999,buy:{id:4386,Count:1,Damage:0},sell:{id:388,Count:4,damage:0}},
{maxUses:9999999,buy:{id:4387,Count:1,Damage:0},sell:{id:388,Count:6,damage:0}},
{maxUses:9999999,buy:{id:4388,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:4389,Count:1,Damage:0},sell:{id:388,Count:3,damage:0}},
{maxUses:9999999,buy:{id:4390,Count:1,Damage:0},sell:{id:388,Count:5,damage:0}},
{maxUses:9999999,buy:{id:4391,Count:1,Damage:0},sell:{id:388,Count:6,damage:0}},
{maxUses:9999999,buy:{id:4392,Count:1,Damage:0},sell:{id:388,Count:8,damage:0}},
{maxUses:9999999,buy:{id:4393,Count:1,Damage:0},sell:{id:388,Count:9,damage:0}},
{maxUses:9999999,buy:{id:4394,Count:1,Damage:0},sell:{id:388,Count:10,damage:0}},
{maxUses:9999999,buy:{id:4395,Count:1,Damage:0},sell:{id:388,Count:2,damage:0}},
{maxUses:9999999,buy:{id:4396,Count:1,Damage:0},sell:{id:388,Count:3,damage:0}},
{maxUses:9999999,buy:{id:4397,Count:1,Damage:0},sell:{id:388,Count:3,damage:0}},
{maxUses:9999999,buy:{id:4398,Count:1,Damage:0},sell:{id:388,Count:3,damage:0}},
{maxUses:9999999,buy:{id:4399,Count:1,Damage:0},sell:{id:388,Count:3,damage:0}},
{maxUses:9999999,buy:{id:4400,Count:1,Damage:0},sell:{id:388,Count:3,damage:0}},
{maxUses:9999999,buy:{id:4401,Count:1,Damage:0},sell:{id:388,Count:10,damage:0}},
{maxUses:9999999,buy:{id:4402,Count:1,Damage:0},sell:{id:388,Count:10,damage:0}},
{maxUses:9999999,buy:{id:4403,Count:1,Damage:0},sell:{id:388,Count:10,damage:0}},
{maxUses:9999999,buy:{id:4404,Count:1,Damage:0},sell:{id:388,Count:10,damage:0}},
{maxUses:9999999,buy:{id:4405,Count:1,Damage:0},sell:{id:388,Count:10,damage:0}},
{maxUses:9999999,buy:{id:4406,Count:1,Damage:0},sell:{id:388,Count:10,damage:0}},
{maxUses:9999999,buy:{id:4419,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:260,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:377,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:369,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:352,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:391,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:337,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:263,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:4,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:3,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:344,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:121,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:368,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:288,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:370,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:348,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:371,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:13,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:289,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:79,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:351,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:265,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:306,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:307,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:308,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:309,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:351,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:334,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:111,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:360,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:362,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:39,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:40,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:110,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:406,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:372,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:87,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:392,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:361,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:363,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:365,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:349,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:319,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:331,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:367,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:106,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:35,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:295,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:332,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:80,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:375,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:364,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:1,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:287,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:353,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}},
{maxUses:9999999,buy:{id:338,Count:1,Damage:0},sell:{id:388,Count:1,damage:0}}

]}
,Profession:4,Career:5,CareerLevel:5,CustomName:"sell"}

JOIN THE TEAM