1

So I have a scoreboard but I want it to make sure it only detects a certain item which is named and enchanted but I keep getting this error:

[22:35:51] The dataTag does not match for 6b9d7006-4945-46d3-92a3-1d183c1f666d

My current commands:

/scoreboard players add @e[type=Item] nightVeil 1 {Item:{tag:{display:{Name:"Night's Veil",ench:[{id:22,lvl:1}]}}}}
/execute @e[type=Item,score_nightVeil_min=1,score_nightVeil=1] ~ ~ ~ /execute @e[r=1] ~ ~ ~ /effect @p minecraft:invisibility 45 0
/kill @e[type=Item] {Item:{id:"minecraft:leather_chestplate"}}

Also for the last command I want it too also delete this certain Item but I can't find a way to do so.

5

The error message might not be too useful since, when receiving it via a command block, it only concerns the last iteration of the command. In this case, the last item entity that had its NBT data checked. If the item you want found is indeed found, but there's another item lying around somewhere that's next in line to check, the error is going to be about that incorrect item even though the command was actually successful.

That being said, the id and lvl tags for enchantments have the datatype "short", assuming that you're targeting an item that was enchanted normally or provided to the player with the correct datatypes. As well, the ench tag itself does not go inside the display compound.

You might also run into an issue by adding 1 to its score instead of setting their score to 1. If the other commands are not run in the same tick after /scoreboard runs, then the score might end up being set to 2 or higher, and thus will never be found later on.

/scoreboard players set @e[type=Item] nightVeil 1 {Item:{tag:{display:{Name:"Night's Veil"},ench:[{id:22s,lvl:1s}]}}}

You do not need a nested /execute command, especially one that targets all entities and not just the player you're trying to target. Just move the parameters into the selector in /effect.

/execute @e[type=Item,score_nightVeil_min=1,score_nightVeil=1] ~ ~ ~ /effect @p[r=1] minecraft:invisibility 45 0

/kill does not support NBT data. If you were intending to target the item from before, you can target it based on its score you had already given it:

/kill @e[type=Item,score_nightVeil_min=1,score_nightVeil=1]

If you were intending to target a different item altogether, you need to give it a score of its own based on its NBT data and then /kill based on its score, just as you've done already.

4
  • 1
    "ench" does not go inside the "display" compound.
    – Pepijn
    Sep 1 '17 at 16:44
  • @Pepijn Oops, didn't catch that, thanks!
    – Skylinerw
    Sep 1 '17 at 19:11
  • Won't the data types get set to what they're supposed to be when using a custom command? I thought if it's specified as short it'll always be a short, even if you supply an int or long.
    – MBraedley
    Sep 1 '17 at 23:18
  • @MBraedley Not with item data (within the tag compound). Providing an item via /give ... {ench:[{id:1,lvl:1}]} will have both id and lvl declared as integers and will remain integers, while enchanting an item directly will set those values to shorts (and thus remain as shorts). Detecting that item later on would require you to use the matching datatype depending on how the data was created. This is also why it's a good idea to supply the correct datatypes via /give and whatnot so that they match up with normal circumstances.
    – Skylinerw
    Sep 2 '17 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.