triocounter.blogg.se

Better villagers mod trading
Better villagers mod trading










Register the profession instance: You need to handle the RegistryEvent.Register event and use the event.getRegistry().register() method to register a new VillageProfession instance that has a matching profession registry name as well as locations for the regular and zombie textures.Declare an instance: You should declare a public static final VillagerProfession field that you assign to null in order to set it up for the method (where you initialize it to null then get it injected by registering (see Step #2) with a field name that matches the registry name.To create a new profession with careers and trades you need to: You can learn more at the villager careeer official wiki. Professions have multiple careers and each career has trades and AI. The first int parameter is the level of the trade to add.Ĭreating Custom Villager Professions and Careers Add your trade list to the career instance: Use the addTrade() method.Note that the parameter is an int or career name string, and you can look up the career ID in the villager careeer official wiki. Get the career instance: Using the profession instance from Step #2, the career instance can be retrieved with the getCareer() method.

better villagers mod trading

Inspect the vanilla classes to get the other registry references for other professions. Note that the parameter is a ResourceLocation such as "minecraft:nitwit". Get the profession instance: In the init loading phase (not pre-init because professions are registered after pre-init) you can get the profession from ForgeRegistries.VILLAGER_PROFESSIONS.getValue() method.Create trade list: Implement EntityVillager.ITradeList class and addMerchantRecipe() method to call the recipeList.add() method to add your additional trades.If you want to add trades to existing villager professions, you need to:












Better villagers mod trading