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 🙂
Linked issues
duplicates 1
Attachments
Comments 5
The dropdown is not letting me submit anything other than 1.21 and tells me the version id is not recognized.
Does MC-248272 describe your issue? The bug tracker only accepts issues that persist in the latest version of the game or the latest snapshot.
yes ampolive it seems i was not thorough enough looking for this bug in previous reports, this can be marked as a duplicate
Are you sure this report is accurate to 1.21? Enchantments were made data-driven in 24w18a, so your code snippet that references hardcoded slowness effects can't be up-to-date