mojira.dev
MC-3304

Enchantments from items held in the main hand are applied to other items when entities are killed

The Bug:

Enchantments from items held in the main hand are applied to other items when entities are killed.

Steps to Reproduce:

  1. 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}]
  2. Shoot and kill the husk using the bow.

  3. Look if the looting enchantment on the sword affected the number of items that the husk dropped.

  4. 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

MC-211590 how to make your sword durability no go down but still get loot Resolved MC-206659 Swapping from an Unenchanted Item to an Enchanted Item, applies the enchants to the unenchanted item. Resolved MC-200572 Looting increases loot even when not killing with the enchantment Resolved MC-96143 Bows can have Looting effect Resolved MC-67473 Thorns and looting Resolved
MC-73710 Holding items enchanted with thorns in your hand works as if you were wearing them Resolved MC-73032 When killing a player and quickly switching to a different weapon, the name of weapon in the death message matches that of the one in hand when the player dies. Resolved MCPE-141935 Looting is not applied when a mob is killed with a projectile Resolved MC-187015 Using an item and quickly switching hotbar slots doesn't reduce the durability of the said item Open MC-13518 You can switch fishing rods while the line is still cast Reopened

Attachments

Comments 47

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.

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!

Well, it is very useful, even though it is a bug.

This is a bug that people can take advantage of, so it should be set to private.

37 more comments

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.

Can confirm in 1.21.10

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?

Avoma

(Unassigned)

Confirmed

Platform

Important

Combat, Enchantments, Loot tables

Minecraft 1.4.4, Minecraft 1.4.7, Minecraft 1.5, Minecraft 1.6.1, Minecraft 1.6.2, , 1.21.5, 1.21.6, 1.21.7, 26.2, 26.3

Snapshot 13w26a

Retrieved