We're going to use the fact that you are checking for boots to our advantage, since boots are not stackable and there can normally only be 0 or 1 item in that slot.
Set up a dummy scoreboard objective called boots
and run the following two Commands on a setblock/fill clock.
scoreboard players set @a boots 0
scoreboard players set @a boots 1 {Inventory:[{Slot:100b,Count:1b}]}
For example, you can use a setup like this one.
This will set the boots
score to 1 for everyone having exactly one item in their foot inventory slots. From there, you can use @a[score_boots=0]
to detect barefoot players.
A general answer for every inventory slot is more difficult, because checking for Count:0b
does not work, since for the game, "no item" is different from "0 items of any kind".
You are missing the coordinates for the /summon
command:
/summon <entity> X Y Z {dataTags}
One very minor issue is the use of quotation marks around the value for Amplifier
, which causes it to have a tag-type of String rather than the numerical tag-type it's looking for (specifically Byte, though with /summon
it can be declared as any numerical type). The tag is essentially ignored, but since it's intended to be 0, it doesn't matter as that's the default.
Fixed command:
/summon Creeper ~ ~1 ~ {Fuse:1,ActiveEffects:[{Id:14,Amplifier:11,Duration:10000,ShowParticles:0b},{Id:7,Amplifier:"0",Duration:10000,ShowParticles:1b}],Attributes:[{Name:generic.maxHealth,Base:2}],Silent:0,Riding:{id:"FallingSand",Riding:{Fuse:1,id:"Creeper",ActiveEffects:[{Id:7,Amplifier:0,Duration:10000,ShowParticles:0b},{Id:14,Amplifier:0,Duration:10000,ShowParticles:0b}],Attributes:[{Name:generic.maxHealth,Base:10}],Riding:{id:"FallingSand",Riding:{Fuse:1,id:"Creeper",Attributes:[{Name:generic.maxHealth,Base:10}],ActiveEffects:[{Id:7,Amplifier:0,Duration:100000,ShowParticles:0b},{Id:14,Amplifier:0,Duration:10000,ShowParticles:0b}],Riding:{id:"FallingSand",Riding:{Attributes:[{Name:generic.maxHealth,Base:10}],id:"Creeper",Fuse:1,ActiveEffects:[{Id:7,Amplifier:0,Duration:100000,ShowParticles:0b},{Id:14,Amplifier:0,Duration:100000,ShowParticles:0b}],Riding:{id:"FallingSand",Riding:{ActiveEffects:[{Id:7,Amplifier:0,Duration:10000,ShowParticles:0b},{Id:14,Amplifier:0,Duration:10000,ShowParticles:0b}],id:"Creeper",Attributes:[{Name:generic.maxHealth,Base:10}],Fuse:1,Riding:{id:"FallingSand"}}}}}}}}}}
Best Answer
Like I wrote in my comment, the process is pretty similar to putting the item NBT into anything else. Except that in this case you already did most of the work. The only thing left is putting it into the "
tag
" tag:/replaceitem entity @p[nbt={SelectedItem:{id:"minecraft:crossbow",tag:{Charged:0b}}}] weapon.mainhand crossbow{ChargedProjectiles:[{id:"minecraft:firework_rocket",Count:1b,tag:{Fireworks:{Flight:2,Explosions:[{Type:3,Flicker:1,Trail:1,Colors:[I;11743532],FadeColors:[I;15790320]},{Type:4,Flicker:1,Trail:1,Colors:[I;4312372,15790320]}]}}}],Charged:1b}
Also note that this command does not work before the first usage of the crossbow, because the
Charged
tag does not exist at all. To fix this, you can replace the selector with this one:@p[nbt={SelectedItem:{id:"minecraft:crossbow"}},nbt=!{SelectedItem:{tag:{Charged:1b}}}]