VilligerTradeAPI_
You always wanted to code a Villiger Trade, but you found nothing or only an very long Code? Now you can write it without an eternally long code! You importe the VilligerTrade-API in your Project, and code an Villiger Trade with following Code:
At first you Create an Trade-Inventory:
//Create an Trade Merchant inv = new Merchant(); inv.setTitle("Blocks");
Then you set the Trade thinks in the inv:
//Add an Item (Here 2 Sandstone for 2 Redstone (2 Redstone --> 2 Sandstone)) inv.addOffer(new MerchantOffer(new ItemStack(Material.REDSTONE, 2), new ItemStack(Material.SANDSTONE, 2)));
But when you want 2 Items for 1 Item, do this:
//Add an Item (Here 2 Sandstone for 2 Redstone + 1 Iron Ingot (2 Redstone + 1 Iron Ingot--> 2 Sandstone)) inv.addOffer(new MerchantOffer(new ItemStack(Material.REDSTONE, 2), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.SANDSTONE, 2)));
You can add as many items as you want! Then you open the Inventory with this Code:
//Inventory open inv.setCustomer(p); inv.openTrading(p);
This was my API. I hope I can help you. If you find Bugs(I don't think that there some Bugs :)) leave a Comment. I was an German Guy. Sorry for my mistakes :)!
Thx forFeedback! Bye
Comments