Posted June 10, 201312 yr does anyone know if there is a way to add another currency for villagers? I made a mod that adds money and would like to know if it's possible to add something like this.
June 10, 201312 yr You're probably going to have to rewrite some of the villager code... but I'll point you toward EntityVillager.addMerchantItem() BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 10, 201312 yr Author I was hoping I wouldn't have to modify the base code. maybe forge can add a hook for that.
June 10, 201312 yr Will this be for Vanilla Villagers or Custom Villagers? Legend of Zelda Mod[updated September 20th to 3.1.1] Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0] Fancy Cheeses[updated May 8th to 0.5.0]
June 10, 201312 yr For Custom Villagers you can just use a trade handler. Here is one of mine: package dudesmods.lozmod; import java.util.Random; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; public class villagerBeedleTradeHandler implements IVillageTradeHandler { @Override public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { //30 rupees for 1 potion recipeList.add(new MerchantRecipe(new ItemStack(LOZmod.ruppe, 3, 2), new ItemStack(Item.potion, 1, 8229))); //30 bombs = 100 rupees recipeList.add(new MerchantRecipe(new ItemStack(LOZmod.ruppe, 1, 5), new ItemStack(LOZmod.bomb, 30))); } } How it's used: recipeList.add(new MerchantRecipe(new ItemStack(Input), new ItemStack(Output))); recipeList.add(new MerchantRecipe(new ItemStack(Input 1),new ItemStack(Input 2), new ItemStack(Output))); Bit from main mod class: VillagerRegistry.instance().registerVillagerType(7, "/dudesmods/lozmod/villagerBeedle.png"); //id must be greater than 6 villagerBeedleTradeHandler newBeedleTradeHandler = new villagerBeedleTradeHandler(); VillagerRegistry.instance().registerVillageTradeHandler(7, newBeedleTradeHandler); VillagerRegistry.instance().getRegisteredVillagers(); Legend of Zelda Mod[updated September 20th to 3.1.1] Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0] Fancy Cheeses[updated May 8th to 0.5.0]
June 10, 201312 yr Author but that still doesn't help me make all trades useable with emeralds OR the money added by my mod.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.