Minecraft – player head detection problem

minecraft-commandsminecraft-java-edition

/scoreboard players tag xXElite_PythonXx add skull {Inventory:[{Slot:103b,id:"minecraft:skull",damage:3,tag:{SkullOwner:xXElite_PythonXx},{Unbreakable:1,display:{Lore:[_____]},ench:[{id:0,lvl:31073},{id:7,lvl:31073},{id:4,lvl:31073},{id:3,lvl:31073}]}}]}

This command is supposed to execute the "skull" tag when I wear a player head, but instead it says

[15:00:59] commands.scoreboard.players.tag.tagError

I'm not sure what's wrong. Can anyone help me fix my command?

Best Answer

The SkullOwner string is replaced with a SkullOwner compound. You cannot the string for detection as a result.

You're detecting a root item tag called "damage" declared as an integer, which doesn't exist. The correct tag is "Damage" (as tags are case-sensitive) and the datatype is short.

Enchantment IDs and levels are normally stored as a short, and item data you provide is typically not auto-corrected and will remain integers as you've defined. You should declare them as short instead, so that any detection method you're using to detect enchantments will work for every method of application.

And finally, you have also closed the tag compound, and then opened an unnamed compound after it, breaking syntax.


What you should do instead is assign a custom tag to the item being provided, and then detect that item based solely on the custom tag. That way you don't have to fiddle with detecting every single tag on the item, which will break if you need to change any of that data.

For example, the following provides an item with a custom byte tag called SKULL with a value of 1.

/give @p minecraft:skull 1 3 {SKULL:1b,SkullOwner:"xXElite_PythonXx",Unbreakable:1b,display:{Lore:["_____"]},ench:[{id:0s,lvl:31073s},{id:7s,lvl:31073s},{id:4s,lvl:31073s},{id:3s,lvl:31073s}]}

And the following labels the player if they have it in their inventory:

/scoreboard players tag xXElite_PythonXx add skull {Inventory:[{Slot:103b,tag:{SKULL:1b}}]}

Then you can go back and modify the /give command as you'd like without changing /scoreboard (provided you do not modify SKULL).