mojira.dev
MC-196250

Attack Damage in weapon description is not calculated from modified base damage attribute, unlike attack speed

Description:
This issue relates to item tooltips. If an item has the attack_damage and attack_speed attribute modifiers with the add operation, and the attribute IDs are minecraft:base_attack_damage and minecraft:base_attack_speed, respectively. The tooltip will display the player’s total attack_damage and attack_speed values in green text (without the + symbol), just like any vanilla combat item.
However, the attack_damage tooltip value does not use the player’s actual stats for calculation.

Steps to Reproduce:

  • Run the following commands:

/attribute @s minecraft:attack_damage base set 10
/attribute @s minecraft:attack_speed base set 10
  • Give yourself an item with attack_damage and attack_speed attribute modifiers, using the minecraft:base_attack_damage and minecraft:base_attack_speed IDs:

/give @a minecraft:stone_sword[attribute_modifiers=[{type:attack_damage,amount:5,id:"minecraft:base_attack_damage",operation:add_value},{type:attack_speed,amount:-5,id:"minecraft:base_attack_speed",operation:add_value}]]
  • Check the item’s tooltip.

  • Check the attribute values with:

/attribute @s minecraft:attack_damage get
/attribute @s minecraft:attack_speed get
  • Compare the results from the commands with the tooltip shown on the item.


Expected Result:

  • Total attack_damage = 15 (10 base + 5 item modifier), confirmed by the /attribute get command.

  • Total attack_speed = 5 (10 base – 5 item modifier), confirmed by the /attribute get command.


The tooltip should display the player’s actual total attack_damage (in this case, 15), consistent with how the attack_speed tooltip correctly reflects the real value with modifiers applied.


Observed Result:

  • The tooltip for attack_damage displays 6, calculated as 1 (hardcoded base) + 5 (modifier).

  • It ignores the player’s actual base attribute value.

  • The attack_speed tooltip is displayed correctly (in this case, 5).


Notes:
This behavior is inconsistent. If the tooltip is intended to represent only the weapon’s damage, there is no reason to include the hardcoded 1. Otherwise, it should correctly calculate and display the player’s total attack damage with the item equipped.

Linked issues

Attachments

Comments 22

MC-113552 relates to items with custom modifiers (Acquired via commands) displaying those modifiers instead of the player's actual stats. This issue relates to unmodified vanilla items (Acquired via Survival gameplay or Creative Inventory) displaying incorrect values, specifically the Attack Damage attribute.

How do you know a wooden sword does 3 damage instead of 4?

Players have a base Attack Damage of 1, this is why you can punch mobs with a bare hand and deal 1 damage. With a Wooden Sword, players deal 4 damage. 4 - 1 = 3, so a Wooden Sword adds 3 Attack Damage.

12 more comments

Can confirm in 21w13a.

Can confirm in 1.17.

Can confirm in 1.19.3 and 23w06a

Affects 1.20.6 and 24w18a:

[media]

Related to MC-134575

@IrL1ne You are now the reporter of this issue.

IrL1ne

(Unassigned)

Confirmed

(Unassigned)

attributes, item-description

1.16.1, 20w30a, 20w51a, 21w03a, 1.16.5, ..., 21w13a, 1.17, 1.21.4, 1.21.8, 25w33a

Retrieved