1

Help with some commands....

Flashbulb's Avatar Flashbulb12/24/21 12:33 pm
1/2/2022 4:55 am
Silabear's Avatar Silabear
So I am working on a data pack that adds some custom items. I want to make it so that when you where a spider head, you get night vision, but when I put the head on, nothing happens.

The Spider Head Command:
/give @p player_head{SkullOwner:MHF_Spider,display:{Name:'[{"text":"Spider Head","italic":false,"color":"dark_red"}]',Lore:['[{"text":"The head of a spider, which","italic":false}]','[{"text":"grants night vision to the","italic":false}]','[{"text":"wearer.","italic":false}]']},Enchantments:[{id:thorns,lvl:1}],HideFlags:1} 1

The Execute command in "tick":
execute as @a[nbt={Inventory:[{Slot:103b,id:"minecraft:player_head",tag:{SkullOwner:MHF_Spider,display:{Name:'[{"text":"Spider Head","italic":false,"color":"dark_red"}]',Lore:['[{"text":"The head of a spider, which","italic":false}]','[{"text":"grants night vision to the","italic":false}]','[{"text":"wearer.","italic":false}]']},Enchantments:[{id:thorns,lvl:1}],HideFlags:1}}]}] run effect give @s minecraft:night_vision 1 2 true

No errors are given when loading the pack, and the spider head works as it should.
Posted by Flashbulb's Avatar
Flashbulb
Level 48 : Master Fish
88

Create an account or sign in to comment.

3

Silabear
01/02/2022 4:55 am
Level 68 : High Grandmaster Bear
Silabear's Avatar
Give the spider head a tag of CustomHead:1b, then you only have to check for the CustomHead:1b tag.
1
Spuduking
01/02/2022 12:09 am
Level 32 : Artisan Procrastinator
Spuduking's Avatar
Create a predicate that checks for a player head in the head slot. To differentiate between different player heads, use a tag such as CustomModelData.
Heres an example:

{
  "condition": "minecraft:entity_properties",
  "entity": "this",
  "predicate": {
    "equipment": {
    "head": {
    "items": [
    "minecraft:player_head"
    ],
    "nbt": "{CustomModelData:1}"
    }
    }
  }
}
1
WhoAteMyButter
12/27/2021 12:05 am
Level 33 : Artisan Engineer
WhoAteMyButter's Avatar
Don't search for huge tags like that. Use a single custom arbitrary NBT tag and test for that instead.
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome