DiagramGroupInfo
基本信息
api.diagram.DiagramGroupInfo —— AutoValue 不可变值对象,描述一个图表组的元数据。
Registry / NeiIntegration / 配置写入都读它。
字段与工厂默认值
builder(groupName, groupId, icon, diagramsPerPage) 的全部默认值
(DiagramGroupInfo.java:74-79):
| 字段 | 默认值 |
|---|---|
ignoreNbt |
true |
allowOverflowX |
false |
allowOverflowY |
false |
width |
166 |
emptyDiagramPredicate |
diagram -> false(永不判空) |
defaultVisibility |
DiagramGroupVisibility.ALWAYS_SHOWN |
description |
""(空串) |
这些默认是「未调用 setter」的实际取值,不是猜测 —— 把
setIgnoreNbt(false)数成调用点即可得到覆盖清单: 仅 nbt-viewer、debug-ruler、materialtools 三组覆盖ignoreNbt。
与 NEI 的桥接
buildHandlerInfo(HandlerInfo.Builder)(第 69 行)把本对象映射到 NEI:
builder.setDisplayStack(icon().stack())
.setAllowOverflowX(allowOverflowX())
.setAllowOverflowY(allowOverflowY())
.setWidth(width())
.setMultipleWidgetsAllowed(diagramsPerPage() > 1);
即:每页图数 > 1 时自动开启 NEI 的多控件模式。
空图判定的三种实际取值
| 写法 | 语义 |
|---|---|
默认 diagram -> false |
永不判空 —— 用于确实可能只有 1 个组件的组 |
DiagramUtil.buildEmptyDiagramPredicate(2) |
插入组件 < 2 即为空 —— materialparts、materialtools、oreprefixes、oreprocessing |
| 自定义谓词 | 由 CustomDiagramMatcher 等按需提供 |
buildEmptyDiagramPredicate(int) 实现即
diagram -> diagram.slotInsertions().size() < minInsertedComponents。
相关条目
源码
src/main/java/com/github/dcysteine/neicustomdiagram/api/diagram/DiagramGroupInfo.javasrc/main/java/com/github/dcysteine/neicustomdiagram/util/DiagramUtil.java