Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Creating A Plugin

Rei Armenia edited this page Aug 8, 2018 · 3 revisions

Anvil Enchantments allows Developers to add their own recipes through a custom plugin. Doing this is SUPER easy!

There are somethings that my mod needs to get and use your plugin.


Creating Your Plugin

Your plugin class must be annotated with the @AnvilPlugin Annotation and must implement the IModPlugin interface.

This will have you implement (2) Two Methods, it is important that they are filled out properly.

Method 1 public String getPluginId(); Must return a string, should be the same as your ModId

Method 2 public void registerRecipes(IAnvilRegistry registry); Where all your Recipes should go!


More on IAnvilRegistry

There are two ways to add a Recipe to the registry.

  1. addConfigRecipe -- Adds a recipe that is associated with a config file.
  2. addBaseRecipe -- Adds a recipe that is hardcoded in mod.

The real difference is whether or not players will be able to edit the recipe. If you don't want a recipe to be edited, use the addBaseRecipe function.


Final note, the plugins are gathered in the PreInitialization Stage to ensure that your mod will be loaded properly please put "before:anvils;" in your @Mod dependencies.

Clone this wiki locally