diff --git a/src/entity/Ageable.php b/src/entity/Ageable.php index 46a48934..7d90d4c8 100644 --- a/src/entity/Ageable.php +++ b/src/entity/Ageable.php @@ -1,5 +1,5 @@ data["isBaby"]; + } } \ No newline at end of file diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 6c2c65a5..76a69333 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -114,38 +114,6 @@ class Entity extends Position{ break; case ENTITY_MOB: switch($this->type){ - - //Animals - case MOB_CHICKEN: - $this->server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg")); - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:4, "generic"); - $this->update(); - //$this->setName('Chicken'); - if(isset($this->data['isBaby'])) $this->size = 0.35; - else $this->size = 0.7; - break; - case MOB_COW: - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic"); - $this->update(); - //$this->setName('Cow'); - if(isset($this->data['isBaby'])) $this->size = 0.65; - else $this->size = 1.4; - break; - case MOB_PIG: - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic"); - $this->update(); - //$this->setName('Pig'); - if(isset($this->data['isBaby'])) $this->size = 0.60; //not original - else $this->size = 1.1875; - break; - case MOB_SHEEP: - $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:8, "generic"); - $this->update(); - //$this->setName('Sheep'); - if(isset($this->data['isBaby'])) $this->size = 0.65; - else $this->size = 1.3; - break; - //Monsters case MOB_CREEPER: $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:20, "generic"); @@ -219,10 +187,7 @@ class Entity extends Position{ $this->close(); } } - public function dropAnEgg(){ - 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")); - } + public function updateFuse(){ if($this->closed === true){ return false; diff --git a/src/entity/EntityRegistry.php b/src/entity/EntityRegistry.php index 99372db6..83e85e55 100644 --- a/src/entity/EntityRegistry.php +++ b/src/entity/EntityRegistry.php @@ -38,6 +38,9 @@ class EntityRegistry{ public static function registerEntities(){ self::$entityList = new EntityList; self::registerEntity(Pig::class); + self::registerEntity(Chicken::class); + self::registerEntity(Sheep::class); + self::registerEntity(Cow::class); } /*Register an Entity*/ diff --git a/src/entity/animal/Chicken.php b/src/entity/animal/Chicken.php index e69de29b..5dc85a4b 100644 --- a/src/entity/animal/Chicken.php +++ b/src/entity/animal/Chicken.php @@ -0,0 +1,20 @@ +schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg")); + $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:4, "generic"); + $this->update(); + //$this->setName('Chicken'); + $this->size = $this->isBaby() ? 0.35 : 0.7; + } + + public function dropAnEgg(){ + 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")); + } +} \ No newline at end of file diff --git a/src/entity/animal/Cow.php b/src/entity/animal/Cow.php index e69de29b..2f7914f4 100644 --- a/src/entity/animal/Cow.php +++ b/src/entity/animal/Cow.php @@ -0,0 +1,13 @@ +setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic"); + $this->update(); + //$this->setName('Cow'); + $this->size = $this->isBaby() ? 0.65 : 1.4; + } +} \ No newline at end of file diff --git a/src/entity/animal/Pig.php b/src/entity/animal/Pig.php index c78017d9..0b9c8815 100644 --- a/src/entity/animal/Pig.php +++ b/src/entity/animal/Pig.php @@ -1,12 +1,12 @@ setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic"); + $this->update(); + //$this->setName('Pig'); + $this->size = $this->isBaby() ? 0.60 : 1.1875; } } \ No newline at end of file diff --git a/src/entity/animal/Sheep.php b/src/entity/animal/Sheep.php index e69de29b..cda6cc48 100644 --- a/src/entity/animal/Sheep.php +++ b/src/entity/animal/Sheep.php @@ -0,0 +1,13 @@ +setHealth(isset($this->data["Health"]) ? $this->data["Health"]:8, "generic"); + $this->update(); + //$this->setName('Sheep'); + $this->size = $this->isBaby() ? 0.65 : 1.3; + } +} \ No newline at end of file