Recipe Categories - mezz/JustEnoughItems GitHub Wiki
Recipe Categories
A recipe category defines everything that's common across entire categories of recipes.
The recipe categories add by plugins in JEI are Crafting
, Smelting
, Fuel
, Brewing
, and Description
.
See VanillaRecipeCraftingUid
for more information about these recipe categories.
Responsibilities of a recipe category:
- Define a category
- The category's UID
- Localized Title
- Background Image
- Set recipe layouts based on the given recipe wrapper.
- Fill out which ingredients are visible on the screen and their location.
Optional Abilities of a recipe category:
- Draw extra elements and animations on the screen.
- Some categories may need to draw extra slots or other elements not drawn by the background.
Implementation
Fill out the required methods for the UID and Title.
Defining the Background and other images
There are helpful methods in IGuiHelper
for drawing cropped resources on the screen.
The way the recipe lays out on the screen depends on the background's size.
- The less height the background has, the more recipes fit on one screen.
- Backgrounds may need extra padding to fit text without running into the next recipe.
- Be sure to check how your recipe looks at different GUI scales in Minecraft. JEI will try to display more recipes when the GUI scale is smaller.
Setting the recipe layout
For a better understanding of this process, follow along with one of the IRecipeCategory
implementations in the List of Plugin Implementations.
In IRecipeCategory.setRecipe
, the category will define the layout of ingredients for a single IRecipeWrapper
.
The IRecipeLayout
is set up here to display ingredients, that each have tooltips and can be clicked to navigate to other recipes.
- From the
IRecipeLayout
, get theItemStack
,FluidStack
, or otherIGuiIngredientGroup
that you want to place. - Init the
IGuiIngredientGroup
with the locations the ingredients should be drawn. - Set the ingredients in the
IGuiIngredientGroup
using the various set methods.
Full Documentation
See IRecipeCategory
.