Get location of an item a player dropped?

Discussion in 'Plugin Development' started by Strahan, Jul 21, 2017.

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

    Strahan

    Hi. If a player drops an item, is it possible to get the location of where it lands? .getLocation called against the PlayerDropItemEvent gets the location of the player that dropped the item, not the actual item floating on the ground.
     
  2. Offline

    Zombie_Striker

    @Strahan
    If you want to predict where it will land, you will have to do some calculations, factoring in drag, gravity, and initial velocity.

    If you just want to know where it lands when it lands, just create a BukkitRunnable when an item is dropped. Every couple of ticks, check if the item isOnGround. If so, return the location.
     
Thread Status:
Not open for further replies.

Share This Page