Uploaded image for project: 'Minecraft Realms'
  1. Minecraft Realms
  2. REALMS-11165

Data not working for Hasitem

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.19.60 (Bedrock)
    • None
    • Unconfirmed
    • Bedrock

      /give @s diamond_sword 1 50
      The above command will yield a Diamond Sword with minus 50 durability.

      /clear @s diamond_sword 50 1
      The above command removes a diamond sword with minus 50 durability from the wielder if the wielder has one.

      /clear @s[hasitem=

      {item=diamond_sword,data=50}] diamond_sword 50 1
      The above command SHOULD remove a diamond sword with minus 50 durability from the wielder if the wielder has one. However it does not because "[hasitem={item=diamond_sword,data=50}

      ]" will return false no matter what.

      An example of a practical use for this would be:
      /replaceitem entity @a[hasitem=

      {item=iron_sword,data=0,location=slot.weapon.mainhand}

      ] slot.weapon.mainhand 0 diamond_sword 1 0
      This would make it so that if a player fully repairs an iron sword, it would transform into a diamond sword. My applications are more complex, but even basic things such as this are undoable with the current Data function not behaving within the hasitem condition

            Unassigned Unassigned
            Fatebringer229 Jared Chappell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: