库存:调整箱子布局
本页目录
为指定三行箱子调整背景和第一个槽位的位置。
使用前准备
准备 assets/wiki/textures/chest.png 并启用该资源包。目标容器必须是三行箱子,标题与 match.title 完全一致;将 Chest 换成打开容器时实际显示的标题。 管理员需有 shadowui.presentation.admin 权限,目标玩家使用配对的 Forge 1.21.10 客户端在线。
保存位置
保存为服务端 plugins/ShadowUIFramework/profiles/inventory.json。以下为完整 JSON;涉及资源和 UUID 时,先按上方要求替换。
完整配置
{
"id": "wiki:inventory",
"schemaVersion": 1,
"revision": 1,
"requires": [
"presentation_profile_v1",
"presentation_owner_v1",
"inventory_surface_v2",
"ui_tree_v1",
"ui_content_v2",
"ui_mutation_v2",
"ui_motion_v2"
],
"resources": [
"wiki:textures/chest.png"
],
"domains": {
"inventory": {
"schemaVersion": 2,
"rules": [
{
"id": "chest",
"match": {
"kind": "chest",
"rows": 3,
"title": "Chest",
"mode": "exact"
},
"width": 360,
"height": 238,
"anchor": "center",
"defaultVisible": true,
"backgroundMode": "custom",
"background": "wiki:textures/chest.png",
"showTitle": true,
"showInventoryTitle": true,
"slots": [
{
"index": 0,
"x": 20,
"y": 35,
"scale": 1.25
}
]
}
]
}
},
"behaviors": []
}
关键字段
match 筛选容器;defaultVisible: true 保留未逐项配置的槽位;slots[].index 对应真实容器槽位。此例只移动索引 0,不创建新槽位。
加载与使用
/presentation load inventory.json
/presentation assign 玩家名 wiki:inventory
/presentation status 玩家名
load 使用文件名,assign 使用配置中的 id。加载不会自动应用给全部玩家。
预期效果
打开匹配箱子时背景改变,首个槽位移动到指定位置,其他槽位保留。
常用调整
依次调整槽位坐标并检查是否重叠。背景尺寸应与布局配合;不要把物品展示组件当作实际槽位。 修改后递增 revision,再重新加载和分配。需要撤下当前方案时执行 /presentation clear 玩家名。
常见问题
无变化先核对标题、行数与资源路径;物品点击不符合位置时先恢复本例,只调整一个槽位。 其他问题按排错指南检查。