The Bug:
Enchantments from items held in the main hand are applied to other items when entities are killed.
Steps to Reproduce:
Summon a husk, hold a bow in your offhand, and a sword enchanted with a high level of looting in your main hand, by using the commands provided below.
/summon minecraft:husk ~ ~ ~ {NoAI:1b}/item replace entity @s weapon.offhand with minecraft:bow/item replace entity @s weapon.mainhand with minecraft:diamond_sword[enchantments={"minecraft:looting":100}]Shoot and kill the husk using the bow.
Look if the looting enchantment on the sword affected the number of items that the husk dropped.
Take note as to whether or not enchantments from items held in the main hand are applied to other items when entities are killed.
Observed Behavior:
Enchantments are applied to other items when entities are killed.
Expected Behavior:
Enchantments would not be applied to other items when entities are killed.
Potential Fix:
A potential fix by @unknown can be found in this comment.
Linked issues
is duplicated by 16
relates to 8
Attachments
Comments 47
Correct, Chalmes, this is where I saw the bug from!
I didn't see anyone reporting it, so I reported it!
I was pretty sure that 1.4.6 Pre-Release would come either way!
The sooner these bugs are fixed the sooner I will get to play with my mods!
It doesn't matter if we have to get to Minecraft 1.4.10+ for that, as long as we get there faster!
It's only a feature when Mojang says it's a feature, and that it has beentriaged actually speaks against that.
Old issue != by design.
Still in 26.2-snapshot-4, which means this bug has never been fixed.
The code of components and attributes system are actually in a mess since MC 1.0. As the result, mainhand item components(including all the enchantments) are not compatible with attacking attributes. It’s absolutely no reason to regard it as a feature.
According to some other related tickets, this massive problem also relates to other attribute-components bugs like MC-28289 and MC-272517.
This video reproduces this bug and show the bow with looting 255.
This bug still in the newest version 26.2-snapshot-7.
Besides, this bug can apply breach enchantment to offhand-spear-charging attacks. However, breach can’t be applied on spear in normal situations.
I use /attribute to give zombie 30 armor points. Same charging speed but completely different damage:
Normal charging: 1.4 health ; Spear in offhand and breach 4 mace in mainhand: 5.6 health
I don’t know why it seems that nobody cares about resolving these over 10 years old issues in any snapshot update. Is the label “priority: important“ really works as a decoration?
It also works if a mob is killed by a normal arrow (no flame effect) and you switch to a looting sword fast enough, and even works on deflected ghast fireballs (you can even deflect the fireball directly with the sword). It happens because the game checks the item you are holding at the time the mob dies, rather thank the item you killed the mob with.