Skip to content
gresh113 edited this page Jun 19, 2020 · 11 revisions

Creating a JEI Plugin

Now that you're done with gradle in Getting Started, it's time to create your plugin.

JEI plugins implement the IModPlugin and are annotated with @JeiPlugin .
JEI uses the annotation to find your mod plugin class, and then creates an instance at runtime.

Annotation Loading

Loading this way has the advantage that you can keep all references to JEI in your plugin, separate from your other code.
The plugin code will only get called when JEI is there, so it will never crash from missing classes.

Implementation

Plugins are broken into several stages.

  1. registerItemSubtypes
  • This is where plugins tell JEI how to handle items that have subtypes that depend on NBT or capabilities instead of meta.
  • See the page on Item Subtypes.
  1. registerIngredients
  • This is an advanced section where plugins tell JEI about ingredients.
  • The Vanilla plugin registers ItemStack and FluidStack as ingredients here.
  • Just about anything can be an ingredient. To add your own, see Non-Item Ingredients.
  1. register
  • The bulk of item and recipe registration is done here.
  • See the page on Recipes Overview
  1. onRuntimeAvailable
  • Mods that interact directly with JEI at runtime will get an instance of the IJeiRuntime here.