promotional bannermobile promotional banner

occ

One click on a JEI bookmark: OCC plans the entire recipe tree from your actual inventory, shows exactly what is missing, then crafts it all.

OCC — One-Click Crafting / 一键递归合成

EN: One click on a JEI bookmark: OCC plans the entire recipe tree from your actual inventory, shows exactly what is missing, then crafts it all.

中: 点一下 JEI 收藏物品:OCC 按你背包里的实际材料把整棵配方树算完、把缺什么列清楚,然后一次性合完。


1. Summary / 简介

EN — One-click recursive crafting driven by your real inventory: plan the whole recipe tree, preview it as an expandable tree, get an exact list of missing materials, then craft the final item in a single action. For Minecraft Forge 1.20.1, integrates with JEI bookmarks, and handles GregTech CEu's manual crafting recipes (hammers, wire cutters, plates, circuits) correctly.

中 — 以真实背包为准的一键递归合成:先把整棵配方树推演完,用可展开的树界面预览,给出精确的 缺料清单,最后一次动作把成品合出来。适用于 Minecraft Forge 1.20.1,对接 JEI 收藏栏,并且正确 处理 GTCEu 这类"手工配方"(锤子、剪线钳、板材、电路)。


2. The problem / 解决什么问题

EN — Deep crafting chains are tedious. Want a chest from logs, or a GTCEu circuit from ingots? You have to work out which intermediates you need, in what order, how many of each, and repeat the same 3×3 recipe dozens of times — while guessing whether you really have the materials.

中 — 深配方链很折磨人。想用原木做箱子、用锭做 GTCEu 电路?你得自己算需要哪些中间产物、 先后顺序、各要几个,然后把同一个 3×3 配方重复几十遍,还要边做边猜材料够不够。

EN — OCC turns that into one click: it reads the item you bookmarked in JEI, computes the whole production chain against your current inventory, and crafts the intermediate steps for you in the correct order.

中 — OCC 把它变成一次点击:读取你在 JEI 收藏的物品,按当前背包算出整条生产链,并按正确 顺序替你完成所有中间合成。


3. What it does / 功能

EN 中文
One-click recursive crafting. Bookmark an item in JEI, click it in your inventory/crafting screen, and OCC builds and executes the whole dependency chain. 一键递归合成。 在 JEI 收藏物品,于背包/工作台界面点它,OCC 自动构建并执行整条依赖链。
Plan first, execute second. Nothing is consumed until a complete, feasible plan exists; the planner works on a virtual copy of your inventory. 先规划、后执行。 没有完整可行的计划就绝不动背包;规划在虚拟库存上进行。
Crafts as many as materials allow. The maximize action binary-searches the largest producible amount and crafts all of it in one request. 按材料合满。 最大化动作通过二分推出当前材料能做出的最大数量,一次请求全部合成。
Preview the tree before crafting. A read-only screen shows every step: from stock, to be crafted, required tool, genuinely missing. 先看树再动手。 只读界面展示每一步:来自库存、需要合成、所需工具、真正缺失。
Exact missing-material report. Tells you how much you still need, per item, computed by iterative re-planning. 精确缺料清单。 逐个物品告诉你还差多少,数字来自迭代重算,而不是某条支线的碎片。
Cost-aware route selection. Picks the recipe that draws least from your current bag, not merely the lowest static cost. 按背包省料选路。 选对当前背包消耗最少的配方,而不只是静态成本最低的那条。
Real recipe semantics. Every craft runs a real TransientCraftingContainer with vanilla assemble() + getRemainingItems(). 真实配方语义。 每次点火都在真实合成网格上执行原版 assemble() + getRemainingItems()。
Tool awareness. Hammers, saws, wire cutters and files are durability-limited catalysts; tracked by remaining uses and reported as tools, not as random materials. 工具感知。 锤子、锯、剪线钳、锉刀按"剩余可用次数"管理,缺失时单独报"缺工具",不会甩锅给某个材料。
Safe failure. If execution breaks mid-way, the inventory is rolled back to its pre-request snapshot. 失败可回滚。 执行中途异常时按请求开始时的快照整包退回。
Server-authoritative. The client only sends item + mode; all planning and consumption happen server-side. 服务端权威。 客户端只发"物品 + 模式",规划与扣料全在服务端,单人/联机一致且无法靠改客户端作弊。

4. How it works / 工作原理

  1. EN — Recipe index. On first use, every crafting-table recipe is indexed by output item and rebuilt when the recipe manager reloads (/reload). 中 — 配方索引。 首次使用时把全部工作台配方按产物建索引,/reload 后自动重建。

  2. EN — Virtual inventory. Your 36 main slots are copied into counters; tool durability is converted into available uses. 中 — 虚拟库存。 把主背包 36 格的计数拷出来;工具耐久折算成可用次数。

  3. EN — Backtracking planner. From the target recipe, consume stock, then satisfy the rest from candidate recipes; every branch can be rolled back, so dead ends move on to the next recipe. 中 — 回溯规划。 从目标配方出发先吃现货,再对缺口挑候选配方继续展开;每条分支都能回滚, 走不通就换下一条。

  4. EN — Plan scoring. All root recipes are really planned and compared: fewest net materials consumed → most surplus → preferred mod → fewest crafts. 中 — 计划打分。 所有根配方都真算一遍再比:净消耗最少 → 余料最多 → 命中优先 mod → 点火次数最少。

  5. EN — Execution. The chosen plan is a flat list of single crafts in dependency order, each fired for real on the server, consuming across stacks and returning leftovers. 中 — 执行。 选中的计划是一条按依赖排序的点火序列,逐次在服务端真实执行,跨堆扣料、 余留物按原版返还。

  6. EN — Diagnostics. If no plan exists, OCC re-plans up to 12 times, filling the reported gaps into a virtual bag until a plan becomes feasible; the accumulated additions are the real shortfall. 中 — 失败诊断。 无可行计划时最多重算 12 轮,每轮把缺口补进虚拟背包,直到能算出可行解; 累计补进去的量就是真实缺口。


5. Controls / 操作方式

Both trigger methods work only while the pointer is over a JEI bookmark in the player inventory or a crafting table screen. 两种方式都只在鼠标指向 JEI 收藏物品(背包/工作台界面)时生效。

Mouse + modifiers / 鼠标组合键(开箱即用)

Input / 输入 EN action 中文动作
Ctrl + Left Click Open the crafting tree preview (read-only) 打开合成树预览(只读)
Ctrl + Shift + Left Click Craft one more 递归合成 1 个(在现有数量上再加 1 个)
Ctrl + Shift + Right Click Craft as many as materials allow 按材料最大化合完

Key binds / 按键绑定

Registered under Options → Controls → Key Binds → OCC One-Click Crafting;位于 「选项 → 控制 → 按键绑定 → OCC 一键递归合成」。

Entry / 条目 Default / 默认 Action / 作用
Open Crafting Tree / 打开合成树 Not Bound 未指定 Tree preview 打开合成树
Craft One / 递归合成 1 个 Not Bound 未指定 Craft one more 再合一个
Craft Max / 按材料最大化 Not Bound 未指定 Craft as many as possible 合满

Defaults are unbound on purpose, so OCC never steals keys from other mods; press a row then a key to assign, Reset returns it to "Not Bound". 默认不占键位,避免与其他模组撞键;点某行再按键即可绑定,「重置」回到未指定。


6. The crafting tree screen / 合成树界面

EN 中文
Indentation is dependency depth; identical ingredient slots are merged into one line (Oak Planks ×8 above Oak Log ×2). 缩进代表依赖层级;同一种配料槽合并成一行("橡木木板 ×8"下面是"橡木原木 ×2")。
▼ / ▶ arrows expand and collapse branches; only the first level is open by default. ▼ / ▶ 箭头展开/收起分支;默认只展开第一层。
Right-hand scrollbar: drag the thumb or click the track; mouse wheel also works. 右侧滚动条:拖 thumb 或点轨道跳转;滚轮同样可滚。
Colors: green = from inventory, yellow = to craft, aqua = tool, red = blocked. 颜色:绿=库存、黄=需合成、青=工具、红=缺料。
Hovering shows the chosen recipe id plus the vanilla item tooltip. 悬停显示选中的配方 id 和物品原版提示。
Trees are capped at 800 nodes, with a truncation note in the header. 单棵树最多 800 个节点,超限时标题栏会标注已截断。
Read-only: it only reads counts, never moves items. 纯只读:只读计数,不动任何物品。

7. Missing-material reports / 缺料清单

Reported in chat, one item per line, no hover required. 聊天栏一次性分行列出,不需要悬停。

代码块
 
[OCC] 缺少 4 种材料(按 还差/需/现有 列出):
  · 工具·铁锤      还差 1(需 1,现有 0)   gtceu:iron_hammer
  · 铜锭          还差 8(需 30,现有 22)  minecraft:copper_ingot
  · 粘性树脂        还差 2(需 4,现有 2)    gtceu:sticky_resin
  · 钻石          还差 3(需 3,现有 0)    minecraft:diamond
EN 中文
Order: tools → raw/uncraftable materials → craftable intermediates. 排序:工具 → 无配方外部原料 → 可合成中间产物。
Each line carries the item id, so same-named items from different mods are unambiguous. 每行带物品 ID,同名不同 ID 一眼分辨。
Colors: aqua = tool, red = external material, yellow = craftable intermediate. 颜色:青=工具、红=外部原料、黄=可合成中间产物。
Numbers come from iterative re-planning, so "short 8" really unblocks the plan. 数字来自迭代重算,"还差 8"就是补齐后能算出可行解。
Lists over 60 entries are additionally written to logs/latest.log. 超过 60 种时额外写一份全量到 logs/latest.log。
Only the triggering player receives the report. 只发给触发合成的玩家本人。

Note / 备注:in-game message text is currently Chinese; an English localization pass is planned. 目前游戏内提示文本为中文,后续会做多语言化(见第 11 节)。


8. Configuration / 配置(config/occ-common.toml)

Option 选项 Default 默认 EN 中文
preferredRecipeModIds [] Tie-breaker: prefer recipes from these mod ids when consumption ties. 消耗打平时优先这些 mod 的配方。
maxRecipeOps 65536 Planning node budget per request. 单次规划的节点访问预算。
maxRecipeDepth 32 Maximum recipe nesting depth. 配方嵌套深度上限。
maxCraftTarget 1024 Upper bound for "craft max" (64–32768). 最大化合成的目标数量上限(64–32768)。
debugLog false Log plans and diagnostics to logs/latest.log. 把规划结果与诊断写进日志。

9. Compatibility / 兼容性

Item 项目 EN 中文
Minecraft 1.20.1 1.20.1
Loader Forge 47.4+ (built against 47.4.28) Forge 47.4+(基于 47.4.28 构建)
JEI Optional, required for bookmarks; built/tested with 15.20.0.115 可选,但收藏交互需要它;基于 15.20.0.115 测试
Tested with GregTech CEu Modern 7.5.3 GregTech CEu Modern 7.5.3
Sides Server-driven; both sides need OCC, protocol 3 服务端驱动;双端都需装 OCC,协议版本 3
Unaffected by Resource packs, shaders 资源包、光影

10. Known limitations / 已知限制

EN 中文
Crafting-table recipes only; furnace/machine recipes are out of scope and reported as external materials. 只处理工作台配方;熔炉/机器配方不在范围内,会作为"外部原料"列出。
Dynamic/special recipes are skipped (fireworks, banner copying, isSpecial). 跳过动态/特殊配方(烟花、旗帜复制等 isSpecial)。
Main inventory only (36 slots incl. hotbar); offhand and backpacks are not scanned. 只扫描主背包 36 格(含快捷栏);副手与背包类容器不扫描。
Item-type matching, not NBT: two picks count as the same tool; the least damaged one is used. 按物品类型匹配而非 NBT:两把镐算同一种工具,优先用耐久最多的。
Greedy planner with root comparison, not a global integer-programming optimum. 贪心规划 + 根节点全量比账,不是全局整数规划最优。
One request targets at most maxCraftTarget items (default 1024). 单次请求最多合成 maxCraftTarget 个(默认 1024)。

occ Team

profile avatar
  • 1
    Followers
  • 2
    Projects
  • 217
    Downloads

More from Qldw_Lcc