Mojira Archive
REALMS-11165

Data not working for Hasitem

/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

Duplicate

Jared Chappell

2023-02-19, 10:19 PM

2023-02-19, 10:51 PM

2023-02-19, 10:46 PM

0

0

Unconfirmed

1.19.60 (Bedrock)

-