Solved Custom mob drops problem

Discussion in 'Spigot Plugin Development' started by redstonebiten, May 19, 2016.

Thread Status:
Not open for further replies.
  1. For some reason CaveSpider and Spider interact with each other?

    Cavespider drops spider head and cavespider head but spider only drops spider??

    Code:
    Code (Text):
        //CaveSpider
        @EventHandler
        public void CaveSpider(EntityDeathEvent event){
            Configuration config = configGetter.getConfig();
            if(config.getBoolean("CaveSpider")){
            ItemStack head = new ItemStack(Material.SKULL_ITEM,1,(short)3);
            SkullMeta meta = (SkullMeta) head.getItemMeta();
            meta.setOwner("MHF_CaveSpider");
            meta.setDisplayName("CaveSpider Head " + config.getString("PerCaveSpiderHead") + "$");
            head.setItemMeta(meta);
            if(event.getEntity() instanceof CaveSpider){
                event.getDrops().add(head);
            }
            }
        }
        //Spider
        @EventHandler
        public void Spider(EntityDeathEvent event){
            Configuration config = configGetter.getConfig();
            if(config.getBoolean("Spider")){
            ItemStack head = new ItemStack(Material.SKULL_ITEM,1,(short)3);
            SkullMeta meta = (SkullMeta) head.getItemMeta();
            meta.setOwner("MHF_Spider");
            meta.setDisplayName("Spider Head " + config.getString("PerSpiderHead") + "$");
            head.setItemMeta(meta);
            if(event.getEntity() instanceof Spider){
                event.getDrops().add(head);
            }
            }
        }
     
Thread Status:
Not open for further replies.