In your NBT, item should be Item and firework_star should be minecraft:firework_star, since NBT matching is case-sensitive and needs to exactly match how it's stored.

@e[nbt={Item:{id:"minecraft:firework_star"}}]

Next, it's important to understand the difference between the as and at execute subcommands:

  • at runs the command where an entity is, with its rotation, and in its dimension.
    E.G: execute at @a run setblock ~ ~ ~ stone sets a stone block at everyone
  • as doesn't change the position/rotation/dimension, just who's running the command.
    E.G: execute as @a run say @s makes everyone say their own name

In general you'll only need one or the other, depending on whether you need to change the command position or executor.


In your case, you want to get the closest player to the firework star, so you should be executing at it (since you're finding the closest player to its position), and then you want to execute at the player so that ^ ^ ^4 uses their position/rotation.

The following commands should work:

execute at @e[type=item,nbt={Item:{id:"minecraft:firework_star"}}] at @p run summon minecraft:evoker_fangs ^ ^ ^4

I also added a type=item for performance, since NBT-checking every entity in the world (presumably every tick) is laggy. If this is some kind of throw-ability, it would be even more efficient to add an objective that keeps track of when a player drops the firework star:

/scoreboard objectives add DroppedFWStar dropped:firework_star

Then you can use the following to activate the ability:

execute at @a[scores={DroppedFWStar=1..}] run summon minecraft:evoker_fangs ^ ^ ^4

And set the score back to 0 afterwards.