mojira.dev
MC-305901

The enchantment effect "minecraft:damage" can be bypassed by critical hits even when it's value is 0

NOTES: The video i attached has a small showcase of what happens. The instance is modded but the issue can still be reproduced in vanilla

How to reproduce the issue:
1. Download the datapack in the Attachment
2. Run the command “/give @s netherite_sword[minecraft:enchantments={"bugreport:no_damage":1}]” to give yourself an enchanted sword
3. Deal a critical hit with this sword

Expected result: Nullify any damage coming from that enchanted item
Actual result: Critical hits can bypass the effect

Attachments

Comments 6

Thank you for helping investigate this bug

To answer your questions:

  1. Test with default damage: Yes, when I run the exact /give @s netherite_sword[minecraft:enchantments={"bugreport:no_damage":1}] (no extras), both normal and crit hits deal 0 damage to the zombie. No bypass!

  2. How attack_damage reached 120: I manually added an attribute modifier after giving the sword, using something like /item modify entity @s weapon.mainhand add attribute_modifiers {attribute:"minecraft:attack_damage",operation:"add_value",value:112,uuid:[I;0,0,0,1]} (to bump the default ~8 up to 120 for testing high-damage scenarios). That's why the NBT shows 120—it's not part of the datapack or base /give.

  3. Crit method: Standard jump-fall attack (jump, then swing while descending). Full attack cooldown, confirmed by the green sparkles/particles on hit.

  4. Exact versions:

    • Stable: Java Edition 1.21.11 (title screen: "Minecraft 1.21.11", /version output: "Minecraft 1.21.11")

    • Snapshot: Java Edition 26.1 Snapshot 4 (title screen: "Minecraft Snapshot 26.1-snapshot-4", /version: "Minecraft Snapshot 26.1-snapshot-4")

  5. Normal hit test: Yes, 100% 0 damage on non-crit swings, even with the 120 attribute.

So, the bypass only happens on crits when the base attack_damage is very high (like 120). With default (~8), it's fully nullified. Maybe a floating-point precision issue or overflow in the damage pipeline when crit multiplier hits large numbers before/after the "set 0" effect? The smaller leak in the snapshot (~0.375 vs ~2.25) suggests some calc changes there.

Appreciate the escalation—hope this helps pin it down!

I did not modifier the attack_damage, are you sure it only happens with very high values? May you provide a video? I couldnt understand this at all

Thank you for the follow-up. To clarify the confusion regarding the modified attack_damage:

In my environment (Vanilla 1.21.11), I was unable to reproduce the damage bypass using the standard Netherite Sword values (~8 damage). In my tests, standard values resulted in 0 damage as expected.

To investigate further, I performed stress-testing by manually increasing the base attribute to 120. This was done to determine if the issue is a calculation/precision error. I found that the 'leak' only occurs when the base damage is high, which suggests that the critical hit multiplier ($1.5 \times$) is being applied at a stage in the pipeline where the 'set to 0' logic is being bypassed by floating-point remainders.

While we are seeing different results at base damage levels, the fact that a bypass is possible at higher values confirms a flaw in the logic. I am reporting these findings to help the developers identify exactly where the damage calculation 'leaks' during a critical hit.

Oh! That makes sense but in my instance it happens even with a sword coming from the command.

That’s a great catch! If it’s happening on your end with a regular sword too, it confirms the bug is definitely there at all levels.

In my test on 1.21.11, the 'leak' at 8 damage must have been so tiny that the game rounded it down to 0, which is why I didn't see it at first. I used the 120 damage sword specifically to magnify the error and see if I could force it to show up—and it did.

Since you're seeing it even with a standard sword, it proves the Critical Hit math is definitely bypassing the enchantment's safety check. This is really helpful info for the devs because it shows the problem happens no matter how much damage the sword does. Thanks for checking that!

Thank you for your report!
After consideration, the issue is being closed as Working as Intended.

Please note, that mechanics of the game may change between updates.
Things such as graphics, sounds, world creation, biomes, redstone, villagers, and animals may not work the same in current versions.

Full Version HistorySnapshot Version HistoryThe official Minecraft feedback site

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

Void

(Unassigned)

Confirmed

(Unassigned)

1.21.11, 26.1 Snapshot 4

Retrieved