Station Recipes

基本信息

属性 值
注册 API net.mcft.betterstorage.api.crafting.BetterStorageCrafting.addStationRecipe(...)
实现目录 src/main/java/net/mcft/betterstorage/api/crafting/ 与 src/main/java/net/mcft/betterstorage/item/recipe/
配方类 ShapedStationRecipe / ShapelessStationRecipe
接口 IStationRecipe
容器 3×3 合成 + 3×3 输出 + 9×2 内部存储

来源:src/main/java/net/mcft/betterstorage/container/ContainerCraftingStation.java;src/main/java/net/mcft/betterstorage/api/crafting/。

功能

合成台使用独立于工作台的配方系统。IStationRecipe 接口定义了合成台的匹配契约,BetterStorageCrafting.addStationRecipe 是注册入口。

本 mod 自身注册了 3 条合成台配方:

配方类 注册位置 条件
PresentRemoveNametagRecipe src/main/java/net/mcft/betterstorage/misc/Recipes.java:168 tile.present 与 tile.cardboardBox 均启用
CardboardEnchantmentRecipe Recipes.java:323 anyCardboardItemsEnabled
CardboardRepairRecipe Recipes.java:325-327 anyCardboardItemsEnabled 且 item.cardboardSheet 启用

合成台容器布局

ContainerCraftingStation.setupInventoryContainer(src/main/java/net/mcft/betterstorage/container/ContainerCraftingStation.java:52-60):

区段 槽位索引 数量 坐标 槽位类型
合成输入 0–8 3×3 17 + x*18, 17 + y*18 SlotBetterStorage
输出 9–17 3×3 107 + x*18, 17 + y*18 SlotStationOutput
内部存储 18+ 9×2 8 + x*18, 76 + y*18 SlotBetterStorage

容器尺寸 super(player, inventory, 9, 2)(ContainerCraftingStation.java:32),GUI 高度 209(:41-43)。

槽位转移规则(:62-71):

  • inInventory(slot):仅索引 ≥ 9 的槽位算「内部存储」
  • transferStart(slot):从非内部槽转移时起点为 18(跳到内部存储区)

原版配方兼容

VanillaStationCrafting(src/main/java/net/mcft/betterstorage/item/recipe/VanillaStationCrafting.java)负责把原版 3×3 配方接入合成台,受配置 general.enableStationVanillaCrafting 控制(默认 true)。

配方输入抽象

合成台的输入匹配使用 IRecipeInput 体系,而非直接比对 ItemStack:

类 用途
RecipeInputBase 抽象基类
RecipeInputItemStack 直接匹配物品栈
RecipeInputOreDict 走物品字典匹配
RecipeInputList 多选一匹配
RecipeBounds 配方在 3×3 中的位置约束

来源:src/main/java/net/mcft/betterstorage/api/crafting/。

这使第三方模组可以定义诸如「任意铜锭」「任意原木」之类的宽松输入。

合成来源

ICraftingSource(src/main/java/net/mcft/betterstorage/api/crafting/ICraftingSource.java)与 CraftingSourceTileEntity 描述配方的合成来源容器;ContainerInfo 描述容器元信息。

相关条目