JeiCategory
Link to jeicategory
Identifies a custom recipe category shown in JEI when querying a specific ingredient.
A JEI category is identified by four major components: an id, a name, an icon, and a series of catalysts.
The ID is a unique name that is used by JEI to identify the category, in the form of a MCResourceLocation.
With JeiTweaker, you have control only on the path
portion of the location, whereas the ID is fixed to the
one that represents the JeiTweaker mod.
The name is a MCTextComponent which identifies the category. It can be considered the human-friendly version of the category ID. More than one category can have the same name, although this is discouraged as a matter of clarity towards the player.
The icon is a JeiDrawable that is used as a graphic counterpart to the name, following the same rules. The
icon is rendered on the top section of the JEI user interface. An example icon could be the crafting table for the
minecraft:crafting
category, or the furnace for the minecraft:furnace
category.
Last but not least, the catalysts are a series of JeiIngredients that indicate where the recipe can be
crafted. They appear on the left side of the JEI user interface, in a recessed rectangle. An example set of catalysts
for the minecraft:crafting
category could be all crafting tables, modded or otherwise. The set of catalysts
might or might not contain the icon.
Moreover, each JeiTweaker category additionally specifies a background, which is used to provide a default background for recipes.
For mod developers looking to create additional categories: each category is automatically
discovered and registered by JeiTweaker as long as it extends JeiCategory
and is annotated with both
com.blamejared.crafttweaker.api.annotations.ZenRegister and org.openzen.zencode.java.ZenCodeType.Name. To be correctly registered, the class must not be abstract
(preferably, it should be final
) and it must have a constructor with the following
signature: public ClassName(ResourceLocation, MCTextComponent, JeiDrawable, RawJeiIngredient...)
. Any other
class is not going to be registered. Due to these requirements, mod developers are strongly encouraged not to
implement this interface directly, but rather extend SimpleJeiCategory instead.
This class was added by a mod with mod-id jeitweaker
. So you need to have this mod installed if you want to use this feature.
Importing the class
Link to importing-the-class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport mods.jei.category.JeiCategory;
Static Methods
Link to static-methods
Name: create
Creates a new category of the specified type, with the given parameters, configuring it to defaults.
Returns: The newly created category.
Return Type: JeiCategory
ZenScript CopyJeiCategory.create<T : JeiCategory>(id as string, name as MCTextComponent, icon as JeiDrawable, catalysts as JeiIngredient[]) as JeiCategory
Parameter | Type | Description |
---|---|---|
Parameter id | Type string | Description The ID of the category to create. |
Parameter name | Type MCTextComponent | Description A MCTextComponent representing the name of the category. |
Parameter icon | Type JeiDrawable | Description A JeiDrawable that acts as the icon for the category. |
Parameter catalysts | Type JeiIngredient[] | Description An array of JeiIngredient acting as catalysts for the category. It must not be empty. |
Parameter T | Type JeiCategory | Description The type of the category to create. It must extend JeiCategory. |
Name: create
Creates a new category of the specified type, with the given parameters, and with the given function as a
configurator.
Returns: The newly created category.
Return Type: JeiCategory
ZenScript CopyJeiCategory.create<T : JeiCategory>(id as string, name as MCTextComponent, icon as JeiDrawable, catalysts as JeiIngredient[], configurator as Consumer<T>) as JeiCategory
Parameter | Type | Description |
---|---|---|
Parameter id | Type string | Description The ID of the category to create. |
Parameter name | Type MCTextComponent | Description A MCTextComponent representing the name of the category. |
Parameter icon | Type JeiDrawable | Description A JeiDrawable that acts as the icon for the category. |
Parameter catalysts | Type JeiIngredient[] | Description An array of JeiIngredient acting as catalysts for the category. It must not be empty. |
Parameter configurator | Type Consumer<T> | Description A Consumer<T> allowing configuration of the category as it gets built. |
Parameter T | Type JeiCategory | Description The type of the category to create. It must extend JeiCategory. |
Properties
Link to properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name background | Type JeiDrawable | Has Getter true | Has Setter false | Description Gets the JeiDrawable that serves as the background for recipes of this category. |
Name catalysts | Type JeiIngredient[] | Has Getter true | Has Setter false | Description Gets the lists of catalysts currently registered to this category. |
Name icon | Type JeiDrawable | Has Getter true | Has Setter false | Description Gets the JeiDrawable that acts as the icon for this category. |
Name id | Type MCResourceLocation | Has Getter true | Has Setter false | Description Gets the ID of the category. |
Name name | Type MCTextComponent | Has Getter true | Has Setter false | Description Gets the name of the category. |