Recipes Overview - mezz/JustEnoughItems GitHub Wiki
Vanilla Recipes
JEI has built-in handling for recipes from the following classes:
- Crafting:
ShapedOreRecipe,ShapedRecipes,ShapelessOreRecipe,ShapelessRecipes- Brewing
VanillaBrewingRecipe,AbstractBrewingRecipe,BrewingRecipe,BrewingOreRecipe- Items that satisfy
PotionHelper.isReagent - Smelting
- Anything registered in
FurnaceRecipes - Fuels
- Items that satisfy
TileEntityFurnace.isItemFuel.
Support for all of these is added in the VanillaPlugin, using the same API as any other mod plugin.
If your recipe is not one of those listed above, it is a Modded Recipe.
Modded Recipes
To add support for your Modded Recipes to JEI, you have to create a plugin.
Next, it's time to fill out your plugin's register method.
In register, the plugin is passed the IModRegistry which can be used to add recipes to JEI.
There are three important classes for recipes:
- Represents a category of recipe, like "Crafting" or "Smelting".
- Draws the recipe background and any category-specific information on the screen.
- Sets recipe layout information for clickable ingredients on the screen.
- Represents a single recipe in a format that JEI can understand.
- Draws recipe-specific information on the screen.
- Ties a recipe class to a recipe category.
- Turns normal recipes into recipe wrappers.
- Checks that recipes are valid.
Modded Recipe Implementation
Adding a description page for an item:
- JEI has built-in support for recipes that serve as item descriptions.
Simply register your item and its description withIModRegistry.addDescription.
Adding Modded Recipes to a new recipe category:
-
Implement a Recipe Category, Recipe Wrapper, and Recipe Handler.
-
Register your Recipe Category using
IModRegistry.addRecipeCategoriesand register your Recipe Handler withIModRegistry.addRecipeHandlers. -
Add your regular recipes with
IModRegistry.addRecipes. They will be converted to Recipe Wrapper by your Recipe Handler at runtime by callingIRecipeHandler.getRecipeWrapper.
Adding Modded Recipes to an existing category:
- Only implement a Recipe Wrapper and a Recipe Handler.
- Use an existing UID for the recipe category UID in your Recipe Handler.
The UIDs for recipe categories added by JEI are listed inVanillaRecipeCategoryUid. Other mods should list their usable category UIDs in their own API somewhere. - If you are adding to the Vanilla Crafting Recipe Category in particular, your Recipe Wrapper must implement
ICraftingRecipeWrapperorIShapedCraftingRecipeWrapper.
-
Register your Recipe Handler by using
IModRegistry.addRecipeHandlers. -
Add your regular recipes with
IModRegistry.addRecipes. They will be converted to Recipe Wrapper by your Recipe Handler at runtime by a call toIRecipeHandler.getRecipeWrapper.