You are unable to test for data tags from items that you receive without /give. As an example, I have tested item enchantments. If you use the command
/scoreboard players set @a[score_pickaxe_min=0,score_pickaxe=0] pickaxe 1 {Inventory:[{id:minecraft:diamond_pickaxe,tag:{ench:[{id:32,lvl:1}]}}]}
, it will set player's score of pickaxe to 1 if it isn't already 1 or higher and if the player is holding a diamond pickaxe in their inventory with the enchantment efficiency 1. This command will output the scoreboard command if I /give myself the diamond pickaxe with the enchantment id and level, but if I enchant a diamond pickaxe inside of the enchantment table and place it in my inventory, it will not register the fact that you have the specified data tags.
Linked issues
Comments 5
It's intended : the tag from the give and then enchanting table are different :
give : ench:[{id:32,lvl:1}]
enchanting table : ench:[{id:32s,lvl:1s}]
To fix this, just add the correct tag type for your give and scoreboard command
Nonetheless, the command still cannot differentiate a pickaxe with only efficiency 1 and a pick with efficiency 1 and another enchantment, it will see the 2nd pick the same as the first and still emit the command, even though it only tests for efficiency 1.
It is probably caused by the fact that adding an enchanment to an item with the anvil adds or increases the *RepairCost*
tag. Sadly you cannot compare NBT partial in nested lists or dicts so you need to add this tag and its value to your command as well.
This would probably work then:
/scoreboard players set @a[score_pickaxe_min=0,score_pickaxe=0] pickaxe 1 {Inventory:[{id:minecraft:diamond_pickaxe,tag:{ench:[{id:32s,lvl:1s}],RepairCost:1}}]}
@Max, being able to look through a list and only search for the minimum is intended. Feature requests should be posted to the subreddit.
Please do not mark unreleased versions as affected.
You don't have access to them yet.
--- This action was performed automatically. If you believe this was done in error, please :light_bulb_off: raise an issue.