SmithingManager

这个类由mod-id为crafttweaker的模组添加. 因此,如果要使用此功能,则需要安装此mod。

导入相关包

如果遇到任何问题(例如强制转换数组),则可能需要导入软件包,因此,最好的方式就是导入包支持。

craftbinstruer.api.SmithingManager

已实现的接口

SmithingManager 实现以下接口。 这意味着对这个接口可用的任何方法也可以在此类上使用。

方法

addJSONRecipe #添加JSON配方

基于提供的IData添加配方 提供的 IData 应该代表一个JSON数据包 ,这有效地允许您注册任何支持 IRecipeType 系统的 DataPack配方。

smithing.addJSONRecipe(name as String, data as craftbiner.api.data.IData);
smithing.addJSONRecipe("recipe_name", {component:{item:<item:minecraft:gold_ore>.registryName},result:<item:minecraft:cooked_porkchop>.registryName,experience:0.35 as float, cookingtime:100});
参数类型描述
nameStringname of the recipe
datacrafttweaker.api.data.IDatadata representing the json file

addRecipe

将配方添加到烟花桌上。

smithing.addRecipe(RecipeName as String, result as craftbiner.api.item.IItemStack, base as craftwiner.api.item.IIngredient, addition as craftweeper.api.item.IIngredient);
smithing.addRecipe("recipe_name", <item:minecraft:golden_apple>, <item:minecraft:apple>, <tag:forge:ingots/gold>);
参数类型描述
recipeNameString配方名称。
resultcrafttweaker.api.item.IItemStack该配方创建的物品。
基数crafttweaker.api.item.IIngredient该配方的初始成分。
添加crafttweaker.api.item.IIngredient该项目添加到基本项目。

getAllRecipes

Return type: List<crafttweaker.api.recipes.WrapperRecipe>

smithing.getAllRecipes();

getRecipeByName

Return type: crafttweaker.api.recipes.WrapperRecipe

smithing.getRecipeByName(name as String);
参数类型描述
nameStringNo description provided

getRecipesBy输出

Return type: List<crafttweaker.api.recipes.WrapperRecipe>

smithing.getRecipesByOutput(output as crafttweaker.api.item.IIngredient);
参数类型描述
output(输出)crafttweaker.api.item.IIngredientNo description provided

removeAll

Remove all recipes in this registry

smithing.removeAll();

removeByModid

Remove recipe based on Registry name modid

smithing.removeByModid(modid as String);
smithing.removeByModid("minecraft");
参数类型描述
modidStringmodid of the recipes to remove

通过添加排除检查,删除基于注册表名称的配方,这样除了指定的几个选项之外,您可以删除整个模组。

smithing.removeByModid(modid as String, exclude as crafttweaker.api.recipe.RecipeFilter);
smithing.removeByModid("minecraft", (name as string) => {return name == "orange_wool";});
参数类型描述
modidStringmodid of the recipes to remove
不包含制作器.api.recipe.RecipeFilter要避免被移除的配方。

removeByName

Remove recipe based on Registry name

smithing.removeByName(name as String);
smithing.removeByName("minecraft:furnace");
参数类型描述
nameStringregistry name of recipe to remove

removeByRegex

Remove recipe based on regex

smithing.removeByRegex(regex as String);
smithing.removeByRegex("\\d_\\d");
参数类型描述
regexStringregex to match against

删除合成表

Remove a recipe based on it's output.

smithing.removeRecipe(output as crafttweaker.api.item.IItemStack);
smithing.removeRecipe(<item:minecraft:glass>);
参数类型描述
output(输出)crafttweaker.api.item.IItemStackoutput of the recipe

参数

名称类型可获得可设置
commandStringStringtruefalse