1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Mob Death?

Discussion in 'Development' started by Vincent, Jan 25, 2018.

  1. Vincent

    Vincent Silverfish

    Messages:
    16
    GitHub:
    vincent
    Do I need a listener to detect a certain amount of a mob killed... Such as killing 5 chickens gives you a reward i can add the sender for the reward but how do i detect the chickens deaths...
     
  2. Yexeed

    Yexeed Slime

    Messages:
    76
    Chicken mob is not implemented in PMMP yet, but you can register your own chicken. In my example I used chicken from TeaSpoon.

    PHP:
    public function onChickenDeath(EntityDeathEvent $e){
            
    $ent $e->getEntity();
            
    //Chicken is CortexPE\entity\Chicken
            
    if($ent instanceof Chicken){
                
    $cause $ent->getLastDamageCause();
                if(
    $cause instanceof EntityDamageByEntityEvent){
                    
    $damager $cause->getDamager();
                    if(
    $damager instanceof Player){
                        
    //TODO
                        
    $damager->sendMessage("You killed a chicken, man");
                    }
                }
            }

        }
     
  3. Vincent

    Vincent Silverfish

    Messages:
    16
    GitHub:
    vincent
    Thx
     
  4. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Why you kill chicken, unhealthy.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.