diff --git a/src/API/EntityAPI.php b/src/API/EntityAPI.php index e6f6e516..d1e3efb0 100644 --- a/src/API/EntityAPI.php +++ b/src/API/EntityAPI.php @@ -27,12 +27,18 @@ class EntityAPI{ "cow" => 11, "pig" => 12, "sheep" => 13, + "wolf" => 14, + "villager" => 15, + "mooshroom" => 16, "zombie" => 32, "creeper" => 33, "skeleton" => 34, "spider" => 35, - "pigman" => 36 + "pigman" => 36, + "slime" => 37, + "enderman" => 38, + "silverfish" => 39, ]; $output = ""; switch($cmd){ diff --git a/src/constants/EntityIDs.php b/src/constants/EntityIDs.php index 747451bd..46293f3c 100644 --- a/src/constants/EntityIDs.php +++ b/src/constants/EntityIDs.php @@ -10,6 +10,7 @@ define("ENTITY_MOB", 2); define("MOB_SHEEP", 13); define("MOB_WOLF", 14); define("MOB_VILLAGER", 15); + define("MOB_MOOSHROOM", 16); define("MOB_ZOMBIE", 32); define("MOB_CREEPER", 33); diff --git a/src/entity/animal/Mooshroom.php b/src/entity/animal/Mooshroom.php new file mode 100644 index 00000000..20c6092b --- /dev/null +++ b/src/entity/animal/Mooshroom.php @@ -0,0 +1,23 @@ +setName("Mooshroom"); + $this->update(); + } + + public function interactWith(Entity $e, $action){ + if($e->isPlayer() && $action === InteractPacket::ACTION_HOLD){ + $slot = $e->player->getHeldItem(); + if($slot->getID() === SHEARS){ + //drop + $this->close(); + $this->server->api->entity->summon($this, ENTITY_MOB, MOB_COW, $this->data); + return true; + } + } + parent::interactWith($e, $action); + } +} \ No newline at end of file diff --git a/src/entity/registry/EntityRegistry.php b/src/entity/registry/EntityRegistry.php index f8774378..076e6122 100644 --- a/src/entity/registry/EntityRegistry.php +++ b/src/entity/registry/EntityRegistry.php @@ -10,6 +10,7 @@ class EntityRegistry{ self::registerEntity(Chicken::class); self::registerEntity(Sheep::class); self::registerEntity(Cow::class); + self::registerEntity(Mooshroom::class); self::registerEntity(Creeper::class); self::registerEntity(PigZombie::class); self::registerEntity(Skeleton::class);