feat: add pattern alias mode to crafting shortcode

This commit is contained in:
FlipWind
2026-08-09 00:12:06 +08:00
parent c1a8ffb323
commit cd19dddad1
4 changed files with 107 additions and 24 deletions
+21
View File
@@ -39,3 +39,24 @@
- 需要显示堆叠数量时写 `名称:数量`,例如 `b2="stick:2"`
- `caption` 可选,显示在组件下方居中说明文字;
- 未运行自动同步且贴图缺失时,格子内会显示一个 `?` 占位,方便发现写错的名字。
### pattern 别名模式(另一种写法)
不想数格子时,可以用 `pattern` 先画好形状,再为每个字符别名指定物品:
```markdown
{{< crafting
pattern="a a a\nb b b\nc c c"
a="diamond"
b="stick"
c=""
out="diamond_pickaxe"
caption="钻石镐"
>}}
```
- `pattern` 共 9 个 token(3 行 × 3 列),**必须写在一行内**,行间用 `\n` 表示;
- 每个 token 对应一个同名参数(`a``b``c`…),参数值就是物品 id
- token 也可以直接写物品 id`pattern="diamond stick ."`
- `.` 表示空格子;
- 同时给出 `pattern``a1`~`c3` 时,以 `pattern` 为准(`out` 两者通用)。