mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
Added mooshroom
This commit is contained in:
parent
abe7846bb9
commit
2da0fb2326
4 changed files with 32 additions and 1 deletions
23
src/entity/animal/Mooshroom.php
Normal file
23
src/entity/animal/Mooshroom.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue