ICookingRecipeManager

Default interface for Registry based handlers as they can all remove recipes by ResourceLocation.

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

导入相关包

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

crafttweaker.api.registries.ICookingRecipeManager

已实现的接口

ICookingRecipeManager implements the following interfaces. 这意味着对这个接口可用的任何方法也可以在此类上使用。

方法

addJSONRecipe #添加JSON配方

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

furnace.addJSONRecipe(name as String, data as crafttweaker.api.data.IData);
furnace.addJSONRecipe("recipe_name", {ingredient:{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

添加基于给定参数的合成表

furnace.addRecipe(name as String, output as crafttweaker.api.item.IItemStack, input as crafttweaker.api.item.IIngredient, xp as float, cookTime as int);
furnace.addRecipe("wool2diamond", <item:diamond>, <tag:minecraft:wool>, 1.0, 0);
参数类型描述
nameString新的合成表名称
output(输出)crafttweaker.api.item.IItemStack合成表的输出物品id
input(输入)crafttweaker.api.item.IIngredient合成表的输入成分
xpfloat玩家获得多少经验
cookTime #烧制时间int烧制需要多长时间

removeAll

Remove all recipes in this registry

furnace.removeAll();

removeByModid

Remove recipe based on Registry name modid

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

removeByName

Remove recipe based on Registry name

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

removeByRegex

Remove recipe based on regex

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

删除合成表

Remove a recipe based on it's output.

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

移除基于输出和输入的合成表

furnace.removeRecipe(output as crafttweaker.api.item.IItemStack, input as crafttweaker.api.item.IIngredient);
furnace.removeRecipe(<item:minecraft:diamond>, <tag:minecraft:wool>);
参数类型描述
output(输出)crafttweaker.api.item.IItemStack合成表的输出物品id.
input(输入)crafttweaker.api.item.IIngredient要移除的配方的成分。