Advanced Datapack Mod
ModMIT

Advanced Datapack Mod

此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!

106
Downloads
1
Followers
4 months ago
Updated
📦
11
Versions

📖About Advanced Datapack Mod

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([email protected]).

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

其中foodtoolreplace是可选的。

  • food定义了物品的食物属性。
    • canAlwaysEat:是否总是可以食用。
    • nutrition:食物的饱食度。
    • saturation:食物的饱和度。
    • effects:食用后给予的效果,格式为[效果ID,持续时间(tick),效果等级]
  • tool定义了物品的工具属性。
    • type:工具类型,如axepickaxeshovelhoesword
    • level:工具等级,如woodstoneirondiamondnetherite
    • attackDamage:工具的攻击伤害。
    • attackSpeed:工具的攻击速度。
    • durability:工具的耐久度。
  • replace定义了物品在客户端的展示物品,必须是一个(客户端)存在的物品ID,如minecraft:stoneminecraft: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
}

其中hardnessresistancelightLevelreplacerequire_tooltoolhas_item是可选的。

  • hardness:方块的硬度。
  • resistance:方块的爆炸抗性。
  • lightLevel:方块的光照等级。
  • has_item:方块是否有对应的物品形式。(若有,则在data/<namespace>/item目录下新建同名的物品定义文件)
  • replace定义了方块在客户端的展示方块,必须是一个(客户端)存在的方块ID,如minecraft:stoneminecraft: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字符串)