mojira.dev
MCPE-185833

Custom Item Durability Decreases Faster than it Should when Hitting an Entity

Custom items gain damage when hitting an entity faster than they should - approximately 2 damage per hit instead of one.

Steps to reproduce:

  • Download the add-on attached to this report

  • Apply it to a new world

  • Search in the creative inventory for an item called "Grass Sword" with the texture of an egg

  • This item has a durability of 15 and therefore should withstand 15 hits

  • Try hitting an entity with this item. You will observe that it breaks on the 8th hit.

Expected behaviour:

Custom items should gain one damage per one hit. They are supposed to break after as many hits as is their durability value, specified in the "max_durability" field of the "minecraft:durability" component (assuming the item had not been damaged by other means).

Actual behaviour:

Custom items will break after significantly fewer hits than would be expected given their durability.

Linked issues

Attachments

Comments 4

Can confirm, affects 1.21.60.24.

Thank you for your report!
However, this issue has been closed as Working as Intended.
 
Here is some information from the team that you might find helpful:

On the item, add a custom component:
Building with Custom Components Microsoft Learn

for onBeforeDurability Damage:
minecraft/server.ItemCustomComponent Interface Microsoft Learn

Then in scripting you can modify the durabilityDamage after registering the event:
minecraft/server.ItemComponentBeforeDurabilityDamageEvent Class Microsoft Learn

If you need help or have a suggestion you might like to follow a link below.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

Thank you for your report!
However, this issue has been closed as Working as Intended.
 
Here is some information from the team that you might find helpful:

On the item, add a custom component:
Building with Custom Components Microsoft Learn

for onBeforeDurability Damage:
minecraft/server.ItemCustomComponent Interface Microsoft Learn

Then in scripting you can modify the durabilityDamage after registering the event:
minecraft/server.ItemComponentBeforeDurabilityDamageEvent Class Microsoft Learn

If you need help or have a suggestion you might like to follow a link below.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

KZBMM

(Unassigned)

1359235

Community Consensus

Multiple

add-on, custom-item, durability

1.21.20, 1.21.21 Hotfix

Retrieved