Item Drop At entity event

Discussion in 'Plugin Development' started by Divinity Realms, Feb 7, 2015.

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

    Divinity Realms

    I got this code to work when a player kills a zombie & other mobs
    How can I make it drop a custom item? I know how to make it spawn an entity but just not a item. heres the code:
    Code:
    @EventHandler
        public void money(EntityDeathEvent event)
        {
            //Entity Killed
            Entity deadEntity = event.getEntity();
            //Entity Killer
            Entity killer = event.getEntity().getKiller();
           
            if(killer instanceof Player)
            {
                if(deadEntity instanceof Zombie || deadEntity instanceof Skeleton)
                {
                    deadEntity.getWorld().spawnEntity(deadEntity.getLocation(), EntityType.WITHER_SKULL);
                   
                }
            }
        }
     
  2. Offline

    Lactem

  3. Offline

    TehHypnoz

    If you're going to drop multiple items, I recommend you to use World#dropItemNaturally(), because this drops the items with a random offsets, so the items aren't all dropped on the exact same place.
     
Thread Status:
Not open for further replies.

Share This Page