Change speed of Fireball upon changing its direction

Discussion in 'Plugin Development' started by Irantwomiles, Dec 23, 2019.

Thread Status:
Not open for further replies.
  1. Offline


    I am spawning a Fireball entity at a location and changing its direction to go towards a player, however the fireball speeds up a lot and I can't figure out how to slow it down. Here is what I have tried so far.

    Location location = new Location(player.getWorld(), -268, 75, 84);
                Vector vector = player.getLocation().toVector().subtract(location.toVector()).normalize();
                Fireball fire = (Fireball) location.getWorld().spawn(location, Fireball.class);
    Here is a gif of the fireball for reference.

    Edit: In case you are not familiar with fireball entity, you can not set the velocity.
  2. Offline


  3. Offline


    I had actually looked at that post, the thing is I'm not launching from a player, but rather a Location. I did fix my issue, but I dont like the method. I had to use #setVelocity() instead of #setDirection(), but the bad part is that I have to constantly update the if I want to to keep going in the direction that I want. I believe the velocity is updated frequently for fireballs on the server side so I need to keep overriding it.
  4. Offline


    Fireball is still a Projectile either way.

    Seems like a hacky way but, if it works it works i guess. :7
    Though if you're using a runnable for this, i think i'd be better to have 1 runnable for all the fireballs instead of 1 for each fireball. (I'm no expert on performance though)
  5. Offline


    Yea I did do that. Though I don't like how I have to update it every 1/20 of a tick.
Thread Status:
Not open for further replies.

Share This Page