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. This also makes it possible to do mace smash attacks with the base damage of other weapons.

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

MC-293621 breach swapping Resolved MC-293624 breach effects can be given to swords, axes and other tools Resolved MC-278104 Attacking or dropping quickly after switching items did not match expectations Resolved MC-278343 Mace cooldown skip Resolved MC-278392 Swapping to an enchanted item during an attack preserves the damage of the first item but can apply the second item's enchantments Resolved

Attachments

Comments 46

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.

Still a problem in 1.8

36 more comments

Still in rc1 despite effects on spears

Can confirm in 1.21.11 rc-1.

Because of this bug, player can use spear to increase the attack range and decrease the cool down after a lunging from spear.

After 1.21.9, player can bind a slot and attack to the same button, so they can ALWAYS TRIGGER this bug. Not only for breach swapping of mace but also increasing attack range from spear that recently added.

This bug may also leads to a strange attack. This attack can be named as the double swapping. This attack contains the attribute and cool down of the first weapon, then add the additional attack range of spear, and finally the enchantment of the third weapon.

Firstly wait the attack cool down completely, then stand 3-4.5 blocks away from the mob. Now player can only reach it through spear rather than sword.

tick 1: Switch to the spear (slot 8).

tick 2: Switch to slot 9 and attack at the same tick. In the first video slot 9 is a diamond sword with sharpness 4. In the second video slot 9 is hand.

In the first video, mob got a crit and lost 11.5 health. (Iron sword crit + Spear attack distance + sharpness 4 = 6*1.5 + 2.5 = 11.5). And only the diamond sword lost 1 durability.

In the second video, mob got a crit and lost 9.0 health. (Iron sword crit + Spear attack distance + Hand without enchantment = 6*1.5 + 0 = 9). And no weapon lost durability.

What is expected: Switching to spear and the third weapon leads the refresh of player’s attributes including the attack cool down, so the attack should be calculated as the 0% charged attack with the item in slot 9, and it will fail because player only has 3 blocks reach distance at this time.

I don’t understand why they’re dragging out the fix for this bug. The longer it stays in the game, the more people get used to it, and then, after it’s fixed, there will naturally be even more complaints. The bug with having a spear in one hand and a mace in the other was fixed almost immediately, but for some reason this one was skipped in the next version. I’m honestly afraid to play modes with spears on servers — it’s complete chaos there! It feels like a completely different game!

Because of this bug, the refreshing of attributes always gets delayed, and the indicator also can’t recognize some different items. By the way, it can be confirmed in 1.21.11 rc-2, 1.21.11 rc-3, 26.1-snapshot 1, 26.1-snapshot 2.

0:00-0:13 Switching between two different items (same name but one has enchantment and the other don’t), the indicator will still keep recharging, and finally player can make a full charged attack. So why the indicator do not reset?

0:14-0:19 Switching between two items, for the next 2 ticks the indicator recharges at the speed of the first item rather than that player holds. This leads to the “shake“ of the indicator. So why it behaves that strange?

I believe some staffs have tried to fix it several months ago but maybe they encountered some difficulties. So this part of aged code is actually in a mess.

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.11 Pre-Release 1, 1.21.11 Pre-Release 2, 1.21.11 Pre-Release 4, 1.21.11 Release Candidate 1, 1.21.11

Retrieved