Replace empty crossbow with custom firwork loaded crossbow?
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}}}]