Invalid leaf directive! `since`

Main class of the JEI integration.

This class is responsible for handling any and all integration possibilities with JEI.

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
Copy
import mods.jeitweaker.Jei;

Name: addIngredient

Adds the specified ingredient to the list of ingredients displayed by JEI.

The list of ingredients is available on the JEI ingredients panel, usually displayed on the right side of the
screen. Note that ingredients added can still be hidden through appropriate calls to the hiding methods.

ZenScript
Copy
// Jei.addIngredient(ingredient as JeiIngredient)

Jei.addIngredient(<item:minecraft:dirt>);
ParameterTypeDescription
Parameter
ingredient
Type
JeiIngredient
Description
The ingredient to add.

Link to addIngredientInformation

Name: addIngredientInformation

Adds the given set of Components to the information page of the specified ingredient.

The specified set of components will then be appended to the current set of information displayed within JEI.
It is worth noting that every invocation of this method will therefore create one or more new pages to display
the full set of components.

Once added, information cannot be removed.

The information page can be viewed by attempting to look for recipes of the specified ingredient, then
identifying the information category in the category list.

ZenScript
Copy
// Jei.addIngredientInformation(ingredient as JeiIngredient, info as Component[])

Jei.addIngredientInformation(<item:minecraft:apple>, Component.literal("One apple a day keeps the doctor at bay, yum 😋"));
ParameterTypeDescription
Parameter
ingredient
Type
JeiIngredient
Description
The ingredient for which the information should be added.
Parameter
info
Type
Component[]
Description
A variable-length list of Components representing the information to add.

Name: hideCategory

Hides the specified category from being viewable.

The category is hidden through its identifier: a list of all known categories can be obtained by checking the
output of /ct dump jeitweaker:jei_categories. Hiding a category is global, meaning that it will not
appear any more in any category listing, be it the global one or the focused one.

Once hidden, a category cannot be shown again.

ZenScript
Copy
// Jei.hideCategory(category as ResourceLocation)

Jei.hideCategory(<resource:minecraft:smithing>);
ParameterTypeDescription
Parameter
category
Type
ResourceLocation
Description
The category to hide.

Name: hideIngredient

Hides the specified ingredient from JEI.

The ingredient will be hidden not only from the JEI ingredient panel, but also in the list of recipe catalysts
and in recipe listings, essentially making it as if it never appeared.

Note that ingredients that were added can also be hidden with this command.

A side effect of ingredient hiding is that if the ingredient was the sole catalyst of a recipe category, then
the category will also be hidden as well. Care must be taken if this behavior is not desired.

ZenScript
Copy
// Jei.hideIngredient(ingredient as JeiIngredient)

Jei.hideIngredient(<item:minecraft:dried_kelp>);
ParameterTypeDescription
Parameter
ingredient
Type
JeiIngredient
Description
The ingredient to hide.

Name: hideIngredients

Hides the specified variable-arguments list of ingredients from JEI.

This acts not only as a convenience method accepting a list instead of a single element like
hideIngredient, but also as a way to use more complicated data structures such as tags or proper arrays
for removal.

The ingredients will be hidden not only from the JEI ingredient panel, but also in the list of recipe
catalysts and in recipe listings, essentially making them as if they never appeared.

Note that ingredients that were added can also be hidden with this command.

A side effect of ingredient hiding is that if the ingredient was the sole catalyst of a recipe category, then
the category will also be hidden as well. Care must be taken if this behavior is not desired.

ZenScript
Copy
// Jei.hideIngredients(ingredients as JeiIngredient[])

Jei.hideIngredients(<item:minecraft:redstone_dust> | <item:minecraft:iron_ingot>);
Jei.hideIngredients([<item:minecraft:stone>, <item:minecraft:compass>]);
ParameterTypeDescription
Parameter
ingredients
Type
JeiIngredient[]
Description
The ingredients to hide.

Link to hideIngredientsByRegex

Name: hideIngredientsByRegex

Hides all ingredients whose entire registry name matches the given regex, regardless of type.

The ingredients are therefore checked according to their registry name directly, which means that if the
ingredient is named "mod:path", then "mod:path" will be validated against the given regular
expression.

The regular expression must be a valid regular expression. Websites such as
RegExr can be used to verify the validity and the adequacy of the given regular
expression.

All ingredients will be hidden regardless of type and from everywhere, meaning not only from the JEI
ingredient panel, but also in the list of recipe catalysts and in recipe listings, essentially making them as if
they never appeared.

Note that ingredients that were added can also be hidden with this command.

A side effect of ingredient hiding is that if the ingredient was the sole catalyst of a recipe category, then
the category will also be hidden as well. Care must be taken if this behavior is not desired.

ZenScript
Copy
// Jei.hideIngredientsByRegex(pattern as string)

Jei.hideIngredientsByRegex("[a-z]*:[a-z]*[0-9]");
ParameterTypeDescription
Parameter
pattern
Type
string
Description
The regular expression pattern to be used for matching.

Link to hideModIngredients

Name: hideModIngredients

Hides all ingredients from the specified mod, regardless of type.

The ingredients are matched according to their registry name. Namely, if the registry name of the ingredient
has the mod as the namespace, then it will be hidden, unless the path was excluded through the given exclusion
filter. In other words, if the ingredient name is "mod:path", then the exclusion filter will get given
"path" as an argument. If the return value is true, then the item will not be
removed, otherwise it will.

All ingredients will be hidden regardless of type and from everywhere, meaning not only from the JEI
ingredient panel, but also in the list of recipe catalysts and in recipe listings, essentially making them as if
they never appeared.

Note that ingredients that were added can also be hidden with this command.

A side effect of ingredient hiding is that if the ingredient was the sole catalyst of a recipe category, then
the category will also be hidden as well. Care must be taken if this behavior is not desired.

ZenScript
Copy
// Jei.hideModIngredients(modId as string, exclusionFilter as Predicate<string>)

Jei.hideModIngredients("minecraft", path => false);
Jei.hideModIngredients("minecraft", path => path == "golden_hoe");
ParameterTypeDescriptionOptionalDefault Value
Parameter
modId
Type
string
Description
The id of the mod that should be hidden.
Optional
false
Default Value
​
Parameter
exclusionFilter
Type
Predicate<string>
Description
An optional exclusion filter to avoid hiding certain elements.
Optional
true
Default Value
(path as string) => { return false; }

Name: hideRecipe

Hides the given recipe from the specified recipe category.

The category is identified through its identifier: a list of all known categories can be obtained by checking
the output of /ct dump jeitweaker:jei_categories. The recipe is identified through its recipe name
instead, which can be obtained either through /ct recipes or by hovering over the output of the recipe
in the JEI recipe view with advanced tooltips enabled.

It is important to note that the recipe is not removed from the machine, meaning it is still able to be
crafted: hiding is merely a visual change in the recipe list.

Attempting to hide a recipe from a category that does not contain it results in nothing being done.

Once hidden, a recipe cannot be shown again.

ZenScript
Copy
// Jei.hideRecipe(category as ResourceLocation, recipe as ResourceLocation)

Jei.hideRecipe(<resource:minecraft:stonecutting>, <resource:minecraft:andesite_stairs_from_andesite_stonecutting>);
ParameterTypeDescription
Parameter
category
Type
ResourceLocation
Description
The category which contains the recipe to hide.
Parameter
recipe
Type
ResourceLocation
Description
The name of the recipe to hide.