Files
2025-08-25 18:36:29 +08:00

77 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
front:
hard: 入门
time: 分钟
---
# 自定义物品分页
## 概述
用于扩展原版背包分页让同一mod的自定义物品统一展示
## 注册
在 behavior 文件夹下新建 netease_tab 文件夹并在其目录下添加任意名称json 文件,例如 category_config.json配置如下
```json
{
"category":[
{
"name":"custom1", //分页名称自定义物品的json中category的值
"labelText":"itemCategory.name.custom1", //分页描述可在zh_CN.lang中设置中文名称
"icon": "textures/items/bed_green", //分页图标路径
"sort_by_identifier" : true //分页内的item是否进行排序选填默认false
},
{
"name":"custom2",
"labelText":"itemCategory.name.custom2",
"icon":"textures/items/apple"
}
...
]
}
```
**注:**
**1.name由小写字母组成请勿使用大写字母支持下划线**
**2."sort_by_identifier"排序规则如下:**
- **分页中全部为未分组item则按照item的identifier进行排序**
- **分页中全部为具有分组的item则按照分组中第一个item的identifier进行排序**
- **分页中既有分组item和未分组item则按照分组中第一个item的identifier和未分组item的identifier进行排序**
效果如下图自定义分页将排列在原版分页之后分别对应custom1custom2排列在原版分页之后点击右箭头即可展示下一组分页自定义分页的顺序按照category数组顺序排列。
![image-20210727153920711](./picture/custom_category1.png)
![image-20210727154037383](./picture/custom_category2.png)
## 使用
在 behavior 文件夹下的自定义物品的 json 里,修改 `category` 值为 custom1。
```json
{
"format_version": "1.10.0",
"minecraft:block": {
"description": {
"identifier": "customblocks:test_block1",
"category":"custom1" //修改为custom1
},
"components": {
}
}
}
```
![image-20210727153819654](./picture/custom_category3.png)
## 注意事项
从2.6版本开始当多个mod都配置了自定义分页时引擎会将name和labelText字段都完全相同的物品合并到同一个分页。