Description
Currently, the built-in command "dynamicregistrar datagen" can generate a resource bundle based on your data package, and you can replace it according to the structure inside A built-in page allows for quick generation of data packets, but its functionality is somewhat limited. I don't intend to develop this page for the time being ..
Items
You can now register items through data packets, but please note that server restart is required for data packet reloading, and hot reloading may be upgraded in the future
Common items
You can register a very simple item
{
"identifier": "dynamicregistrar:example_custom_properties"
}
You can also register a complex item
- type: The class path of the item. If only the class name is passed, the original version's class path will be used by default. For example, FishingRodItem corresponds to net.minecraft.world.item.FishingRodItem. Note that this class only supports classes with a construction parameter of Properties
- curios_type: represents the type of accessories. Currently, head and back accessories can be rendered on players. This value automatically registers the type of accessory, and as long as the player has the corresponding slot, they can be worn. It supports customizable slots for players
- attribute_modifiers: Definition of item attributes
- can_repair: whether it can be repaired
- components: item components, which can be operated in many ways, and are not listed here one by one
- fire_resistant indicates whether it is fire-resistant or not
- "food" refers to the food item, "effects" denotes the effects obtained after eating, and "using_converts_to" indicates what item will be returned after eating, such as a bowl or a water bottle
- identifier: the namespace of the item
- max_damage: The durability of an item. This defines the maximum stack size, which will be ignored
- max_stack_size: maximum stack size for items. Note that the upper limit of item stacking is not solely determined by the item itself, but also by the corresponding slot
- rarity, which should only affect the color of the item name
{
"type": "FishingRodItem",
"curios_type": "head",
"attribute_modifiers": {
"modifiers": [
{
"type": "minecraft:generic.attack_damage",
"amount": 1.0,
"id": "minecraft:base_attack_damage",
"operation": "add_value",
"slot": "mainhand"
}
]
},
"can_repair": false,
"components": {
"minecraft:lore": [
"{\"translate\":\"item.dynamicregistrar.example_complex_custom_properties.lore\"}"
]
},
"fire_resistant": true,
"food": {
"eat_seconds": 1.0,
"effects": [
{
"effect": {
"duration": 100,
"id": "minecraft:health_boost",
"neoforge:cures": [
"protected_by_totem",
"milk"
],
"show_icon": true
}
}
],
"nutrition": 1,
"saturation": 1.0,
"using_converts_to": {
"id": "minecraft:bowl"
}
},
"identifier": "dynamicregistrar:example_complex_custom_properties",
"max_damage": 300,
"max_stack_size": 1,
"rarity": "rare"
}
Tool-type items
You can register a set of tools
- custom_properties: Information about the item, as above
- extend_damage: Additional attack power
- extend_speed: additional attack speed
- tier
- attackDamageBonus: Basic attack power
- enchantmentValue: enchantment value, I can't see what it's for
- incorrectBlocksForDrops: The tag for non-minable blocks, also known as the tag
- repairIngredient: a predicate for items used for repair. If you don't understand, it is recommended to write according to the example
- speed: mining speed
- Uses actually also have durability
- types: tool types, including weapons
{
"custom_properties": {
"curios_type": "head",
"identifier": "dynamicregistrar:example_custom_properties"
},
"extend_damage": 0.5,
"extend_speed": 0.5,
"tier": {
"attackDamageBonus": 1.0,
"enchantmentValue": 1,
"incorrectBlocksForDrops": "dynamicregistrar:example_custom_properties",
"repairIngredient": ["tag": "minecraft:planks"],
"speed": 1.0,
"uses": 1
},
"types": [
"sword",
"axe",
"pickaxe",
"shovel",
"hoe"
]
}
Equipment items
You can register a set of equipment
- armor_material
- Armor values of various parts of defense
- enchantmentValue is the same as the tool
- equipSound: The sound of armor
- knockback_resistance: Knockback resistance
- The "layers" should be consistent with the identifier in "custom_properties"
- repairIngredient and tool
- toughness: armor toughness
- custom_properties, same tool
- if_body is temporarily not useful
{
"armor_material": {
"defense": {
"boots": 1,
"chestplate": 2,
"helmet": 1,
"leggings": 1
},
"enchantmentValue": 0,
"equipSound": "minecraft:item.armor.equip_generic",
"knockback_resistance": 0.0,
"layers": [
{
"asset_name": "dynamicregistrar:example_custom_properties"
}
],
"repairIngredient": [],
"toughness": 0.0
},
"custom_properties": {
"curios_type": "head",
"identifier": "dynamicregistrar:example_custom_properties"
},
"if_body": false
}
目前内置了命令 dynamicregistrar datagen 可以根据你的数据包生成一个资源包,可以根据里面的结构进行替换 内置一个页面可以快速生成数据包,但是功能有点少,暂时不想写这个页面...
物品
你现在可以通过数据包注册物品,但需要注意,数据包重载需要重启服务器,未来可能会升级热重载
普通物品
你可以注册一个非常简单的物品
{
"identifier": "dynamicregistrar:example_custom_properties"
}
你也可以注册一个复杂的物品
- type 物品的类路径,如果只传类名则默认原版的类路径,比如FishingRodItem相当于net.minecraft.world.item.FishingRodItem,注意这里的类只支持构建参数仅为Properties的类
- curios_type 饰品类型,目前head和back可以在玩家身上渲染,这个值会自动注册饰品类型,只要玩家身上有对应的槽位即可穿戴;支持玩家自定义的槽位
- attribute_modifiers 物品的属性定义
- can_repair 是否可修复
- components 物品组件,物品组件可以操作的东西很多,这里不一一列举
- fire_resistant 是否防火
- food 食物属性effects是吃了之后获得的效果,using_converts_to是吃了会返回什么物品,比如碗、水瓶等
- identifier 物品的命名空间
- max_damage 物品的耐久度 定义了这个max_stack_size就会被忽略
- max_stack_size 物品最大堆叠,注意,物品堆叠上限不完全取决于物品还与对应的槽位有关
- rarity 品质,这个应该只影响物品名字的颜色
{
"type": "FishingRodItem",
"curios_type": "head",
"attribute_modifiers": {
"modifiers": [
{
"type": "minecraft:generic.attack_damage",
"amount": 1.0,
"id": "minecraft:base_attack_damage",
"operation": "add_value",
"slot": "mainhand"
}
]
},
"can_repair": false,
"components": {
"minecraft:lore": [
"{\"translate\":\"item.dynamicregistrar.example_complex_custom_properties.lore\"}"
]
},
"fire_resistant": true,
"food": {
"eat_seconds": 1.0,
"effects": [
{
"effect": {
"duration": 100,
"id": "minecraft:health_boost",
"neoforge:cures": [
"protected_by_totem",
"milk"
],
"show_icon": true
}
}
],
"nutrition": 1,
"saturation": 1.0,
"using_converts_to": {
"id": "minecraft:bowl"
}
},
"identifier": "dynamicregistrar:example_complex_custom_properties",
"max_damage": 300,
"max_stack_size": 1,
"rarity": "rare"
}
工具类物品
你可以注册一套工具
- custom_properties 物品的信息,同上
- extend_damage 额外的攻击力
- extend_speed 额外的攻速
- tier
- attackDamageBonus 基础攻击力
- enchantmentValue 附魔价值,没看出来有什么用
- incorrectBlocksForDrops 无法挖掘的方块标签,也就是tag
- repairIngredient 用于修复的物品谓语,不会的建议按示例来写
- speed 挖掘速度
- uses 其实也是耐久
- types 工具类型,包括武器
{
"custom_properties": {
"curios_type": "head",
"identifier": "dynamicregistrar:example_custom_properties"
},
"extend_damage": 0.5,
"extend_speed": 0.5,
"tier": {
"attackDamageBonus": 1.0,
"enchantmentValue": 1,
"incorrectBlocksForDrops": "dynamicregistrar:example_custom_properties",
"repairIngredient": ["tag": "minecraft:planks"],
"speed": 1.0,
"uses": 1
},
"types": [
"sword",
"axe",
"pickaxe",
"shovel",
"hoe"
]
}
装备类物品
你可以注册一套装备
- armor_material
- defense 各部位的护甲值
- enchantmentValue 同工具
- equipSound 盔甲的声音
- knockback_resistance 击退抗性
- layers 建议跟custom_properties里的identifier一致
- repairIngredient 同工具
- toughness 盔甲韧性
- custom_properties 同工具
- if_body 暂时没啥用
{
"armor_material": {
"defense": {
"boots": 1,
"chestplate": 2,
"helmet": 1,
"leggings": 1
},
"enchantmentValue": 0,
"equipSound": "minecraft:item.armor.equip_generic",
"knockback_resistance": 0.0,
"layers": [
{
"asset_name": "dynamicregistrar:example_custom_properties"
}
],
"repairIngredient": [],
"toughness": 0.0
},
"custom_properties": {
"curios_type": "head",
"identifier": "dynamicregistrar:example_custom_properties"
},
"if_body": false
}


