1

Command block issues

RoseWarrior 2/8/19 11:21 pm
308
2/18/2019 5:54 pm
Ok I am wanting to execute according to a item in a certain slot (in this case 102 or chestplate) with a certain tag

I understand that you can have

/execute as @a[nbt={Inventory:{Slot:102b,id:"minecraft:iron_chestplate"}]}]

but this will cause it to execute according to all iron chestplates that you wear
and I know you can do


/execute as @a[nbt={SelectedItem:{tag:{spec:Fun}}}]


But this means you have to have it in your hand is there anyway to combine the two into a single command?
Posted by
RoseWarrior
Level 15 : Journeyman Bear
0

  Have something to say?

JoinSign in

8

SUPERIONtheKnight
02/18/2019 5:54 pm
Level 30 : Artisan System
I know this is a little late, but hopefully it is helpful anyways.
/give @s iron_chestplate{spec:Fun}
/execute if entity @a[nbt={Inventory:[{Slot:102b,id:"minecraft:iron_chestplate",Count:1b,tag:{spec:Fun}}]}]
~SUPERIONtheKnight
1
TheDiamondPlayables
02/09/2019 10:05 pm
Level 84 : Elite Programmer
history
When the item is added into the player's inventory, it simultaneously removes the item's tag.
I'd suggest you adding a special name to the item instead as it keeps the name, and work it from there.
You can color code the item name so that it is special, making it the only item that can be checked.
1
RoseWarrior
02/10/2019 2:41 pm
Level 15 : Journeyman Bear
The problem with this is a item could completely break if you rename it so whats the point of a tag if its just instantly removed
1
Roroo
02/09/2019 4:31 am
Level 44 : Master Pig
history
Let me get this straight.. You're trying to execute a command on a player wearing an iron chestplate and not other people also wearing the same chestplate?

If that's the case, try giving the chestplate a special name. That might make the player special, and add the itemname to the execute command.

Perhaps that works?
1
RoseWarrior
02/09/2019 5:52 pm
Level 15 : Journeyman Bear
history
What I am trying to do is execute according a chestplate with a tag when it is worn and that's the only time

/execute as @a[nbt={Inventory:{Slot:102b,tag:{spec:Fun}}}] run say hi

is what I attempted and several varients of it but I am not getting it
1
Greystalk
02/09/2019 1:51 am
Level 46 : Master Ranger
Try this.

/execute as @a[nbt={Inventory:{Slot:102b,tag:{spec:Fun}}}]
1
RoseWarrior
02/09/2019 9:32 pm
Level 15 : Journeyman Bear
did not work for me but maybe I did something wrong with the item?
1
Greystalk
02/10/2019 1:29 am
Level 46 : Master Ranger
maybe, sorry it didn't work. I didn't have time to test it.
1

Welcome