How to create explosive arrow that fires upon command, that takes the path of a snowball?

I.e. if I type /firearrow, I want:

  1. An arrow to be shot in the direction I’m looking at, and take the path of a snowball.
  2. The arrow should have particles surrounding it as it flies through the air.
  3. The arrow, upon landing, should explode a few blocks around it (maybe TNT style?) and do damage to a player.

Specifically, I’m not sure how to do #1 and #2. For #1, my guess is that I would actually fire a snowball using player.launchProjectile(Snowball.class), and somehow disguise it as an arrow? Also (to achieve #2), how does one “track” the projectile fired by a player, so that I can spawn particles around it?

Thank you :slight_smile:

  1. spongeWorld.createEntity(EntityTypes.TIPPED_ARROW, playerPos); After this you can try and .setVelocity() for speed/direction

  2. For that you need to listen to the MoveEntityEvent, which I think gets called by arrows as well. In there you have to check if the entity is an arrow and ALSO your firearrow.

  3. Same as above, but you got to listen to the CollideEvent.Impact

My 3 proposals anyway, not sure if there’s a better way to go over this.

EDIT: I think you can also just use the launchProjectile() that you described yourself with the entityArrow you’d create in #1.

1 Like