Drop item from player?

Discussion in 'Plugin Development' started by Kepler_, Aug 29, 2013.

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

    Kepler_

    How can I drop an item from a player as if the player hit the drop item key? I don't know the location to drop the item from or how to drop the item in the direction the player is facing.
     
  2. Offline

    EdGruberman

  3. Offline

    Kepler_

    That's mostly working. The only problem I'm having is that the item isn't dropping in the right direction.
    Here's my code:
    player.getInventory().setItem(InventoryView.OUTSIDE, toDrop);
     
  4. Offline

    Drkmaster83

    Use the .dropItemNaturally(ItemStack i) method from the World class. You can even store the item in an entity and use all the entity methods (setVelocity(), etc).
     
Thread Status:
Not open for further replies.

Share This Page