feat: add custom recipe
This commit is contained in:
Vendored
+22
@@ -509,6 +509,28 @@ declare class Recipes {
|
||||
/** 解锁条件(也可以填物品命名空间ID) */
|
||||
unlock: "AlwaysUnlocked" | "PlayerHasManyItems" | "PlayerInWater" | "None" | undefined
|
||||
): boolean;
|
||||
|
||||
/** 注册自定义有序合成表 */
|
||||
static registerCustomShapedRecipe(
|
||||
/** 合成表唯一标识符 */
|
||||
recipeId: string,
|
||||
/** 合成表摆放方式,数组元素为字符串 */
|
||||
shape: [string, string, string],
|
||||
/** 材料数组 */
|
||||
ingredients: string[],
|
||||
/** 合成结果 */
|
||||
result: Item
|
||||
): boolean;
|
||||
|
||||
/** 注册自定义无序合成表 */
|
||||
static registerCustomShapelessRecipe(
|
||||
/** 合成表唯一标识符 */
|
||||
recipeId: string,
|
||||
/** 合成材料 */
|
||||
ingredients: string[],
|
||||
/** 合成结果 */
|
||||
result: Item
|
||||
): boolean;
|
||||
}
|
||||
|
||||
/** 实验性功能类 */
|
||||
|
||||
@@ -96,6 +96,10 @@ const GMLIB_API = {
|
||||
registerShapedRecipe: ll.import("GMLib_ModAPI", "registerShapedRecipe"),
|
||||
/** 注册无序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */
|
||||
registerShapelessRecipe: ll.import("GMLib_ModAPI", "registerShapelessRecipe"),
|
||||
/** 注册有序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */
|
||||
registerCustomShapedRecipe: ll.import("GMLIB_API", "registerShapedRecipe"),
|
||||
/** 注册无序合成表 @type {function(string,Array.<string>,Array.<string>,string,number,string)} */
|
||||
registerCustomShapelessRecipe: ll.import("GMLIB_API", "registerShapelessRecipe"),
|
||||
/** 检测LRCA版本是否大于或等于此版本 @type {function(number,number,number):boolean} */
|
||||
isVersionMatched: ll.import("GMLIB_API", "isVersionMatched"),
|
||||
/** 获取LRCA版本 @type {function():string} */
|
||||
@@ -1194,6 +1198,18 @@ class Recipes {
|
||||
return GMLIB_API.registerShapedRecipe(recipeId, shape, ingredients, result, count, unlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册自定义有序合成表
|
||||
* @param {string} recipeId 合成表唯一标识
|
||||
* @param {[string,string,string]} shape 合成表摆放方式,数组元素为字符串
|
||||
* @param {Array.<string>} ingredients 材料数组
|
||||
* @param {Item} result 合成结果
|
||||
* @returns {boolean} 是否注册成功
|
||||
*/
|
||||
static registerCustomShapedRecipe(recipeId, shape, ingredients, result) {
|
||||
return GMLIB_API.registerCustomShapedRecipe(recipeId, shape, ingredients, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册无序合成表
|
||||
* @param {string} recipeId 合成表唯一标识
|
||||
@@ -1206,6 +1222,17 @@ class Recipes {
|
||||
static registerShapelessRecipe(recipeId, ingredients, result, count = 1, unlock = "AlwaysUnlocked") {
|
||||
return GMLIB_API.registerShapelessRecipe(recipeId, ingredients, result, count, unlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册自定义无序合成表
|
||||
* @param {string} recipeId 合成表唯一标识
|
||||
* @param {Array.<string>} ingredients 合成材料
|
||||
* @param {Item} result 合成结果
|
||||
* @returns {boolean} 是否注册成功
|
||||
*/
|
||||
static registerCustomShapelessRecipe(recipeId, ingredients, result) {
|
||||
return GMLIB_API.registerCustomShapelessRecipe(recipeId, ingredients, result);
|
||||
}
|
||||
}
|
||||
|
||||
/** 实验性功能类 */
|
||||
|
||||
Reference in New Issue
Block a user