Skip to content

RecipeUtils [zh_cn]

Gary Bryson Luis Jr edited this page Aug 14, 2021 · 1 revision

RecipeUtils

RecipeUtils提供了一些方便合成的方法

需要import scripts.grassUtils.RecipeUtils;导入。

方法列表

recipeTweak(isShaped as bool, out as IItemStack, input as IIngredient[][]) as int
createSurround(core as IIngredient,surrounded as IIngredient) as IIngredient[][]
createFull3(input as IIngredient) as IIngredient[][]
createFull2(input as IIngredient) as IIngredient[][]
createCross(five as IIngredient, four as IIngredient) as IIngredient[][]
removeAllRecipe(input as IItemStack) as bool
removeAllRecipes(input as IItemStack[]) as bool
getConditions(stack as IItemStack) as ConditionedItemStack
getMetalName(arg as IOreDictEntry) as string // NOT SUGGESTED
getMetalNameNew(ore as IOreDictEntry, partName as string) as string

具体用法

recipeTweak

recipeTweak方法可以直接修改一个物品的合成,第一个参数为修改后的合成是否为有序

会返回一个int,为你已经使用recipeTweak修改的配方的数量

RecipeUtils.recipeTweak(true, <extrautils2:user>,[
    [<extrautils2:decorativesolid:3>,<ore:ingotSteel>,<extrautils2:decorativesolid:3>],
    [<ore:ingotSteel>,<minecraft:dropper>,<ore:ingotSteel>],
    [<extrautils2:decorativesolid:3>,<minecraft:blaze_rod>,<extrautils2:decorativesolid:3>]
]);



RecipeUtils.recipeTweak(false, <tinker_io:solidfuel> * 4,
[[<ore:dustAluminum>,<minecraft:gunpowder>,<ore:dustCoal>|<ore:dustCharcoal>,<ore:dustNiter>,<ore:dustBlaze>]]);

配方形状适配

createSurroundcreateFull3createFull2createCross这四个方法用于快速添加配方形状。

比如createCross(a,b)会返回[[a,b,a],[b,a,b],[a,b,a]]

// 将铁块改为4个铁锭合成
RecipeUtils.recipeTweak(true, <minecraft:iron_block>, RecipeUtils.createFull2(<ore:ingotIron>));

移除物品

removeAllReciperemoveAllRecipes方法用于删除物品(删除其的所有合成,并在JEI内隐藏)。一个的参数是单个物品,一个的参数是数组,可一次ban掉多个物品。

这两个方法会返回true

// 移除基岩
RecipeUtils.removeAllRecipe(<minecraft:bedrock>);
// 移除命令方块和命令方块矿车
RecipeUtils.removeAllRecipes([<minecraft:command_block>, <minecraft:command_block_minecart>]);

矿辞结构截取

getMetalNameNew方法用于在矿辞对象中提取金属名,用于基于矿辞的遍历合成修改。

RecipeUtils.getMetalNameNew(<ore:ingotIron>, "ingot"); //返回Iron
RecipeUtils.getMetalNameNew(<ore:gearIron>, "ingot"); //返回null

Clone this wiki locally