Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.