1
Command block issues
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
But this means you have to have it in your hand is there anyway to combine the two into a single command?
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?
Create an account or sign in to comment.
8
1
I know this is a little late, but hopefully it is helpful anyways.
~SUPERIONtheKnight
/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
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.
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
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
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?
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
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
/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
Try this.
/execute as @a[nbt={Inventory:{Slot:102b,tag:{spec:Fun}}}]
/execute as @a[nbt={Inventory:{Slot:102b,tag:{spec:Fun}}}]
1
did not work for me but maybe I did something wrong with the item?
1
maybe, sorry it didn't work. I didn't have time to test it.