配方研究台

配方研究台

数据驱动的研究表格模组,玩家通过解决物品链接谜题来解锁整合包中的A阶段进度。

image

配方联动(Recipe Linkage) 是一个数据驱动的科研桌模组,适用于 Minecraft NeoForge 1.21.1,并支持 Forge 1.20.1。

该模组专为整合包设计,让配方、机器或进度步骤更像“发现”而非简单的任务奖励。整合包作者通过数据包定义研究样本,玩家则在专用的科研桌上解决材料联动谜题,以解锁配置好的进度阶段。

它添加了什么?

  • 一个新的 配方科研桌 方块
  • 可重复使用的 研究样本,带有持久的图谱进度
  • 基于物品关系构建的图标式研究图谱
  • 具有可见目标的材料提交谜题
  • 完成研究后给予的 AStages 进度奖励
  • 可选的 JEI 和 Sophisticated Backpacks 便利性支持

研究如何运作

玩家将一个绑定的研究样本插入科研桌。样本会生成一个固定的研究图谱,并永久保留该图谱。

目标是可见的,但路径必须通过提交相关材料来逐步开放。可用节点会显示物品图标和所需数量,因此谜题在于选择一条穿过图谱的高效路径,而不是猜测文字谜语。

最终的目标节点不会消耗物品。一旦所达路径连接到目标,研究即告完成。

已完成的样本可以右键点击以领取其配置的阶段。服务端配置可以控制阶段是否在完成时自动授予,以及领取后的样本是否会被消耗。

为整合包设计

配方联动不内置任何研究内容。每项研究均从数据包加载,因此整合包作者可以精确决定每个样本所代表的内容。

研究节点可以使用:

  • 一个特定物品
  • 一个物品标签
  • 一个必需数量;省略 count 时默认为 1,而 count: 0 则检查拥有但不消耗该物品
  • 可选的 NBT 匹配
  • 可选的固定坐标,或自动图谱布局
  • 用于随机路径生成的加权边
  • 通过 Minecraft 文本组件实现的本地化研究标题

这使得它适用于门控配方、主题科技链、魔法发现、章节里程碑,或任何材料应暗示其自身关系的进度系统。

进度与便利性集成

  • AStages:完成研究的进度输出。
  • JEI:悬停研究节点并使用 JEI 查询所需材料。
  • Sophisticated Backpacks:启用后,材料提交可以从携带的背包中提取匹配物品。

AStages 为完成的样本提供进度结果。JEI 和 Sophisticated Backpacks 是可选的便利性集成。

重要说明

  • 研究样本不会被科研桌消耗。
  • 移除样本不会重置其图谱。
  • 已提交的材料不予退还。
  • 样本创建后,生成的路径不会重新随机。
  • 基础模组不提供默认研究样本;整合包必须通过数据包、任务、战利品、命令、KubeJS 或其他分发系统提供。

对于整合包作者

配置

整合包和服务端所有者可以在 config/recipe_linkage-common.toml 中调整行为:

  • autoAwardStageOnCompletion:默认 true,在研究完成时授予配置的阶段。
  • consumeCompletedSampleOnClaim:默认 false,控制右键领取是否消耗已完成的样本。
  • revealCompletedGraph:默认 false,控制完成的研究是否揭示完整的生成图谱。
  • enableSophisticatedBackpackMaterials:默认 true,允许材料提交从携带的 Sophisticated Backpacks 中提取。

数据包路径

研究 JSON 文件从以下路径加载:

data/<命名空间>/recipe_linkage/researches/<路径>.json

加载的研究定义也会作为即用型绑定样本出现在配方联动的创造模式标签页中。对于基于命令的分发,NeoForge 1.21.1 使用 minecraft:custom_data:

/give @p recipe_linkage:research_sample[minecraft:custom_data={RecipeLinkage:{Research:"modpack:basic_optics"}}]

Forge 1.20.1 使用旧版物品 NBT:

/give @p recipe_linkage:research_sample{RecipeLinkage:{Research:"modpack:basic_optics"}}

AStages + KubeJS 配方门控示例

此示例将红石比较器配方绑定到研究 JSON 中使用的同一个 target_stage: "basic_optics"。配方联动在研究完成时授予该 AStages 阶段;AStages KubeJS API 使该配方需要该阶段。

将此脚本放置在 kubejs/server_scripts/recipe_linkage_stages.js:

// 需要:AStages, KubeJS
AStages.addRestrictionForRecipe(
  'recipe_linkage:basic_optics_comparator',
  'basic_optics',
  'minecraft:crafting',
  'minecraft:comparator'
)

如果你使用下面的完整示例并带有 target_stage: "redstone_lens",请将 basic_optics 替换为 redstone_lens。

最小自动布局示例

此示例省略了所有 x 和 y 字段。配方联动将自动放置图谱,起始侧在左,目标在右。

保存为 data/modpack/recipe_linkage/researches/basic_optics.json:

{
  "target_stage": "basic_optics",
  "target": "comparator",
  "min_distance_to_target": 3,
  "nodes": [
    { "id": "sand", "tag": "minecraft:sand", "count": 8 },
    { "id": "glass", "item": "minecraft:glass", "count": 3 },
    { "id": "redstone", "item": "minecraft:redstone", "count": 4 },
    { "id": "quartz", "item": "minecraft:quartz", "count": 2 },
    { "id": "comparator", "item": "minecraft:comparator" }
  ],
  "edges": [
    { "from": "sand", "to": "glass" },
    { "from": "glass", "to": "redstone" },
    { "from": "redstone", "to": "quartz" },
    { "from": "quartz", "to": "comparator" }
  ]
}

如果省略 initial_nodes,模组会在生成样本图谱时选择一个有效的初始节点。如果边上省略 chance,则默认为 1.0。

完全自定义示例

此示例使用本地化标题、固定坐标、多个初始节点、标签输入、NBT 输入和加权边。

保存为 data/modpack/recipe_linkage/researches/redstone_lens.json:

{
  "title": {
    "translate": "research.modpack.redstone_lens",
    "fallback": "Redstone Lens"
  },
  "target_stage": "redstone_lens",
  "target": "comparator",
  "min_distance_to_target": 4,
  "generation_attempts": 96,
  "initial_nodes": ["sand", "copper"],
  "nodes": [
    { "id": "sand", "tag": "minecraft:sand", "count": 8, "x": 5, "y": 58 },
    { "id": "copper", "item": "minecraft:copper_ingot", "count": 3, "x": 8, "y": 78 },
    { "id": "glass", "item": "minecraft:glass", "count": 3, "x": 25, "y": 52 },
    { "id": "redstone", "item": "minecraft:redstone", "count": 4, "x": 42, "y": 30 },
    { "id": "quartz", "item": "minecraft:quartz", "count": 2, "x": 55, "y": 42 },
    { "id": "note", "item": "minecraft:paper", "count": 1, "nbt": "{\"recipe_linkage_note\":\"optics\"}", "x": 32, "y": 80 },
    { "id": "spyglass", "item": "minecraft:spyglass", "count": 1, "x": 60, "y": 72 },
    { "id": "daylight_detector", "item": "minecraft:daylight_detector", "count": 1, "x": 76, "y": 56 },
    { "id": "comparator", "item": "minecraft:comparator", "count": 1, "x": 94, "y": 50 }
  ],
  "edges": [
    { "from": "sand", "to": "glass", "chance": 1.0 },
    { "from": "glass", "to": "redstone", "chance": 0.85 },
    { "from": "redstone", "to": "quartz", "chance": 0.9 },
    { "from": "quartz", "to": "comparator", "chance": 0.8 },
    { "from": "glass", "to": "note", "chance": 0.65 },
    { "from": "note", "to": "spyglass", "chance": 0.75 },
    { "from": "copper", "to": "spyglass", "chance": 0.9 },
    { "from": "spyglass", "to": "daylight_detector", "chance": 0.8 },
    { "from": "daylight_detector", "to": "comparator", "chance": 0.7 },
    { "from": "redstone", "to": "daylight_detector", "chance": 0.55 }
  ]
}

在资源包或 KubeJS assets 中添加标题翻译,例如 assets/modpack/lang/en_us.json:

{
  "research.modpack.redstone_lens": "Redstone Lens"
}

有关完整参考,请参阅随附的数据包格式文档和原版示例数据包。

imageimage