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:
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
Summon multiple turtles on the ground and switch into survival mode.
Attack a turtle while holding the wooden axe, and as you do this, quickly switch to the enchanted wooden sword.
If the turtle wasn’t set on fire, repeat the above steps.
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
is duplicated by 9
relates to 2
Attachments
Comments 21
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.
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.
Confirmed.