布局、坐标与槽位
用 layout、slot、locate 和 scale 安排面板与图标。
槽位示意
序号 13坐标 4x1字符 A
当前选择:钻石按钮。数字序号 = 行坐标 × 9 + 列坐标;这里的坐标是这个面板的局部坐标。
点击格子可查看序号、坐标和布局字符。三行箱子面板的序号为 0~26,左上角坐标为 0x0。
字符布局
在面板中配置 layout 与 icons:
# 一个普通面板
layout:
- '#########'
- '# A #'
- '####C####'
icons:
'#':
material: GRAY_STAINED_GLASS_PANE
name: ' '
A:
material: DIAMOND
name: '&b按钮'
C:
material: BARRIER
name: '&c关闭'
action: 'menu close'每个字符对应一个图标 ID;相同字符可重复放置,空格留空。上例中 A 位于第二行第五格,C 位于第三行第五格。箱子窗口每行九格。
slot 指定位置
slot 写在图标下,或写在它的 display 内。
| 写法 | 位置 |
|---|---|
slot: 0 | 面板第一格 |
slot: '4x1' | 第五列、第二行 |
slot: '0~8' | 0 至 8,包含两端 |
slot: '0;8;4x1' | 多个序号或坐标 |
layout:
- ' '
- ' '
- ' '
icons:
welcome:
slot: '4x1'
material: DIAMOND
name: '&b中央按钮'这个图标使用 ID welcome,位置由 slot 设置,无需在 layout 中放置同名字符。
多个位置也可逐项列出:
slot:
- 0
- 8
- 18
- 26面板尺寸与起点
| 字段 | 第一项 | 第二项 |
|---|---|---|
locate | 横向起点 x | 纵向起点 y |
scale | 宽度 | 高度 |
# 放在 panels 列表中
- locate:
- 0
- 1
scale:
- 9
- 2
icons:
button:
slot: 0
material: PAPER此面板从窗口第二行开始,宽九格、高两格。图标的 slot: 0 是该面板的第一格,对应窗口序号 9。
图标坐标相对所在面板,locate 相对父容器。 多面板组合见普通面板。
最后更新于