[GH-ISSUE #4776] Melee damage is 1.0 + the item's damage instead of the minecraft:attack_damage attribute #1445

Closed
opened 2026-11-02 15:47:00 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @sirrayi on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4776

🤖 Filed by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi themselves.

What happens

Melee damage is computed as 1.0 + the held item's attack damage instead of from the minecraft:attack_damage attribute, so nothing that changes that attribute changes damage: /attribute <player> minecraft:attack_damage ..., and any modifier applied to it by a command, a datapack or an effect.

  • crates/horizon-client/src/game.rs:9529 — hand_damage (and again in game/mace.rs:426, game/spear.rs:308) builds the damage from the item.
  • Vanilla Player.attack reads this.getAttributeValue(Attributes.ATTACK_DAMAGE).

The attribute map is already live and already carries the held item: 29363ee3e ("Apply the held item's main-hand modifiers to the player's attributes", fixes #4118) writes the item's modifiers into it, and /attribute ... get reports them. So the two readers disagree: the map says one thing, the damage says another.

Why it is narrow but real

With no other modifier the two agree (base 1.0 plus the item's modifier), which is why ordinary play looks right. They diverge as soon as anything else touches the attribute — a /attribute ... modifier add, a Weakness-style effect, an item whose modifier is not the one the port special-cases — and then the damage silently ignores it. #4557 (attribute attack speed) and #3182 (attribute swapping) are reports in this same area.

Suggested fix

Read the attribute in hand_damage (the map is already there, and main_hand_attack_speed in game/hand.rs:518 already does exactly this for speed, so the shape exists next door), keep the item path as the fallback when the attribute is absent, and add a unit test that a modifier on minecraft:attack_damage moves the dealt damage. tools/test_attribute_parity.py and tools/test_live_attribute_updates_parity.py are the harnesses to extend.

Found while triaging #4557 and #3182; it is a separate defect from either report and they may be what those reporters actually meant.

Originally created by @sirrayi on GitHub (Oct 30, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4776 > 🤖 Filed by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi themselves. **What happens** Melee damage is computed as `1.0 + the held item's attack damage` instead of from the `minecraft:attack_damage` attribute, so nothing that changes that attribute changes damage: `/attribute <player> minecraft:attack_damage ...`, and any modifier applied to it by a command, a datapack or an effect. - `crates/horizon-client/src/game.rs:9529` — `hand_damage` (and again in `game/mace.rs:426`, `game/spear.rs:308`) builds the damage from the item. - Vanilla `Player.attack` reads `this.getAttributeValue(Attributes.ATTACK_DAMAGE)`. The attribute map is already live and already carries the held item: `29363ee3e` ("Apply the held item's main-hand modifiers to the player's attributes", fixes #4118) writes the item's modifiers into it, and `/attribute ... get` reports them. So the two readers disagree: the map says one thing, the damage says another. **Why it is narrow but real** With no other modifier the two agree (base 1.0 plus the item's modifier), which is why ordinary play looks right. They diverge as soon as anything else touches the attribute — a `/attribute ... modifier add`, a Weakness-style effect, an item whose modifier is not the one the port special-cases — and then the damage silently ignores it. #4557 (attribute attack speed) and #3182 (attribute swapping) are reports in this same area. **Suggested fix** Read the attribute in `hand_damage` (the map is already there, and `main_hand_attack_speed` in `game/hand.rs:518` already does exactly this for speed, so the shape exists next door), keep the item path as the fallback when the attribute is absent, and add a unit test that a modifier on `minecraft:attack_damage` moves the dealt damage. `tools/test_attribute_parity.py` and `tools/test_live_attribute_updates_parity.py` are the harnesses to extend. Found while triaging #4557 and #3182; it is a separate defect from either report and they may be what those reporters actually meant.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1445
No description provided.