Posted October 1, 20178 yr All the tutorials are pre-registry change-- VillagerRegistry.instance().registerVillageTradeHandler() doesn't exist anymore, and copying the vanilla code caused Forge to punch my computer.
October 1, 20178 yr Um... I believe somewhere in the forge docs I saw that you can register a villager profession. Idk if that was what you were looking for...
October 2, 20178 yr If you want to add trades to existing villager professions, you need: 1. Implement EntityVillager.ITradeList 2. Get the profession from ForgeRegistries.VILLAGER_PROFESSIONS 3. Get career from the profession 4. add the ITradeList to the career - #addTrade. Example below: Implementation which adds 60 emeralds -> 1 Wither skull trade: public class Trades implements EntityVillager.ITradeList { @Override public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) { recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD,60),new ItemStack(Items.SKULL,1,1))); } } Then getting a specific profession - nitwit in this case: VillagerRegistry.VillagerProfession nitwit=ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation("minecraft:nitwit")); And adding the trade to career with id "5": nitwit.getCareer(5).addTrade(1,new Trades()); Figure out desired career and profession by inspecting vanilla classes.
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.