GenericRecipesManager
Link to genericrecipesmanager
This recipe manager allows you to perform removal actions over all recipe managers. You can access this manager by using the recipes
global keyword.
Импорт класса
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 crafttweaker.api.GenericRecipesManager;
Enum Constants
Link to enum-constants
GenericRecipesManager is an enum. It has 1 enum constants. They are accessible using the code below.
ZenScript CopyGenericRecipesManager.INSTANCE
Методы
Link to методы
Name: addJsonRecipe
Add a new recipe based on the given recipe in a valid DataPack JSON format.
Unlike the addJSONRecipe method in IRecipeManager<T> you must set the type of the recipe within the JSON yourself.
ZenScript Copy// GenericRecipesManager.addJsonRecipe(name as string, data as MapData)
recipes.addJsonRecipe("recipe_name", {
type: "minecraft:smoking",
ingredient: <item:minecraft:gold_ore>,
result: <item:minecraft:cooked_porkchop>,
experience: 0.35 as float,
cookingtime: 100
});
Параметр | Тип | Описание |
---|---|---|
Параметр name | Тип string | Описание The recipe's resource path |
Параметр data | Тип MapData | Описание The recipe in JSON format |
Name: getAllManagers
Returns a list of all known recipe managers. This includes managers added by mod integrations as well as wrapper managers added to provide simple support.
Return Type: stdlib.List<IRecipeManager>
ZenScript Copy// GenericRecipesManager.getAllManagers() as stdlib.List<IRecipeManager>
recipes.getAllManagers();
Name: getAllRecipes
Return Type: stdlib.List<Recipe>
ZenScript Copy// GenericRecipesManager.getAllRecipes() as stdlib.List<Recipe>
recipes.getAllRecipes();
Name: getRecipeByName
Return Type: Recipe
ZenScript CopyGenericRecipesManager.getRecipeByName(name as string) as Recipe
Параметр | Тип |
---|---|
Параметр name | Тип string |
Name: getRecipeMap
Returns a map of all known recipes.
Returns: A Map of recipe name to recipe of all known recipes.
Return Type: Recipe[ResourceLocation]
ZenScript Copy// GenericRecipesManager.getRecipeMap() as Recipe[ResourceLocation]
recipes.getRecipeMap();
Name: getRecipesByOutput
Return Type: stdlib.List<Recipe>
ZenScript CopyGenericRecipesManager.getRecipesByOutput(output as IIngredient) as stdlib.List<Recipe>
Параметр | Тип |
---|---|
Параметр output | Тип IIngredient |
Name: remove
Removes recipes by output
ZenScript Copy// GenericRecipesManager.remove(output as IIngredient)
recipes.remove(<item:minecraft:iron_ingot>);
Параметр | Тип | Описание |
---|---|---|
Параметр output | Тип IIngredient | Описание The recipe result |
Name: removeAll
Removes all recipes from all managers.
ZenScript Copy// GenericRecipesManager.removeAll()
recipes.removeAll();
Name: removeByModid
Removes all recipes from the provided mod. Chooses the recipes based on their full recipe name, not based on output item!
ZenScript Copy// GenericRecipesManager.removeByModid(modId as string)
recipes.removeByModid("crafttweaker");
Параметр | Тип | Описание |
---|---|---|
Параметр modId | Тип string | Описание The mod's modId |
Name: removeByModid
Removes all recipes from the provided mod. Allows a function to exclude certain recipe names from being removed. In the example below, only the recipe for the white bed would remain. Since the recipe's namespace is already fixed based on the modId argument, the recipe filter will only check the resource path!
ZenScript Copy// GenericRecipesManager.removeByModid(modId as string, exclude as Predicate<string>)
recipes.removeByModid("minecraft", (recipeName as string) => recipeName == "white_bed");
Параметр | Тип | Описание |
---|---|---|
Параметр modId | Тип string | Описание The mod's modid |
Параметр исключить | Тип Predicate<string> | Описание Function that returns true if the recipe should remain in the registry. |
Name: removeByName
Remove recipes based on Registry names
ZenScript CopyGenericRecipesManager.removeByName(names as string[])
Параметр | Тип | Описание |
---|---|---|
Параметр names | Тип string[] | Описание registry names of recipes to remove |
Name: removeByRegex
Remove recipe based on regex
ZenScript Copy// GenericRecipesManager.removeByRegex(regex as string)
recipes.removeByRegex("\\d_\\d");
Параметр | Тип | Описание |
---|---|---|
Параметр regex | Тип string | Описание regex to match against |
Name: removeRecipe
Removes recipes by output
ZenScript Copy// GenericRecipesManager.removeRecipe(output as IIngredient)
recipes.removeRecipe(<item:minecraft:iron_ingot>);
Параметр | Тип | Описание |
---|---|---|
Параметр output | Тип IIngredient | Описание The recipe result |
Свойства
Link to свойства
Название | Тип | Имеет Getter | Имеет Setter | Описание |
---|---|---|---|---|
Название allManagers | Тип stdlib.List<IRecipeManager> | Имеет Getter true | Имеет Setter false | Описание Returns a list of all known recipe managers. This includes managers added by mod integrations as well as wrapper managers added to provide simple support. |
Название allRecipes | Тип stdlib.List<Recipe> | Имеет Getter true | Имеет Setter false | Описание |
Название recipeMap | Тип Recipe[ResourceLocation] | Имеет Getter true | Имеет Setter false | Описание Returns a map of all known recipes. |