Item particles

Discussion in 'Plugin Development' started by SuitedSlime, Jun 9, 2013.

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

    SuitedSlime

    Hello,

    Is it possible to spawn 'item particles'?

    I basically want to spawn bones and red-dye when a player is killed in a particle-like fashion, meaning you can't actually pick them up and they will dissipate after a short amount of time. I know how to spawn the already existing particles, but as for 'custom' particles. I'm not sure.

    Regards,
    Rob
     
  2. Offline

    Hoot215

    By 'item particles' I assume you mean fake item drops. The best way to do this would probably be to drop the items naturally, add them to a Set of items that can't be picked up, and in the PlayerPickupItemEvent, cancel the event if the item they're trying to pick up is in the Set. You'll probably want to use a Set created from a WeakHashMap to avoid memory leaks.
     
  3. Offline

    Conarnar

    Code:
    Item item = entity.getWorld().dropItemNaturally(entity.getLocation(), new ItemStack(/*Material of dropped item*/, 1, /*damage of dropped item*/));
            item.setTicksLived(6000 - /*how many ticks you want it to stay*/);
            item.setPickupDelay(Integer.MAX_VALUE);
     
  4. Offline

    chasechocolate

    Hoot215 another way to cancel pickup would be to use item.setPickupDelay(Integer.MAX_VALUE).
     
  5. Offline

    Hoot215

    Huh... I had no idea that method existed. Nice find.
     
Thread Status:
Not open for further replies.

Share This Page