mojira.dev
MC-28289

Switching items at the same time as attacking carries over the attributes and enchantments of the previously held item

The Bug:

Switching items at the same time as attacking carries over the attributes and enchantments of the previously held item.

Among the PvP community, this is often referred to as “attribute swapping” or “breach swapping”. This bug allows you to perform attacks that shouldn’t normally be possible, therefore giving the player a severe advantage, which is unfair for other players. This works in all game modes, but can more easily be seen in survival due to the durability loss of items.

Steps to Reproduce:

  1. Give yourself some plain wooden axes along with some wooden swords enchanted with fire aspect by using the command provided below.

    /give @s minecraft:wooden_axe 7
    /give @s minecraft:wooden_sword[minecraft:enchantments={"minecraft:fire_aspect":1}] 7
  2. Summon multiple turtles on the ground and switch into survival mode.

  3. Attack a turtle while holding the wooden axe, and as you do this, quickly switch to the enchanted wooden sword.

  4. If the turtle wasn’t set on fire, repeat the above steps.

  5. Observe how the attributes (damage and attack speed) of the wooden axe were used, but the enchantments and durability of the wooden sword were also used.

Observed Behavior:

The attributes of the wooden axe were used, and the enchantments and durability of the wooden sword were also used, and the attack itself was at 100% cooldown charge despite just recently switching items.

Expected Behavior:

The attributes and enchantments of the wooden sword would be used in the attack, and the attack itself should be at 0% charge due to just recently switching items.

Linked issues

Attachments

Comments 21

Confirmed.

Is this still a concern in the latest Minecraft version 14w30c? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

This is still a problem in 14w31a. I've updated the affected version(s) and added more screenshots to confirm.

Reopened, thanks.

Still a problem in 1.8

11 more comments

Can confirm in 24w44a

In addition, the melee attack charging does not reset in time

I tested and checked out the src, finally found out the solution.

The attributes of living entites only refresh when entities' mob effects change or by tick.

So we can refresh players' attributes when they change their selected item.

Please fix swapping with a mace with breach is completely unbalanced

Breach swapping it's the worst thing that can ever happened, barely needs skill and you can almost one shot a player

Avoma

(Unassigned)

Confirmed

Platform

Important

Combat, Items

attribute, hotbar, item, switch

Minecraft 1.6.2, Minecraft 1.7.4, Minecraft 14w31a, Minecraft 1.8.1-pre3, Minecraft 1.8.8, ..., 1.21, 24w44a, 1.21.3, 24w46a, 1.21.4

Retrieved