Skip to content

Non Item Ingredients

mezz edited this page Oct 27, 2016 · 2 revisions

Ingredients

JEI supports anything as an ingredient for recipes, and for displaying in the ingredient list.
Yes even that.

The VanillaPlugin adds ingredient definitions for ItemStack and FluidStack.

Adding New Ingredients

To add ingredients to JEI, you first have to create a plugin. Your plugin is given IModIngredientRegistration in its registerIngredients method.

Using the IModIngredientRegistration.register method, you tell JEI everything about how to handle the new type of ingredient.
You also pass it a full list of ingredients to include in the ingredient list.

Ingredient Helper

There are certain actions JEI needs to perform on ingredients in order to use them.
An IIngredientHelper lets JEI manipulate new ingredients and get important information from them for finding matching ingredients, error reporting, and other functions.

Ingredient Renderer

In order to render an ingredient, JEI needs an IIngredientRenderer.
The Ingredient Renderer passed in here will be used to draw ingredients in 16x16 squares for the ingredient list, and provides information required to draw the ingredient's tooltip when it's hovered over in the list.

Using New Ingredients in Recipes

Many methods in JEI take in a parameter for the ingredient class you want to work with.
Simply use your new ingredient like you would an ItemStack.class or FluidStack.class ingredient.

Recipe Layout

Some convenience or legacy methods will deal with ItemStack or FluidStack ingredients directly, but there is always a version of the method that takes the ingredient class nearby.

One example is IRecipeLayout which has the following methods:

	IGuiItemStackGroup getItemStacks();
	IGuiFluidStackGroup getFluidStacks();
	<T> IGuiIngredientGroup<T> getIngredientsGroup(Class<T> ingredientClass);

The first two are convenience methods, because most recipes only deal with those two types of ingredients.

Note that IGuiItemStackGroup and IGuiFluidStackGroup have special init methods that also create an item renderer.
When using a custom ingredient, you will have to use the more generic IGuiIngredientGroup.init and provide your own IIngredientRenderer.

JEI does not simply use the IIngredientRenderer used in the ingredient list because ingredients are often represented differently in recipes and in the list. One example is FluidStack, which is a square in the ingredient list, and often drawn as a tank in recipes.

Full Documentation

See IModIngredientRegistration.

Clone this wiki locally