68 lines
1.7 KiB
Markdown
68 lines
1.7 KiB
Markdown
---
|
||
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" //分页图标路径
|
||
},
|
||
{
|
||
"name":"custom2",
|
||
"labelText":"itemCategory.name.custom2",
|
||
"icon":"textures/items/apple"
|
||
}
|
||
...
|
||
]
|
||
}
|
||
```
|
||
|
||
**注:name由小写字母组成,请勿使用大写字母(支持下划线)**
|
||
|
||
效果如下图,自定义分页将排列在原版分页之后,分别对应custom1,custom2,排列在原版分页之后,点击右箭头即可展示下一组分页,自定义分页的顺序按照category数组顺序排列。
|
||
|
||

|
||
|
||

|
||
|
||
|
||
|
||
|
||
## 使用
|
||
|
||
在 behavior 文件夹下的自定义物品的 json 里,修改 `category` 值为 custom1,
|
||
|
||
要在自定义分页默认显示,将 `register_to_create_menu` 设置为 true,参考示例如下
|
||
|
||
```json
|
||
{
|
||
"format_version": "1.10.0",
|
||
"minecraft:block": {
|
||
"description": {
|
||
"identifier": "customblocks:test_block1",
|
||
"register_to_creative_menu": true,
|
||
"is_experimental": false,
|
||
"category":"custom1" //修改为custom1
|
||
},
|
||
"components": {
|
||
}
|
||
}
|
||
}
|
||
```
|
||
|
||
 |