2025-07-13 13:18:21 +08:00
2025-07-14 14:16:38 +08:00
2025-07-13 13:18:21 +08:00
2025-07-13 18:54:16 +08:00
2025-07-15 17:11:46 +08:00
2025-07-13 13:18:21 +08:00
2025-07-15 17:09:25 +08:00
2025-07-13 13:18:21 +08:00

EnchantmentDoNotConflict (附魔不冲突)

  • 1.21 ++ 数据驱动模式的附魔
  • 由于麻将大改附魔系统 现在变为了 数据包模式的 我是用内置数据类实现的不冲突 外置的是配置文件

让我们看看这个版本之后的配置文件

  • 用户定义配置就行 ID 请前往 zh.minecraft.wiki
  • 配置文件位置 config/enchantmentdoesnotconflict.json
{
  "minecraft:damageEnchantment": [ //这个key是自定义的
    "minecraft:sharpness", // 附魔ID 在一组的表示不冲突
    "minecraft:smite",
    "minecraft:bane_of_arthropods",
    "minecraft:density",
    "minecraft:breach"
  ],
  "minecraft:infinityEnchantment": [
    "minecraft:infinity",
    "minecraft:mending"
  ],
  "minecraft:piercingEnchantment": [
    "minecraft:piercing",
    "minecraft:multishot"
  ],
  "minecraft:protectionEnchantment": [
    "minecraft:protection",
    "minecraft:fire_protection",
    "minecraft:blast_protection",
    "minecraft:projectile_protection"
  ]
}

mod 开发者适配 Demo

  • 仓库
maven {
    name "mingliqiye-maven-repo-gitee"
    url "https://gitee.com/minglipro/maven-repository-raw/raw/master"
}
  • 添加依赖
modImplementation "com.mingliqiye.minecraft.enchantment.conflict:enchantmentdoesnotconflict:1.21-1.4"
  • 其他模组加载器也是同理 我会保持API不变的
  • Demo
import com.mingliqiye.minecraft.enchantment.conflict.enchantment.Enchantment;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.fabricmc.api.ModInitializer;

public class Mod implements ModInitializer {
    @Override
    public void onInitialize() {
        Enchantment.registerAllowEnchantment(() -> {
            Map<String, List<String>> map = new HashMap<>();
            map.put("modId:enchantmentGroup",
                    List.of("modId:enchantmentId", "modId:enchantmentId1",
                            "modId:enchantmentId2"));
            return map;
        });
        // 无限与经验修补 示例
        Enchantment.registerAllowEnchantment(() -> {
            Map<String, List<String>> map = new HashMap<>();
            map.put("minecraft:infinityEnchantment", List.of("minecraft:infinity", "minecraft:mending"));
            return map;
        });
        // 如果是注册一次的话则不需要 它会在服务器运行后运行你的表达式
        // 如果是动态加载的话 请重载一下 它会运行你的表达式
        // Enchantment.reload(); //这样也会同步到客户端
    }
}

数据优先级

  • 最最最低 原版
  • 最最低 数据包
  • 最低 配置文件
  • 最高 最后注册的 AllowEnchantment
Description
No description provided
Readme Apache-2.0 4.5 MiB
V1.5-1.21 Latest
2025-07-15 17:12:03 +08:00