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
. Так что если вы хотите использовать эту функцию, вам нужно установить этот мод.
Импорт класса
Link to импорт-класса
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
Параметр | Тип | Описание |
---|---|---|
Параметр id | Тип string | Описание The ID of the category to create. |
Параметр name | Тип Компонент MCTextcomponent | Описание A MCTextComponent representing the name of the category. |
Параметр icon | Тип JeiDrawable | Описание A JeiDrawable that acts as the icon for the category. |
Параметр catalysts | Тип JeiIngredient[] | Описание An array of JeiIngredient acting as catalysts for the category. It must not be empty. |
Параметр T | Тип JeiCategory | Описание 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
Параметр | Тип | Описание |
---|---|---|
Параметр id | Тип string | Описание The ID of the category to create. |
Параметр name | Тип Компонент MCTextcomponent | Описание A MCTextComponent representing the name of the category. |
Параметр icon | Тип JeiDrawable | Описание A JeiDrawable that acts as the icon for the category. |
Параметр catalysts | Тип JeiIngredient[] | Описание An array of JeiIngredient acting as catalysts for the category. It must not be empty. |
Параметр configurator | Тип Consumer<T> | Описание A Consumer<T> allowing configuration of the category as it gets built. |
Параметр T | Тип JeiCategory | Описание The type of the category to create. It must extend JeiCategory. |
Свойства
Link to свойства
Название | Тип | Имеет Getter | Имеет Setter | Описание |
---|---|---|---|---|
Название background | Тип JeiDrawable | Имеет Getter true | Имеет Setter false | Описание Gets the JeiDrawable that serves as the background for recipes of this category. |
Название catalysts | Тип JeiIngredient[] | Имеет Getter true | Имеет Setter false | Описание Gets the lists of catalysts currently registered to this category. |
Название icon | Тип JeiDrawable | Имеет Getter true | Имеет Setter false | Описание Gets the JeiDrawable that acts as the icon for this category. |
Название id | Тип Расположение MCResource-ресурсов | Имеет Getter true | Имеет Setter false | Описание Gets the ID of the category. |
Название name | Тип Компонент MCTextcomponent | Имеет Getter true | Имеет Setter false | Описание Gets the name of the category. |