Trying to detect when a player has a certain helmet on their head



  • I want to make a helmet that, when placed on a users head, gives them Night Vision. But for some reason I am having a hard time figuring this out, it seems that it is unable to detect custom tags which is weird because I have had no issues with this whatsoever in the past, but I am a tad bit rusty so it's probably something simple that I have just forgotten.

    My code is as follows:

    execute as @e[nbt={Inventory:[{Slot:103b,id:"minecraft:leather_helmet",tag:{NVG:1b}}]}] run effect give @s minecraft:night_vision
    

    I found the issue, the give command I was using:

    /give @s leather_helmet{tag:NVG}
    

    does not work, does anyone know the proper syntax for this command?



  • I was stupid, apparently when tagging items with the /give command you do not need to specify tag:

    The correct command for this would be /give @s leather_helmet{NVG:1b}



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2