Advanced Datapack Mod
此模组旨在扩展数据包功能,目前处于早期开发阶段。不要在正常游戏期间使用此模组。它可能会导致崩溃甚至损坏你的世界!
安装
确保 Minecraft 已安装 Fabric Loader 和 Fabric API,然后将此模组文件放入 mods 文件夹中。
- 问:不确定是否安装正确?
答:进入游戏并输入命令:/adm。
- 问:Minecraft(原版)数据包可以在本模组中使用吗?
答:这样做几乎不会有问题。
- 问:我可以在专用服务器上使用该模组吗?
答:我不建议你这样做。因为游戏会变得不稳定,而且有时你甚至无法加入服务器,特别是当客户端的模组版本与服务器端的模组版本不一致时。
功能
本模组修改了 Minecraft 的数据包加载方式,绕过了注册表限制,使得热加载物品、方块等成为可能。你可以仅通过使用数据包来实现这些功能。
未来可能添加的功能
-
- 支持卸载物品、方块等
-
- 当物品/方块被使用/放置/破坏时,将调用你指定的数据包功能
-
- 支持注册新的效果,甚至是新的实体。
Bug 报告
很抱歉,我们目前正在准备一个用于报告 Bug 的渠道。如果你遇到任何错误,请通过电子邮件 (BilibiliXiaotian@outlook.com) 联系我们。
英文文档版本
- [由 Deepseek(AI) 和 XiaotianMC(作者) 翻译]
数据包功能介绍
1. 物品扩展
- 与原版数据包相比,它提供了更多的物品扩展功能,允许 Minecraft 通过数据包动态注册物品。
- 支持自定义物品属性、耐久度等。
- 支持自定义物品模型和纹理。(在资源包中定义)
2. 方块扩展(开发中)
3. 命令
adm 命令 [返回] 模组信息
item 子命令
get <namespace> [返回] 已注册物品列表。<namespace> 是可选参数。
disable <item> [禁用] 指定的 adm 物品。<item> 是必填参数(可用,正在完善)。
enable <item> [启用] 指定的 adm 物品。<item> 是必填参数(可用,正在完善)。
setclear [清除] 当前禁用的物品将被移除。true->false; false->true(可用,正在完善)。
block 子命令
get <namespace> [返回] 已注册方块列表。<namespace> 是可选参数。
disable <block> [禁用] 指定的 adm 方块。<block> 是必填参数(可用,正在完善)。
enable <block> [启用] 指定的 adm 方块。<block> 是必填参数(可用,正在完善)。
debug 子命令 [设置] 调试模式。true->false; false->true。
reload 子命令 [重载] 模组数据(开发中)。
数据包格式
要定义一个物品,请在数据包的 data/<namespace>/item 目录中创建一个 <item_name>.json 文件。
这是一个示例:
{
"food": {
"canAlwaysEat": true,
"nutrition": 80,
"saturation": 3.0,
"effects": [
["minecraft:night_vision", 10, 1]
]
},
"tool": {
"type": "axe",
"level": "stone",
"attackDamage": 999,
"attackSpeed": 0.1,
"durability": 1
},
"replace": "barrier"
}
其中 food、tool 和 replace 是可选的。
food 定义物品的食物相关属性。
canAlwaysEat: 该物品是否可以随时食用。
nutrition: 食物值(食用时恢复的饱和度)。
saturation: 饱和度值。
effects: 食用后施加的效果,格式为 [effect_id, duration_in_ticks, effect_level]。
tool 定义物品的工具相关属性。
type: 工具类型,如 axe(斧)、pickaxe(镐)、shovel(铲)、hoe(锄)、sword(剑)。
level: 工具等级,如 wood(木)、stone(石)、iron(铁)、diamond(钻石)、netherite(下界合金)。
attackDamage: 工具的攻击伤害。
attackSpeed: 工具的攻击速度。
durability: 工具的耐久度。
replace 定义客户端上物品的显示物品。它必须是现有的(客户端)物品 ID,例如 minecraft:stone、minecraft:iron_ingot 等。(开发中)。
要定义一个方块,请在数据包的 data/<namespace>/block 目录中创建一个 <block_name>.json 文件。
这是一个示例:
{
"hardness": 1.0,
"resistance": 10.0,
"lightLevel": 0,
"replace": "minecraft:stone",
"require_tool": true,
"has_item": true,
"replaceable": false
}
其中 hardness、resistance、lightLevel、replace、require_tool、tool 和 has_item 是可选的。
hardness: 方块的硬度。
resistance: 方块的爆炸抗性。
lightLevel: 方块的发光等级。
has_item: 该方块是否有对应的物品形式。(如果有,请在 data/<namespace>/item 目录中创建同名物品定义文件。)
replace: 定义客户端上方块的显示方块。它必须是现有的(客户端)方块 ID,例如 minecraft:stone、minecraft:oak_planks 等。(开发中)。
require_tool: 是否需要工具才能破坏该方块。
ADM API
cn.gcte.adm.api.ResReloadManager 资源重载管理器
public static void register(Consumer<ResourceManager> consumer) 注册监听器,当数据包初始加载时会调用此监听器。ResReloadManager.register(resourceManager -> { // 在资源加载后立即处理 // 例如:LOGGER.info("资源管理器已重新加载!"); });
cn.gcte.adm.api.GetBlockData 获取方块数据包资源(即 data/<namespace>/block/<block_name>.json 文件)。
public static String getAllData() 获取数据列表(以 JSON 字符串形式)。
cn.gcte.adm.api.GetItemData 获取物品数据包资源(即 data/<namespace>/item/<item_name>.json 文件)。
public static String getAllData() 获取数据列表(以 JSON 字符串形式)。
ChineseVersion of doc-中文版文档
数据包功能介绍
1. 物品扩展
- 相比原版数据包,增加了更多的物品扩展功能,使 Minecraft 能够通过数据包动态注册物品。
- 支持物品的自定义属性、耐久度等。
- 支持物品的自定义模型和纹理。(在资源包中定义)
2. 方块扩展(正在开发)
3. 命令
adm 命令 [返回]mod 信息
item 子命令
get <namespace> [返回]已注册的物品列表 <namespace> 为可选参数
disable <item> [禁用]指定的 adm 物品 <item> 为必选参数(可用,正在完善中)
enable <item> [启用]指定的 adm 物品 <item> 为必选参数(可用,正在完善中)
setclear [清除]清除正在使用的已禁用物品 true->false;false->true(可用,正在完善中)
block 子命令
get <namespace> [返回]已注册的方块列表 <namespace> 为可选参数
disable <block> [禁用]指定的 adm 方块 <block> 为必选参数(可用,正在完善中)
enable <block> [启用]指定的 adm 方块 <block> 为必选参数(可用,正在完善中)
debug 子命令 [设置]调试模式 true->false;false->true
reload 子命令 [重载]mod 数据(正在开发)
数据包格式
在数据包的 data/<namespace>/item 目录下新建 <item_name>.json 文件以定义物品。
这是一个示例
{
"food": {
"canAlwaysEat": true,
"nutrition": 80,
"saturation": 3.0,
"effects":[
["minecraft:night_vision",10,1]
]
},
"tool": {
"type": "axe",
"level": "stone",
"attackDamage": 999,
"attackSpeed": 0.1,
"durability": 1
},
"replace": "barrier"
}
undefined
其中 food、tool 和 replace 是可选的。
food 定义了物品的食物属性。
canAlwaysEat:是否总是可以食用。
nutrition:食物的饱食度。
saturation:食物的饱和度。
effects:食用后给予的效果,格式为 [效果ID,持续时间(tick),效果等级]。
tool 定义了物品的工具属性。
type:工具类型,如 axe、pickaxe、shovel、hoe、sword。
level:工具等级,如 wood、stone、iron、diamond、netherite。
attackDamage:工具的攻击伤害。
attackSpeed:工具的攻击速度。
durability:工具的耐久度。
replace 定义了物品在客户端的展示物品,必须是一个(客户端)存在的物品 ID,如 minecraft:stone、minecraft:iron_ingot 等(developing)。
在数据包的 data/<namespace>/block 目录下新建 <block_name>.json 文件以定义方块。
这是一个示例
{
"hardness": 1.0,
"resistance": 10.0,
"lightLevel": 0,
"replace": "minecraft:stone",
"require_tool": true,
"has_item": true,
"replaceable": false
}
其中 hardness、resistance、lightLevel、replace、require_tool、tool 和 has_item 是可选的。
hardness:方块的硬度。
resistance:方块的爆炸抗性。
lightLevel:方块的光照等级。
has_item:方块是否有对应的物品形式。(若有,则在 data/<namespace>/item 目录下新建同名的物品定义文件)
replace 定义了方块在客户端的展示方块,必须是一个(客户端)存在的方块 ID,如 minecraft:stone、minecraft:oak_planks 等(developing)。
require_tool:是否需要工具才能破坏方块。
ADM API
-
cn.gcte.adm.api.ResReloadManager 资源重载管理器
public static void register(Consumer<ResourceManager> consumer) 注册监听器,该监听器会在数据包刚开始加载时被调用。 ResReloadManager.register(resourceManager -> { // 在这里处理资源刚加载 // 举个例子 LOGGER.info("资源管理器已重新加载!"); });
-
cn.gcte.adm.api.GetBlockData 获取方块数据包资源(即 data/<namespace>/block/<block_name>.json 文件)。
public static String getAllData() 获取数据列表(JSON 字符串)
-
cn.gcte.adm.api.GetItemData 获取物品数据包资源(即 data/<namespace>/item/<item_name>.json 文件)。
public static String getAllData() 获取数据列表(JSON 字符串)
Advanced Datapack Mod
This mod is designed to extend datapack functionality and is currently in early development. Do not use this mod during regular gameplay. It may cause crashes or even corrupt your world!
此mod旨在扩展数据包功能,目前处于早期开发阶段。 不要在正常游戏期间使用此模组。它可能会导致崩溃甚至坏档!
Installation
Make sure Minecraft has the Fabric Loader and Fabric API installed, then put this mod file in the mods folder
- Q: Not sure if you installed the mod correctly?
A: Enter the game input command: /adm.
- Q: Can the Minecraft(Vanilla) datapacks be used in this mod?
A: There are almost no problems if you do that.
- Q: Can I use this mod on a dedicated servers?
A: I do not recommend that you do this.Because the game will be unstable and sometimes you even cannot join the server especially when the mod version in your client is not as same as your server mod version.
Features
This mod modifies Minecraft's datapack loading, bypassing registry restrictions and making it possible to hotload items, blocks, etc.You can do these things by using a datapack simply.
Features that may be added in the future
- 1.Heat unload items, blocks, etc
- 2.When an item/block is used/placed/destroyed, it will call the Datapack function that you specified
- 3.Make it possible to register new effects, even new entity.
Bug Report
We apologize, we are currently preparing a channel for bug reports. If you encounter any bugs, please contact us via email(BilibiliXiaotian@outlook.com).
EnglishVersion of doc
- [translated by Deepseek(AI) and XiaotianMC(author)]
Datapack Function Introduction
1. Item Expansion
- Compared to the vanilla datapack, it provides more item expansion functionalities, allowing Minecraft to dynamically register items through datapacks.
- Supports custom item attributes, durability, etc.
- Supports custom item models and textures. (Defined in the resource pack)
2. Block Expansion (Under Development)
- Adds more block expansion functionalities.
3. Commands
adm command [Returns] mod information
item subcommand
get <namespace> [Returns] list of registered items. <namespace> is an optional parameter.
disable <item> [Disable] a specified adm item. <item> is a required parameter (Available, under refinement).
enable <item> [Enable] a specified adm item. <item> is a required parameter (Available, under refinement).
setclear [Clear] disabled items currently in use will be removed. true->false; false->true (Available, under refinement).
block subcommand
get <namespace> [Returns] list of registered blocks. <namespace> is an optional parameter.
disable <block> [Disable] a specified adm block. <block> is a required parameter (Available, under refinement).
enable <block> [Enable] a specified adm block. <block> is a required parameter (Available, under refinement).
debug subcommand [Set] debug mode. true->false; false->true.
reload subcommand [Reload] mod data (Under Development).
Datapack Format
To define an item, create a <item_name>.json file in the data/<namespace>/item directory of the datapack.
This is an example:
{
"food": {
"canAlwaysEat": true,
"nutrition": 80,
"saturation": 3.0,
"effects": [
["minecraft:night_vision", 10, 1]
]
},
"tool": {
"type": "axe",
"level": "stone",
"attackDamage": 999,
"attackSpeed": 0.1,
"durability": 1
},
"replace": "barrier"
}
Where food, tool, and replace are optional.
food defines the food-related properties of the item.
canAlwaysEat: Whether the item can always be eaten.
nutrition: The food value (saturation restored when eating).
saturation: The saturation value.
effects: Effects applied after consumption, in the format [effect_id, duration_in_ticks, effect_level].
tool defines the tool-related properties of the item.
type: Tool type, such as axe, pickaxe, shovel, hoe, sword.
level: Tool tier, such as wood, stone, iron, diamond, netherite.
attackDamage: The attack damage of the tool.
attackSpeed: The attack speed of the tool.
durability: The durability of the tool.
replace defines the display item of the item on the client side. It must be an existing (client-side) item ID, such as minecraft:stone, minecraft:iron_ingot, etc. (Under development).
To define a block, create a <block_name>.json file in the data/<namespace>/block directory of the datapack.
This is an example:
{
"hardness": 1.0,
"resistance": 10.0,
"lightLevel": 0,
"replace": "minecraft:stone",
"require_tool": true,
"has_item": true,
"replaceable": false
}
Where hardness, resistance, lightLevel, replace, require_tool, tool, and has_item are optional.
hardness: The hardness of the block.
resistance: The explosion resistance of the block.
lightLevel: The light emission level of the block.
has_item: Whether the block has a corresponding item form. (If yes, create an item definition file with the same name in the data/<namespace>/item directory.)
replace: Defines the display block of the block on the client side. It must be an existing (client-side) block ID, such as minecraft:stone, minecraft:oak_planks, etc. (Under development).
require_tool: Whether a tool is required to break the block.
ADM API
cn.gcte.adm.api.ResReloadManager Resource Reload Manager
public static void register(Consumer<ResourceManager> consumer) Register a listener, This listener will be called when the datapack is initially loaded. ResReloadManager.register(resourceManager -> { // Handle resources right after they are loaded // For example: LOGGER.info("Resource manager has been reloaded!"); });
cn.gcte.adm.api.GetBlockData Get block datapack resources (i.e., the data/<namespace>/block/<block_name>.json file).
public static String getAllData() Get the DataList (as a JSON string).
cn.gcte.adm.api.GetItemData Get item datapack resources (i.e., the data/<namespace>/item/<item_name>.json file).
public static String getAllData() Get the DataList (as a JSON string).
ChineseVersion of doc-中文版文档
Datapack功能介绍
1. 物品扩展
- 相比于原版数据包,增加了更多的物品扩展功能,能够使Minecraft通过数据包动态注册物品。
- 支持物品的自定义属性、耐久度等。
- 支持物品的自定义模型和纹理。(在资源包中定义)
2. 方块扩展(正在开发)
3. 命令
adm命令 [返回]mod 信息
item子命令
get <namespace> [返回]注册的物品列表 <namespace>非必选参数
disable <item> [禁用]指定_adm_物品 <item>必选参数(可用,正在完善中)
enable <item> [启用]指定_adm_物品 <item>必选参数(可用,正在完善中)
setclear [清除]正在被使用的已禁用物品会被清除 true->false;false->true(可用,正在完善中)
block子命令
get <namespace> [返回]注册的方块列表 <namespace>非必选参数
disable <block> [禁用]指定_adm_方块 <block>必选参数(可用,正在完善中)
enable <block> [启用]指定_adm_方块 <block>必选参数(可用,正在完善中)
debug子命令 [设置]debug模式 true->false;false->true
reload子命令 [重载]mod数据 (正在开发)
Datapack格式
在数据包的 data/<namespace>/item目录下新建<item_name>.json文件以定义物品。
这是一个示例
{
"food": {
"canAlwaysEat": true,
"nutrition": 80,
"saturation": 3.0,
"effects":[
["minecraft:night_vision",10,1]
]
},
"tool": {
"type": "axe",
"level": "stone",
"attackDamage": 999,
"attackSpeed": 0.1,
"durability": 1
},
"replace": "barrier"
}
undefined
其中food、tool和replace是可选的。
food定义了物品的食物属性。
canAlwaysEat:是否总是可以食用。
nutrition:食物的饱食度。
saturation:食物的饱和度。
effects:食用后给予的效果,格式为[效果ID,持续时间(tick),效果等级]。
tool定义了物品的工具属性。
type:工具类型,如axe、pickaxe、shovel、hoe、sword。
level:工具等级,如wood、stone、iron、diamond、netherite。
attackDamage:工具的攻击伤害。
attackSpeed:工具的攻击速度。
durability:工具的耐久度。
replace定义了物品在客户端的展示物品,必须是一个(客户端)存在的物品ID,如minecraft:stone、minecraft:iron_ingot等(developing)。
在数据包的 data/<namespace>/block目录下新建<block_name>.json文件以定义方块。
这是一个示例
{
"hardness": 1.0,
"resistance": 10.0,
"lightLevel": 0,
"replace": "minecraft:stone",
"require_tool": true,
"has_item": true,
"replaceable": false
}
其中hardness、resistance、lightLevel、replace、require_tool、tool和has_item是可选的。
hardness:方块的硬度。
resistance:方块的爆炸抗性。
lightLevel:方块的光照等级。
has_item:方块是否有对应的物品形式。(若有,则在data/<namespace>/item目录下新建同名的物品定义文件)
replace定义了方块在客户端的展示方块,必须是一个(客户端)存在的方块ID,如minecraft:stone、minecraft:oak_planks等(developing)。
require_tool:是否需要工具才能破坏方块。
ADM API
-
cn.gcte.adm.api.ResReloadManager 资源重载管理器
public static void register(Consumer<ResourceManager> consumer) 注册listener, 该listener会在数据包刚开始加载时被调用。 ResReloadManager.register(resourceManager -> { // 在这里处理资源刚加载 // 举个例子 LOGGER.info("Resource manager has been reloaded!"); });
-
cn.gcte.adm.api.GetBlockData 获得方块数据包资源(即data/<namespace>/block/<block_name>.json文件)。
public static String getAllData()获得DataList(json字符串)
-
cn.gcte.adm.api.GetItemData 获得物品数据包资源(即data/<namespace>/item/<item_name>.json文件)。
public static String getAllData()获得DataList(json字符串)
评论 0
登录后参与评分
还没有评论,来抢沙发吧