Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-128897

Durability causes custom item duplication on death

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.19.30.22 Preview, 1.19.30
    • 1.16.221 Hotfix, 1.17.41 Hotfix, 1.18.12 Hotfix, 1.19.11 Hotfix
    • None
    • Confirmed
    • Multiple
    • 748933

      Basically, when you cause the durability to change on a custom item during the player's current life and the player dies, two of the item drops.

      Steps to reproduce:
      1. Download https://mcpedl.com/more-tools-addon/
      2. apply the addon and enable all experiments.
      3. run /give @s sp:emerald_pickaxe
      4. run /gamemode s
      5. break some blocks or hit a mob or player.
      6. run /kill or die somehow
      7. Pickup the items

      Expected Behavior:
      Only one pickaxe drops.

      Observed Behavior:
      Two Identical pickaxes drop.

      The current fix is just removing certain components' children, ie "on_hurt_entity", "on_not_hurt_entity", "on_hit_block", "on_dig", that trigger events that are normally used to create durability since removing the durability event or setting the durability damage to 0 doesn't fix it. fix with notepad++
      hover search then click find in files then select the items folder of behavior pack with the three dots button, click regular expression in search and use the following below with replace in files:
      find(one line)

      "minecraft:weapon": {\n(\s+)("on_hurt_entity": {\n)?(\s+)("event": "\w+"\n)?(\s+)?(},)?\n(\s+)?("on_not_hurt_entity": {\n)?(\s+)?("event": "\w+"\n)?(\s+)?(},\n)?(\s+)?("on_hit_block": {\n)?(\s+)("event": "\w+")?(\s+)?}(\s+)}(,)?
      

      replace(one line)

      "minecraft:weapon": {}$19
      

      find(one line)

      (,\n)?(\s+)?"on_dig": {\n(\s+)?"event": "\w+"\n(\s+)?}
      

      replace(make sure its leave it blank)

            mrpatches123 mrpatches123
            Votes:
            12 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: