Make it look like a player drops an item

Discussion in 'Plugin Development' started by Clavus, Feb 18, 2012.

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

    Clavus

    I've got a virtual currency that can be 'dropped' (represented as ender pearls) by typing a chatcommand. Right now I use player.getWorld().dropItem(player.getLocation(), dummyItemStack) to do this. This makes the stack of ender pearls drop at the player's feet.

    What I want to do is have it look like they actually throw it, like when pressing Q when you've got something in your hand. This should also prevent players from instantly picking up the stack that was created at their location. However I don't know how I'd to go about doing this, I can't seem to find any functions for it. Any pointers?
     
  2. Offline

    Njol

    This will throw the item in the direction the player is facing:
    Code:java
    1. Item dropped = player.getWorld().dropItem(player.getLocation(), dummyItemStack);
    2. dropped.setVelocity(<speed> * player.getLocation().getDirection().normalize());

    (You might have to find minecraft's default value for the speed, but maybe it's simply 1)
     
    Feindbild likes this.
Thread Status:
Not open for further replies.

Share This Page