-
Notifications
You must be signed in to change notification settings - Fork 314
Recipe Categories [1.13 and Up]
Kinsteen edited this page Jul 5, 2023
·
4 revisions
A recipe category defines everything that's common across entire categories of recipes. These include, but are not limited to: "crafting", "cooking" (for all furnace types), and "brewing".
Create a new class, which implements
IRecipeCategory<YourRecipeClass>
. The interface outlines functions that need and can be implemented, which are described below.
- (REQUIRED) getUid() - Returns a
ResourceLocation
that represents the category. Returning something along the lines ofnew ResourceLocations("yourmodid", "yourcraftingsystem")
will generally do the trick here. - (REQUIRED) getRecipeClass() - Returns the class of the recipe that your category uses.
return YourRecipeClass.class
is what you'll want to use here, assumingYourRecipeClass
is indeed the name of your recipe class. - (REQUIRED) getTitle() - Returns the title used for your category. For example, all anvil recipes use the title "Anvil" here.
- (REQUIRED) getBackground() - Returns the background used for your category. The
IGuiHelper
has methods that can help manipulate the image used for this. - (REQUIRED) getIcon() - Returns the icon used for your category. For example, anvil recipes return the item representation of an anvil here. To do this easily, you can use
IGuiHelper.createDrawableIngredient(new ItemStack(YourItem))
. - (REQUIRED) setIngredients() - A function called for all your recipes to set the inputs and outputs. The
IIngredients
parameter here is where you'll want to set your inputs and outputs. - (REQUIRED) setRecipe() - A function used to "put" the items of your recipe into place.
- (OPTIONAL) draw() - Used to draw any additional information when displaying a recipe. JEI uses this to draw the experience required text for anvil recipes.
- (OPTIONAL) getTooltipStrings() - Gets the tooltips to display based on the X and Y position of the mouse.
- (OPTIONAL) handleClick() - Allows for handling of a mouse click.
- (OPTIONAL) isHandled() - Whether or not the recipe has been handled.
It may be best to take a look at IRecipeCategory
if any of this seems confusing. You can find that interface here
Once you have a finished recipe category, it's pretty simple to register! Make sure you've created a JEI plugin, then inside of registerCategories
, call IRecipeCategoryRegistration.addRecipeCategory(new YourModCategory())
.
- Setup
- Item Ingredients
- Essential Extras
- Advanced
List of Plugin Implementations
- Setup
- Item Ingredients
- Working with Recipes
- Other