diff --git a/src/entity/animal/Chicken.php b/src/entity/animal/Chicken.php index 703c513b..88c32148 100644 --- a/src/entity/animal/Chicken.php +++ b/src/entity/animal/Chicken.php @@ -5,7 +5,7 @@ class Chicken extends Animal{ function __construct(Level $level, $eid, $class, $type = 0, $data = array()){ parent::__construct($level, $eid, $class, $type, $data); $server = ServerAPI::request(); - $server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg")); + $server->schedule(1, array($this, "dropAnEgg")); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 4, "generic"); $this->update(); //$this->setName('Chicken'); @@ -15,8 +15,11 @@ class Chicken extends Animal{ return $id === PUMPKIN_SEEDS || $id === MELON_SEEDS || $id === BEETROOT_SEEDS || $id === WHEAT_SEEDS; } public function dropAnEgg(){ + if($this->closed){ + return; + } ServerAPI::request()->api->entity->drop(new Position($this->x + 0.5, $this->y, $this->z + 0.5, $this->level), BlockAPI::getItem(EGG,0,1)); - $this->server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg")); + $this->server->schedule(1, array($this, "dropAnEgg")); } public function getDrops(){