-
Bug
-
Resolution: Duplicate
-
None
-
1.21
-
None
-
Unconfirmed
-
(Unassigned)
The Enchantment class has an onTargetDamaged method. This method is overridden and implemented solely in the DamageEnchantment class, which is used by Sharpness/Smite/Bane of Arthropods, and applies the Slowness effect from Bane of Arthropods.
In the PlayerEntity class' attack method EnchantmentHelper.onTargetDamaged(this, target); is called.
This consumer then calls the onTargetDamaged method as implemented in each enchantment. When the user is a PlayerEntity however, this happens for both the items equipped (item in hands and armor), and the item in the main hand. As a result, when a PlayerEntity uses a Bane of Arthropods weapon on an Arthropod, the slowness effect gets applied twice. This means the random duration of the effect will also be upgraded if the second random call is higher.
All relevant method definitions included in attachments below.
Confirmed by running with a debugger with a break point on the DamageEnchantment::onTargetDamaged when hitting an Arthropod with a weapon enchanted with Bane of Arthropods.
I hope this was clear and understandable, I know it might be a bit confusing
- duplicates
-
MC-248272 Enchantment::doPostHurt and Enchantment::doPostAttack are called twice for players
- Resolved