promotional bannermobile promotional banner

magicenchant

Add new "Magic Damage" enchantment, which converts melee and ranged weapons to deal pure magic damage.

Description

Magic Damage adds a new enchantment called "Magic Damage". Once a weapon bears this enchantment, all damage it deals — whether from melee strikes or ranged shots — is converted into true magic damage, bypassing the target's armor.

Enchantment Properties

The enchantment registry name is magic_damage. It has only 1 level and is a non-treasure enchantment. It can be obtained normally via the enchanting table, found in chest loot, and traded from librarian villagers. It uses a custom enchantment category, allowing it to be applied to any weapon or tool. Compatibility check always returns true; it conflicts with no other enchantments.

Mechanics

Works for both melee and ranged attacks: damage from melee hits with the enchanted weapon, as well as arrows (including tridents) fired from it, is converted to the magic damage type. Ranged projectiles are tagged and locked with the enchantment state the moment they are fired, preventing inconsistent behaviour if the weapon is switched afterward.

Behaviour of magic damage: ignores target armor, cannot be blocked by shields, and displays magic damage death messages. Since vanilla magic damage is not included in the tags for "bypasses enchantments" or "bypasses resistance", target Protection enchantments and Resistance effects still reduce this damage.

Implementation

Uses Mixin at the HEAD of LivingEntity.hurt with @ModifyVariable to directly replace the DamageSource argument with minecraft:magic. This approach only swaps the parameter, does not cancel events or re-invoke the hurt method. All damage evaluations proceed normally, and all melee side effects are fully preserved: knockback, sweeping attacks, critical hits, durability loss, enchantment triggers, damage statistics, and more.

Compatibility

All new content uses its own namespace. No vanilla item or enchantment data is modified. There is no required load order, and it safely coexists with other mods.

The package name amassofmud comes from my nickname "一团泥浆". CurseForge would not accept this nickname, so I use its pinyin form as my author name instead.




功能简介
Magic Damage 新增了一种名为“魔法伤害”的附魔。武器附魔法术后,其造成的所有伤害——无论是近战攻击还是远程射击——都会转化为真正的魔法伤害,从而绕过目标的护甲。
附魔特性
附魔注册名为 magic_damage,仅 1 级,属于非宝藏附魔。
可在附魔台正常获得,也可在箱子与战利品中发现,并可由图书管理员交易获得。
采用自定义附魔类别,任何武器与工具都能附此魔法。
兼容性判定恒为真,不与任何其他附魔冲突。
机制说明
近战与远程攻击均生效:附魔武器的近战攻击,以及由其射出的箭(含三叉戟)造成的伤害都会转为魔法类型。
远程弹射物在射出的瞬间即被标记并固定附魔状态,避免之后更换武器导致判定不一致。
魔法伤害的实际表现:无视目标护甲、不能被盾牌格挡、死亡消息显示为魔法伤害。
由于原版魔法伤害类型不在“绕过附魔”与“绕过抗性”的标签中,目标的“保护”类附魔与“抗性提升”效果仍可对其减免。
技术实现
通过 Mixin 在 `LivingEntity.hurt` 方法入口(HEAD)使用 `@ModifyVariable` 直接把伤害来源(DamageSource)参数替换为 `minecraft:magic`。
该方案只替换参数,不取消事件、也不重新调用伤害方法,因此伤害判定正常返回,并完整保留近战的全部副作用:击退、横扫、暴击、耐久损耗、附魔触发与伤害统计等。
兼容性
新增内容均使用独立命名空间,不修改原版物品与附魔数据,无加载顺序要求,可与其他模组安全共存。

包名的amassofmud是我的昵称(一团泥浆),但是CurseForge不许这样的昵称通过,我只好使用拼音作为我自己的昵称了。

magicenchant Team

profile avatar
  • 3
    Projects
  • 26
    Downloads

More from YiTuanNiJiang

  • fortunecropfix project image

    fortunecropfix

    Fix the issue where the Fortune enchantment does not work on wheat and beetroot drops.

    • 7
    • November 9, 2026
  • arrowcrop project image

    arrowcrop

    Arrow Crop adds a unique new crop: the arrow crop. Players can plant regular arrows into farmland just like sowing seeds. When fully grown, the crop yields more arrows, offering a renewable way to obtain arrows.

    • 9
    • October 30, 2026
  • fortunecropfix project image

    fortunecropfix

    Fix the issue where the Fortune enchantment does not work on wheat and beetroot drops.

    • 7
    • November 9, 2026
  • arrowcrop project image

    arrowcrop

    Arrow Crop adds a unique new crop: the arrow crop. Players can plant regular arrows into farmland just like sowing seeds. When fully grown, the crop yields more arrows, offering a renewable way to obtain arrows.

    • 9
    • October 30, 2026