简体中文
公开 API
编译依赖
xml
<repositories><repository><id>jiuwu-releases</id><url>https://repo.crypticlib.com/repository/maven-public/</url></repository></repositories>
<dependency><groupId>emaki.jiuwu.craft</groupId><artifactId>emaki-cooking-api</artifactId><version>4.3.6</version><scope>provided</scope></dependency>kotlin
repositories { maven("https://repo.crypticlib.com/repository/maven-public/") }
dependencies { compileOnly("emaki.jiuwu.craft:emaki-cooking-api:4.3.6") }仅编译依赖
不要安装, bundle, shade 或 relocate API Jar. EmakiCooking-4.3.8.jar 已内嵌未 relocate 的 API 类; 第二份 ClassLoader 类型会使事件和 bridge 失效
真实四层
EmakiCookingApi 的公开形状是四个非 null 入口:
status(): 用status().usable()判断 runtime 是否可用nutrition(): 玩家营养子系统catalog(): 配方与已放置工位查询operations(): 输出构建和完成条件检查
install, uninstall 与 Bridge 只供 runtime 生命周期使用. 营养可由配置独立关闭; API 可用不代表 nutrition().enabled() 为 true, 关闭状态按业务拒绝 REJECTED 表达
Nutrition
enabled(),types(),type(id): 定义查询value(UUID,type): 当前值或配置默认值add,remove,set: 修改缓存值, 实时玩家数据须遵守 player owner threadapplyFood(Player,ItemStack),recheckThresholds(Player): 玩家 owner thread, 并触发对应营养事件
Catalog
recipes(stationType)/recipe(stationType,id): 七类工位的加载配方matchRecipe(stationType,input,player): 单输入匹配; player 非 null 时需其 owner thread. Wok/发酵等多输入配方返回REJECTED, 不会伪装成单输入匹配stationAt(Location): location owner thread; 未知位置是NOT_FOUND, 不会被猜作 wokrecentStation(UUID): 最近由CookingStationInteractEvent记录的工位位置
Operations
createOutputs(stationType,recipeId): 为配方构建分离的全部成功输出, 不掷 chance; 部分输出构建失败时返回Partial<List<ItemStack>>completionConditionPasses(recipeId,player): 玩家 owner thread. 由于签名没有 station type, 跨工位重复 recipe id 会作为歧义拒绝;Success(false)是合法业务结果
公开 API 不直接运行工位 tick 或交付奖励; 它提供真实可回答的目录, 输出构建和条件判断
结果说明
无负载操作返回 EmakiResult<Unit>; 通用可选负载访问器为 optionalValue(). FailureKind 精确为 UNAVAILABLE, NOT_FOUND, INVALID_INPUT, REJECTED, CANCELLED, TARGET_OFFLINE, WRONG_THREAD, INTERNAL_ERROR