CraftingTableManager #工作台合成表管理

Link to craftingtablemanager-工作台合成表管理

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

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

ZenScript
Copy
crafttweaker.api.CraftingTableManager

已实现的接口

Link to 已实现的接口

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

addJSONRecipe #添加JSON配方

Link to addjsonrecipe-添加json配方

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

ZenScript
Copy
craftingTable.addJSONRecipe(name as String, data as crafttweaker.api.data.IData);
craftingTable.addJSONRecipe("recipe_name", {ingredient:{item:<item:minecraft:gold_ore>.registryName},result:<item:minecraft:cooked_porkchop>.registryName,experience:0.35 as float, cookingtime:100});
参数类型描述
参数
name(名称)
类型
字符串[string]
描述
name of the recipe
参数
data
类型
crafttweaker.api.data.IData
描述
data representing the json file

Adds a shaped recipe to the crafting table

ZenScript
Copy
craftingTable.addShaped(recipeName as String, output as crafttweaker.api.item.IItemStack, ingredients as crafttweaker.api.item.IIngredient[][], recipeFunction as com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionMatrix);
craftingTable.addShaped("recipe_name", <item:minecraft:dirt>, [[<item:minecraft:diamond>], [<tag:minecraft:wool>]]);
craftingTable.addShaped("recipe_name", <item:minecraft:dirt>, [[<item:minecraft:diamond>], [<tag:minecraft:wool>]], (usualOut as IItemStack, inputs as IItemStack[][]) => {if(inputs[0][0].displayName == "totally real diamond block" ){return usualOut;}return <item:minecraft:clay>.setDisplayName("Diamond");});
参数类型描述可选的默认值
参数
recipeName
类型
字符串[string]
描述
name of the recipe to add.
可选的
false
默认值
null
参数
output(输出)
类型
crafttweaker.api.item.IItemStack
描述
output IItemStack
可选的
false
默认值
null
参数
ingredients
类型
crafttweaker.api.item.IIngredient[][]
描述
array of an array of IIngredient for inputs
可选的
false
默认值
null
参数
recipeFunction
类型
com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionMatrix
描述
optional com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionMatrix for more advanced conditions
可选的
true
默认值
null

addShapedMirrored

Link to addshapedmirrored

Adds a mirrored shaped recipe to the crafting table

ZenScript
Copy
craftingTable.addShapedMirrored(recipeName as String, output as crafttweaker.api.item.IItemStack, ingredients as crafttweaker.api.item.IIngredient[][], recipeFunction as com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionMatrix);
craftingTable.addShapedMirrored("recipe_name", <item:minecraft:dirt>, [[<item:minecraft:diamond>], [<tag:minecraft:wool>]]);
craftingTable.addShapedMirrored("recipe_name", <item:minecraft:dirt>, [[<item:minecraft:diamond>], [<tag:minecraft:wool>]], (usualOut as IItemStack, inputs as IItemStack[][]) => {if(inputs[0][0].displayName == "totally real diamond block" ){return usualOut;}return <item:minecraft:clay>.setDisplayName("Diamond");});
参数类型描述可选的默认值
参数
recipeName
类型
字符串[string]
描述
name of the recipe to add.
可选的
false
默认值
null
参数
output(输出)
类型
crafttweaker.api.item.IItemStack
描述
output IItemStack
可选的
false
默认值
null
参数
ingredients
类型
crafttweaker.api.item.IIngredient[][]
描述
array of an array of IIngredient for inputs
可选的
false
默认值
null
参数
recipeFunction
类型
com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionMatrix
描述
optional com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionMatrix for more advanced conditions
可选的
true
默认值
null

Adds a shapeless recipe to the crafting table

ZenScript
Copy
craftingTable.addShapeless(recipeName as String, output as crafttweaker.api.item.IItemStack, ingredients as crafttweaker.api.item.IIngredient[], recipeFunction as com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionArray);
craftingTable.addShapeless("recipe_name", <item:minecraft:dirt>, [<item:minecraft:diamond>, <tag:minecraft:wool>]);
craftingTable.addShapeless("recipe_name", <item:minecraft:dirt>, [<item:minecraft:diamond>, <tag:minecraft:wool>], (usualOut as IItemStack, inputs as IItemStack[]) => {if(inputs[0].displayName == "totally real diamond block" ){return usualOut;}return <item:minecraft:clay>.setDisplayName("Diamond");});
参数类型描述可选的默认值
参数
recipeName
类型
字符串[string]
描述
name of the recipe to add.
可选的
false
默认值
null
参数
output(输出)
类型
crafttweaker.api.item.IItemStack
描述
output IItemStack
可选的
false
默认值
null
参数
ingredients
类型
crafttweaker.api.item.IIngredient[]
描述
array of IIngredient for inputs
可选的
false
默认值
null
参数
recipeFunction
类型
com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionArray
描述
optional com.blamejared.crafttweaker.api.managers.IRecipeManager.RecipeFunctionArray for more advanced conditions
可选的
true
默认值
null

Remove all recipes in this registry

ZenScript
Copy
craftingTable.removeAll();

Remove recipe based on Registry name modid

ZenScript
Copy
craftingTable.removeByModid(modid as String);
craftingTable.removeByModid("minecraft");
参数类型描述
参数
modid
类型
字符串[string]
描述
modid of the recipes to remove

Remove recipe based on Registry name

ZenScript
Copy
craftingTable.removeByName(name as String);
craftingTable.removeByName("minecraft:furnace");
参数类型描述
参数
name(名称)
类型
字符串[string]
描述
registry name of recipe to remove

Remove recipe based on regex

ZenScript
Copy
craftingTable.removeByRegex(regex as String);
craftingTable.removeByRegex("\\d_\\d");
参数类型描述
参数
regex
类型
字符串[string]
描述
regex to match against

Remove a recipe based on it's output.

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