PlayerEx

PlayerEx

5M Downloads

Negative attack speed

D4remoon opened this issue ยท 2 comments

commented

Doesn't seem to affect the actual weapon stat, just the text.
image

commented

Hi there,
Your observation is correct, only the text is affected - this is the correct behaviour. Allow me to go on a minor tangent to better explain why:

Assume a scenario where I have not modified the tooltips at all (i.e. green text). When you hover over a netherite sword, it displays this:

When in main hand:
    1.6 Attack Speed
    8 Attack Damage

The values on the tooltip refer to how much Attack Speed and Attack Damage you will have when you hold the weapon in your main hand. Now level up and skill four points in Strength; this increases your Attack Damage by 1 (4 x 0.25 = 1). You'll notice that when hovering over the netherite sword again, it displays exactly the same numbers - where it should now show 9 Attack Damage, it is still showing 8.

This is because weapon tooltips are poorly coded in minecraft and don't natively reflect the player's true attack speed/damage if they have modifiers attached. I've fixed this with PlayerEx and allowed the player to choose between two solutions, or to just leave the tooltip broken:

DEFAULT Leaves the tooltip unchanged/broken (so if you had 100 attack damage the sword would still display 8)
VANILLA Fixes the tooltip in the vanilla style (i.e. with green text) and just makes it so that the numbers shown are the total values the player has when holding the weapon (like it's supposed to).
PLAYEREX Fixes the tooltip in the vanilla modifiers style (i.e. with blue and red text) and makes it so that the numbers shown are the change in attribute value when holding the weapon. Think of a chestplate: it might show +5 Armor, and when you put it on it adds 5 armor. This is the same thing.

So in the pictures you have, the PLAYEREX style solution is being used and the netherite sword has:

When in main hand:
    -2.4 Attack Speed
    +7 Attack Damage

When you hold the sword, it is subtracting 2.4 Attack Speed and adding 7 Attack Damage. This works out the same knowing your base Attack Speed is 4.0 and your base Attack Damage is 1.0.

4.0 - 2.4 = 1.6 Attack Speed
1.0 + 7.0 = 8.0 Attack Damage

So what is happening is the tooltip here is displaying the item's modifiers, not your total value. I realise this is a long winded way to say "it's supposed to show that".
I hope that helps, thanks.

commented

Damn, that's pretty interesting. Thanks for the explanation!