Posted March 17, 20223 yr How to add custom offers to existing job types e.g. farmer. Edited March 17, 20223 yr by Squander
March 17, 20223 yr Author @SubscribeEvent public static void offers(VillagerTradesEvent event){ if(event.getType() == VillagerProfession.FLETCHER){ event.getTrades().put(1, Collections.singletonList(new BasicItemListing(32, new ItemStack(ModItems.EXPLOSIVE_ARROW.get()), 3, 5, 0.03f))); } } It works. But for tier one, only my offer is loaded, and vanilla is not. How to fix it?
March 17, 20223 yr Author @SubscribeEvent public static void offers(VillagerTradesEvent event){ if(event.getType() == VillagerProfession.FLETCHER){ event.getTrades().put(1, Collections.singletonList(new BasicItemListing(32, new ItemStack(ModItems.EXPLOSIVE_ARROW.get()), 3, 5, 0.03f))); } } It works. But for tier one, only my offer is loaded, and vanilla is not. How to fix it?
March 17, 20223 yr you replace the vanilla Trades with Int2ObjectMap#put in this case, you need to call Int2ObjectMap#get which returns a List of all Trades for level 1 then you can call List#add: event.getTrades().get(1).add(<your_trade>);
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.