Skip to content

Commit 21c5603

Browse files
Ch4oooooooLLclaude
andcommitted
release: v1.7 recipe browser
- add recipe browser item with pool -> rule group -> recipe navigation - add preview/filter generation and a dedicated browser storage channel - add delivery to GT pattern input hatches and AE2 interfaces - bump GTNH compile dependencies to 290Beta3 Co-Authored-By: Claude Code <noreply@anthropic.com>
1 parent f65ede6 commit 21c5603

35 files changed

Lines changed: 5186 additions & 152 deletions

‎README.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ AE2 Pattern Generator 是一个专为 Minecraft 1.7.10 (如 GregTech New Horizon
3232
### 7. 支持无线绑定和远程取材
3333
支持与 AE2 网络无线绑定。完成绑定后,可在生成时直接使用网络内空白样板,减少手动物料搬运。
3434

35+
### 8. 新增"配方浏览器":按规则浏览缓存配方,按需批量生成
36+
右键"配方浏览器"物品,按 `配方池(配方表) -> 规则组 -> 配方明细` 三层浏览:
37+
38+
- **规则组**:同一配方池内按 `(编程电路, NC 不消耗物品)` 归类,同组内所有配方的编程电路与 NC 物品完全一致;
39+
- **默认排序**:规则组按配方数量降序,数量相同时按电路编号升序;
40+
- **默认折叠**:只有 1 条配方的规则组、以及"无电路且无 NC"的通用配方默认不展示,界面底部提供开关展开,顶部会注明折叠了多少条;
41+
- **一键生成**:可生成某个规则组的全部样板,也可展开后只生成其中某一条;样板内容与原有过滤流程完全一致,统一走"扣除空白样板 -> 写入虚拟仓储 -> 手动导出"。
42+
- **预览与过滤(第三层)**:点规则组的"生成整组"会先进入预览页,可预览该组的输入/输出物品清单,并用与样板生成器**同一套显式语法**(`[id]` / `(矿辞)` / `{名字}`)继续过滤,确认命中数量后再生成。
43+
- **浏览器仓储**:配方浏览器生成的样板写入**独立通道**(默认通道留给样板生成器),两边的仓储互不阻塞;蹲下右键空气可查看、删除或清空。
44+
- **投递到样板输入总成**:右键 GT 样板输入总成/总线(GT5U `MTEHatchCraftingInputME`、GTNL 超级总成)或 AE2 面板接口即可投递,并同时:
45+
1. 把目标重命名为 `<池名>_<电路>_NC_<NC物品…>`(名称后缀与规则一一对应);
46+
2. 把该规则的编程电路写进目标电路槽(规则不要求电路时清空电路槽);
47+
3. 把该规则的 NC(不消耗)物品加入 NEI 书签,方便拖进总成手动槽。
48+
样板槽范围严格取 `[0, 电路槽)`,不会污染电路槽/手动槽/内部槽。
49+
3550
---
3651

3752
## 📌 主要更新内容
@@ -40,6 +55,7 @@ AE2 Pattern Generator 是一个专为 Minecraft 1.7.10 (如 GregTech New Horizon
4055
2. `Preview Count` 与 `Generate` 统一改为基于服务端缓存执行,避免每次请求都重新扫描大型配方表。
4156
3. Forge 配置文件生成时改为中英文双语注释,便于整合包、服务端和玩家共同维护。
4257
4. 缓存构建会返回进度与统计信息,便于确认当前缓存是否可用以及定位问题。
58+
5. 新增“配方浏览器”,可按 `配方池 -> 规则组 -> 配方明细` 浏览缓存配方、预览过滤并批量生成,并支持直接投递到样板输入总成/总线。
4359

4460
---
4561

@@ -57,6 +73,9 @@ AE2 Pattern Generator 是一个专为 Minecraft 1.7.10 (如 GregTech New Horizon
5773
| **右键**(对空气) | 打开**主配置终端** — 填写设备 ID、正则过滤规则、指定电压等并提交生成请求。 |
5874
| **Shift + 右键**(对空气) | 打开**存储管理器** — 翻阅并管理当前存储在虚拟节点的样板数据。 |
5975
| **Shift + 右键**(对方块) | **方块检测 / 条件导出** — 优先检测目标方块(含 GT 主方块配方信息);若目标为可写入容器,则将虚拟样板批量导出到该容器。 |
76+
| **右键**(配方浏览器物品) | 打开**配方浏览器** — 先选配方池,再选该池下的规则组,最后统一生成或单条生成样板。 |
77+
| **蹲下 + 右键**(空气,配方浏览器物品) | 打开**浏览器仓储** — 查看/删除/清空由配方浏览器生成的样板(与样板生成器的仓储按来源分开)。 |
78+
| **右键**(样板输入总成/总线,配方浏览器物品) | **投递** — 把浏览器仓储里的样板写进 GT 样板输入总成/总线(或 AE2 面板接口),同时重命名目标、写入编程电路,并把该规则的 NC 物品加入 NEI 书签。 |
6079

6180
此外,玩家可将光标悬停在物品上按下 `Shift` 键调出操作提示。系统同样提供用于控制台执行或 OP 自动化触发的命令节点:`/patterngen`。
6281

@@ -185,6 +204,18 @@ AE2 Pattern Generator 是一个专为 Minecraft 1.7.10 (如 GregTech New Horizon
185204

186205
## 📜 更新日志
187206

207+
### v1.7 (2026-10-23)
208+
- **新增**: 新增"配方浏览器"物品:按 `配方池 -> 规则组 -> 配方明细` 三层浏览缓存配方,规则组由 `(编程电路, NC 不消耗物品)` 唯一确定。
209+
- **新增**: 规则组默认按配方数量降序;只有 1 条配方的规则组与"无电路无 NC"的通用配方默认折叠,可在界面内展开查看。
210+
- **新增**: 三级"预览与过滤"页:展示规则的输入/输出清单,支持与样板生成器同语法的 5 个过滤字段 + 电压档位,按过滤结果生成样板。
211+
- **新增**: 浏览器仓储(按来源分通道,与样板生成器互不阻塞),可查看/删除/清空。
212+
- **新增**: 右键投递到样板输入总成/总线或 AE2 面板接口,投递时重命名目标(`<池名>_<电路>_NC_...`)、写入编程电路、把 NC 物品加入 NEI 书签。
213+
- **说明**: 本次改动只新增浏览、过滤与投递入口,样板编码内容与原过滤流程完全一致;配方浏览数据由服务端配方缓存派生,缓存重建后自动失效重算。
214+
215+
### v1.6 (2026-09-19)
216+
- **适配**: 适配 GTNH 整合包 290Beta3,全部编译依赖升级至 290Beta3 对应版本(GT5-Unofficial 5.09.54.133、AE2-Unofficial rv3-beta-1050-GTNH、NEI 2.8.130-GTNH、AE2FluidCraft-Rework 1.5.106-gtnh、GTNHLib 0.11.46、ModularUI2 2.3.88、ModularUI 1.3.4)。
217+
- **说明**: 已按 290Beta3 源码逐项核对所用 API,无破坏性变更;配方缓存因环境指纹含模组版本,升级后首次构建自动重建,无需手动清理。
218+
188219
### v1.5 (2026-03-14)
189220
- **新增**: 引入新的持久化配方缓存方式,主界面新增 `Cache` / `构建缓存` 工作流。
190221
- **优化**: `Preview Count` 与 `Generate` 统一改为读取服务端缓存,首次使用、重启后或模组 / 配置变化后需先构建或刷新缓存。

‎dependencies.gradle‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
dependencies {
2-
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.482:dev") {
2+
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.54.133:dev") {
33
transitive = false
44
}
5-
compileOnly("com.github.GTNewHorizons:GTNHLib:0.7.10:dev") {
5+
compileOnly("com.github.GTNewHorizons:GTNHLib:0.11.46:dev") {
66
transitive = false
77
}
8-
compileOnly("com.github.GTNewHorizons:ModularUI2:2.2.20-1.7.10:dev") {
8+
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.88-1.7.10:dev") {
99
transitive = false
1010
}
11-
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-690-GTNH:dev") {
11+
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-1050-GTNH:dev") {
1212
transitive = false
1313
}
14-
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.44-GTNH:dev") {
14+
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev") {
1515
transitive = false
1616
}
17-
compileOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.3.46-gtnh:dev") {
17+
compileOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.5.106-gtnh:dev") {
1818
transitive = false
1919
}
20-
compileOnly("com.github.GTNewHorizons:ModularUI:1.3.1") {
20+
compileOnly("com.github.GTNewHorizons:ModularUI:1.3.4") {
2121
transitive = false
2222
}
23-
testImplementation("com.github.GTNewHorizons:ModularUI:1.3.1") {
23+
testImplementation("com.github.GTNewHorizons:ModularUI:1.3.4") {
2424
transitive = false
2525
}
2626
testImplementation("junit:junit:4.13.2")

‎docs/releases/v1.7.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# v1.7
2+
3+
## 更新摘要
4+
5+
- 新增“配方浏览器”物品:右键打开后按 `配方池(配方表) -> 规则组 -> 配方明细` 三层浏览服务端配方缓存。
6+
- 规则组按 `(编程电路, NC 不消耗物品)` 唯一确定,组内所有配方的编程电路与 NC 物品完全一致;规则组默认按配方数量降序,数量相同时按电路编号升序。
7+
- 只有 1 条配方的规则组与“无电路且无 NC”的通用配方默认折叠,界面底部提供开关展开,顶部会注明折叠数量。
8+
- 每组支持一键生成全部样板,也可展开后单条生成;第三层“预览与过滤”页展示输入/输出清单,并支持与样板生成器相同的 5 个显式过滤字段(`[id]` / `(矿辞)` / `{名字}`)与电压档位。
9+
- 新增按来源分通道的浏览器仓储:配方浏览器生成的样板写入独立通道,与样板生成器的默认通道互不阻塞;蹲下右键空气可查看、删除或清空。
10+
- 新增投递功能:右键 GT 样板输入总成/总线(GT5U `MTEHatchCraftingInputME`、GTNL 超级总成)或 AE2 面板接口即可投递,并同时:
11+
- 将目标重命名为 `<池名>_<电路>_NC_<NC物品…>`;
12+
- 把该规则的编程电路写入目标电路槽(规则不要求电路时清空电路槽);
13+
- 把该规则的 NC 物品加入 NEI 书签,便于拖入总成手动槽。
14+
- 样板槽范围严格取 `[0, 电路槽)`,不会污染电路槽、手动槽与内部槽。
15+
- 配方浏览与规则分组数据均由服务端配方缓存派生,缓存重建或清空后会自动失效重算,无需手动清理。
16+
- 同时包含 GTNH 290Beta3 依赖适配:GT5-Unofficial `5.09.54.133`、AE2-Unofficial `rv3-beta-1050-GTNH`、NEI `2.8.130-GTNH`、AE2FluidCraft-Rework `1.5.106-gtnh`、GTNHLib `0.11.46`、ModularUI2 `2.3.88`、ModularUI `1.3.4`。
17+
- 如果你发现任何 bug,请到 GitHub Issues 提交反馈。

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
gtnh.settings.blowdryerTag = 0.2.2
2-
modVersion = 1.5
2+
modVersion = 1.7
33

44
modName = AE2PatternGen
55
modId = ae2patterngen
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package com.github.ae2patterngen.delivery;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
import java.util.UUID;
6+
7+
import net.minecraft.item.ItemStack;
8+
9+
import com.github.ae2patterngen.recipe.RuleGroup;
10+
11+
/**
12+
* 玩家最近一次在配方浏览器里"生成某个规则组"的上下文。
13+
* <p>
14+
* 投递时必须知道这批样板属于哪条规则(哪个池、哪些编程电路、哪些 NC 物品)才能给样板输入总成
15+
* 命名与写电路槽,而这些信息在样板本身里是查不到的(样板按设计不写电路/NC)。
16+
*/
17+
public final class HatchBindingRegistry {
18+
19+
/** 一次待投递的规则绑定。 */
20+
public static final class Binding {
21+
22+
public final String mapId;
23+
public final int[] circuitDamages;
24+
public final ItemStack[] ncItems;
25+
public final int patternCount;
26+
public final long createdAt;
27+
28+
Binding(String mapId, int[] circuitDamages, ItemStack[] ncItems, int patternCount) {
29+
this.mapId = mapId != null ? mapId : "";
30+
this.circuitDamages = circuitDamages != null ? circuitDamages : new int[0];
31+
this.ncItems = ncItems != null ? ncItems : new ItemStack[0];
32+
this.patternCount = Math.max(0, patternCount);
33+
this.createdAt = System.currentTimeMillis();
34+
}
35+
36+
public boolean hasCircuit() {
37+
return circuitDamages.length > 0;
38+
}
39+
40+
/** 主电路号(多电路配方取最小号),无电路时返回 -1。 */
41+
public int primaryCircuit() {
42+
return circuitDamages.length > 0 ? circuitDamages[0] : -1;
43+
}
44+
}
45+
46+
private static final Map<UUID, Binding> BINDINGS = new HashMap<UUID, Binding>();
47+
48+
private HatchBindingRegistry() {}
49+
50+
public static void remember(UUID player, String mapId, RuleGroup group) {
51+
if (player == null || group == null) {
52+
return;
53+
}
54+
synchronized (BINDINGS) {
55+
BINDINGS.put(player, new Binding(mapId, group.circuitDamages, group.ncItems, group.size()));
56+
}
57+
}
58+
59+
public static Binding get(UUID player) {
60+
if (player == null) {
61+
return null;
62+
}
63+
synchronized (BINDINGS) {
64+
return BINDINGS.get(player);
65+
}
66+
}
67+
68+
public static void clear(UUID player) {
69+
if (player == null) {
70+
return;
71+
}
72+
synchronized (BINDINGS) {
73+
BINDINGS.remove(player);
74+
}
75+
}
76+
77+
static void resetForTest() {
78+
synchronized (BINDINGS) {
79+
BINDINGS.clear();
80+
}
81+
}
82+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package com.github.ae2patterngen.delivery;
2+
3+
import java.util.List;
4+
5+
/**
6+
* 样板输入总成/接口的自定义名格式化。
7+
* <p>
8+
* 名称格式与"参考实现"的搜索关键词同源:{@code <基础名>_<电路>[_NC_<NC物品...>]},
9+
* 例如 {@code 卷板机_电路1_NC_模具A+模具B}。基础名、电路 token 与 NC 前缀都由调用方传入
10+
* (便于本地化与单元测试),本类只负责拼接、去空与长度收口。
11+
*/
12+
public final class HatchNameFormatter {
13+
14+
/** GT/AE2 的名称显示长度有限,超长只会被截断,这里主动收口避免半个词。 */
15+
public static final int MAX_NAME_LENGTH = 64;
16+
17+
/** NC 物品名最多列举几个,其余折成"等 N 种"。 */
18+
public static final int MAX_NC_NAMES = 3;
19+
20+
private HatchNameFormatter() {}
21+
22+
/**
23+
* @param baseName 基础名(通常是配方池/机器显示名)
24+
* @param circuitToken 电路 token(如 {@code 电路1} 或 {@code 无电路}),可为空
25+
* @param ncNames NC(不消耗)物品显示名,可为空
26+
*/
27+
public static String format(String baseName, String circuitToken, List<String> ncNames) {
28+
StringBuilder builder = new StringBuilder(safe(baseName));
29+
String circuit = safe(circuitToken);
30+
if (!circuit.isEmpty()) {
31+
appendToken(builder, circuit);
32+
}
33+
String nc = ncToken(ncNames);
34+
if (!nc.isEmpty()) {
35+
appendToken(builder, nc);
36+
}
37+
if (builder.length() == 0) {
38+
return "";
39+
}
40+
return builder.length() <= MAX_NAME_LENGTH ? builder.toString() : builder.substring(0, MAX_NAME_LENGTH);
41+
}
42+
43+
/** NC token,例如 {@code NC_模具A+模具B};没有 NC 时返回空串。 */
44+
static String ncToken(List<String> ncNames) {
45+
if (ncNames == null || ncNames.isEmpty()) {
46+
return "";
47+
}
48+
49+
StringBuilder builder = new StringBuilder("NC_");
50+
int shown = 0;
51+
for (String name : ncNames) {
52+
String safeName = safe(name);
53+
if (safeName.isEmpty()) {
54+
continue;
55+
}
56+
if (shown >= MAX_NC_NAMES) {
57+
builder.append("+")
58+
.append(ncNames.size() - shown)
59+
.append("more");
60+
break;
61+
}
62+
if (shown > 0) {
63+
builder.append('+');
64+
}
65+
builder.append(safeName);
66+
shown++;
67+
}
68+
return builder.length() <= 3 ? "" : builder.toString();
69+
}
70+
71+
private static void appendToken(StringBuilder builder, String token) {
72+
if (builder.length() > 0) {
73+
builder.append('_');
74+
}
75+
builder.append(token);
76+
}
77+
78+
private static String safe(String value) {
79+
return value != null ? value.trim() : "";
80+
}
81+
}

0 commit comments

Comments
 (0)