修正readme

This commit is contained in:
1820982382
2026-08-08 03:14:17 +08:00
parent 0c72822f40
commit 2c1aabe78a
3 changed files with 21 additions and 14 deletions
+9 -5
View File
@@ -1,5 +1,7 @@
# TC KubeJS Bridge (tckubejsbridge) # TC KubeJS Bridge (tckubejsbridge)
> **中文** | [English](README_EN.md)
将 **神秘时代4(Thaumcraft 4 移植版)** 的配方系统桥接到 **KubeJS**,让整合包作者/服务器管理员 将 **神秘时代4(Thaumcraft 4 移植版)** 的配方系统桥接到 **KubeJS**,让整合包作者/服务器管理员
可以在 KubeJS 脚本中直接注册 TC 的注魔、炼金、奥术合成配方以及物品固有要素,并支持**替换原有配方**。 可以在 KubeJS 脚本中直接注册 TC 的注魔、炼金、奥术合成配方以及物品固有要素,并支持**替换原有配方**。
@@ -38,7 +40,7 @@ gradle :tckubejsbridge:build
## 脚本用法 ## 脚本用法
将脚本放入 `kubejs/server_scripts/`,**重启游戏生效**(见"注意事项"第 1 条)。 将脚本放入 `kubejs/server_scripts/`,然后**重启游戏或执行 `/reload` 生效**(见"注意事项"第 1 条)。
### 1. 注魔配方 ### 1. 注魔配方
@@ -153,10 +155,12 @@ ServerEvents.recipes(event => {
## 注意事项 ## 注意事项
1. **改脚本后必须重启**,`/reload` 不生效: 1. **支持热重载**:改脚本后执行 `/reload` 即可生效,无需重启游戏。
- TC 配方在 `ThaumcraftApi.getCraftingRecipes()` 内存列表,KubeJS `/reload` 不清空它 - KubeJS 每次 `/reload` 都会重新执行 `ServerEvents.recipes`,脚本会再次运行。
- 本 mod 的去重集合(按 research 键)也不随 `/reload` 清空 - 若脚本使用"先删后注册"(`thaumcraft.removeInfusion(...)` 再 `infusion(...)`)写法,
- 若将来需要 `/reload` 支持,可在脚本中调用 `thaumcraft.clearRegistered()` 清空去重集合 删除步骤会清掉本 mod 的去重键并移除 TC 内存列表中的旧配方,因此新配方能正确重新注册。
- 纯新增(不先删)的脚本重复 `/reload` 会被去重拦截(`skipping`),请配合
`thaumcraft.clearRegistered()` 使用或在脚本开头调用它。
2. **research 键全局唯一**:重复键会被跳过(防止重复注册)。如需同名配方,请改键。 2. **research 键全局唯一**:重复键会被跳过(防止重复注册)。如需同名配方,请改键。
3. **配方不进原版 RecipeManager**:TC 注魔/炼金/奥术配方是 TC 自己的内存列表。 3. **配方不进原版 RecipeManager**:TC 注魔/炼金/奥术配方是 TC 自己的内存列表。
本桥接在脚本执行时直接调用 TC API 注册,并对 KubeJS 输出无害占位配方, 本桥接在脚本执行时直接调用 TC API 注册,并对 KubeJS 输出无害占位配方,
+10 -7
View File
@@ -1,5 +1,7 @@
# TC KubeJS Bridge (tckubejsbridge) # TC KubeJS Bridge (tckubejsbridge)
> **English** | [中文](README.md)
Bridges the **Thaumcraft 4 (port)** recipe system to **KubeJS**, allowing modpack authors and Bridges the **Thaumcraft 4 (port)** recipe system to **KubeJS**, allowing modpack authors and
server admins to register TC infusion, crucible, arcane crafting recipes and item aspect tags server admins to register TC infusion, crucible, arcane crafting recipes and item aspect tags
directly from KubeJS scripts — including **replacing existing recipes**. directly from KubeJS scripts — including **replacing existing recipes**.
@@ -39,7 +41,7 @@ Compile dependencies (local jars, paths editable in `build.gradle`):
## Script Usage ## Script Usage
Put scripts into `kubejs/server_scripts/` and **restart the game** (see Note #1). Put scripts into `kubejs/server_scripts/`, then **restart the game or run `/reload`** (see Note #1).
### 1. Infusion Recipe ### 1. Infusion Recipe
@@ -154,12 +156,13 @@ ServerEvents.recipes(event => {
## Notes ## Notes
1. **Restart after editing scripts — `/reload` does NOT work**: 1. **Hot-reload supported**: after editing scripts, run `/reload` — no game restart needed.
- TC recipes live in the `ThaumcraftApi.getCraftingRecipes()` in-memory list, which KubeJS - KubeJS re-runs `ServerEvents.recipes` on every `/reload`, so scripts execute again.
`/reload` never clears. - With the "remove-then-register" pattern (`thaumcraft.removeInfusion(...)` followed by
- This mod's dedup set (keyed by research) is also not cleared on `/reload`. `infusion(...)`), the removal step clears this mod's dedup key and drops the old recipe
- If you need `/reload` support later, call `thaumcraft.clearRegistered()` in the script from TC's in-memory list, so the new recipe registers correctly.
to reset the dedup set. - Scripts that only add recipes (without removing first) will be dedup-skipped on repeated
`/reload`; call `thaumcraft.clearRegistered()` at the top of the script to reset the set.
2. **Research keys are globally unique**: duplicate keys are skipped (prevents double 2. **Research keys are globally unique**: duplicate keys are skipped (prevents double
registration). Use a different key for same-name recipes. registration). Use a different key for same-name recipes.
3. **Recipes do NOT go into the vanilla RecipeManager**: TC infusion/crucible/arcane recipes 3. **Recipes do NOT go into the vanilla RecipeManager**: TC infusion/crucible/arcane recipes
+2 -2
View File
@@ -1,6 +1,6 @@
// ============================================================ // ============================================================
// TC KubeJS Bridge — 示例脚本 // TC KubeJS Bridge — 示例脚本
// 放置到 kubejs/server_scripts/ 目录后【重启游戏】生效(/reload 不生效) // 放置到 kubejs/server_scripts/ 目录后【重启游戏或 /reload】生效
// //
// 依赖:thaumcraft(TC4 移植版)、kubejs、tckubejsbridge // 依赖:thaumcraft(TC4 移植版)、kubejs、tckubejsbridge
// ============================================================ // ============================================================
@@ -90,4 +90,4 @@ ServerEvents.recipes(event => {
// - 要素 tag 用 TC4 移植版的拉丁文原名(aer/ignis/aqua/terra/ordo/perditio/vacuos/lux/motus/potentia/auram 等), // - 要素 tag 用 TC4 移植版的拉丁文原名(aer/ignis/aqua/terra/ordo/perditio/vacuos/lux/motus/potentia/auram 等),
// 完整表见 README // 完整表见 README
// - 物品 id 支持 AE2 命名空间 ae2:xxx(如 ae2:interface) // - 物品 id 支持 AE2 命名空间 ae2:xxx(如 ae2:interface)
// - 改脚本后必须重启游戏,/reload 不生效(TC 配方在内存列表) // - 支持热重载:改脚本后 /reload 即可生效("先删后注册"写法会自动清掉去重键并移除旧配方)