Added mooshroom

This commit is contained in:
ArkQuark 2023-02-21 16:29:05 +03:00
parent abe7846bb9
commit 2da0fb2326
4 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,23 @@
<?php
class Mooshroom extends Cow{
const TYPE = MOB_MOOSHROOM;
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
parent::__construct($level, $eid, $class, $type, $data);
$this->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);
}
}

View file

@ -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);