Solved Faster Runnable

Discussion in 'Spigot Plugin Development' started by SmokingIsBadMkay, May 1, 2017.

  1. Is it possible to create a BukkitRunnable fast than 1 tick? If not is there another way to do something on the moveEvent of an Arrow?
     
  2. What are you attempting to make, an arrow trail? There may be a better way to do it


    Sent from my iPhone using Tapatalk
     
  3. Yes. I actually already have a system for arrowtrails and that works great. However, I'm trying to create a trail for a custom entity now of which I multiplied the velocity with 8. Its a bullet used for my gun. But the delay used for the arrowtrail is too slow, you barely see the particles.
     
  4. 1 tick is too slow? 1 tick is the rate the game updates at. You can't have it any faster than that?
     
  5. NathanWolf

    Supporter

    On each tick, track the location of your projectile. After the first tick, look at the current location and your tracked location. Draw a line of particles between those two locations, then you can pick exactly how far apart you want the particles in your trail to be.
     
    • Winner Winner x 1
    • Useful Useful x 1
  6. Smart.. How would I get the locations between the tracked location and the actual arrow location?

    Thank you!
     
  7. I know how to get the distance between the tracked location and the arrow, but I don't know how to get all locations between those 2 locations.
     
  8. NathanWolf

    Supporter

    Use the arrow's direction (Location.getDirection), multiply it by however many blocks you want between each particle (can be a fraction of a block), then add that to the first location. Keep adding it and spawning particles until you've added it enough times to cover the distance between the two locations.
     
    • Useful Useful x 1
  9. Thank you! Going to try that, marking thread as solved for now.
     
    • Like Like x 1