Skip to content

公开 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.2.9</version><scope>provided</scope></dependency>
kotlin
repositories { maven("https://repo.crypticlib.com/repository/maven-public/") }
dependencies { compileOnly("emaki.jiuwu.craft:emaki-cooking-api:4.2.9") }

仅编译依赖

不要安装、bundle、shade 或 relocate API Jar。EmakiCooking-4.2.9.jar 已内嵌未 relocate 的 API 类;第二份 ClassLoader 类型会使事件和 bridge 失效。

真实四层

EmakiCookingApi 的公开形状是四个非 null 入口:

  1. status():用 status().usable() 判断 runtime 是否可用。
  2. nutrition():玩家营养子系统。
  3. catalog():配方与已放置工位查询。
  4. operations():输出构建和完成条件检查。

installuninstallBridge 只供 runtime 生命周期使用。营养可由配置独立关闭;API 可用不代表 nutrition().enabled() 为 true,关闭状态按业务拒绝 REJECTED 表达。

Nutrition

  • enabled()types()type(id):定义查询。
  • value(UUID,type):当前值或配置默认值。
  • addremoveset:修改缓存值,实时玩家数据须遵守 player owner thread。
  • applyFood(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,不会被猜作 wok。
  • recentStation(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 精确为 UNAVAILABLENOT_FOUNDINVALID_INPUTREJECTEDCANCELLEDTARGET_OFFLINEWRONG_THREADINTERNAL_ERROR