mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
names were fixed, ->loop->stop();
This commit is contained in:
parent
50006a0189
commit
f6897cf862
242 changed files with 111 additions and 166 deletions
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
class SpawnEggItem extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(SPAWN_EGG, $meta, $count, "Spawn Egg");
|
||||
$this->meta = $meta;
|
||||
$this->isActivable = true;
|
||||
}
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$ageable = $this->meta === MOB_CHICKEN || $this->meta === MOB_COW || $this->meta === MOB_SHEEP || $this->meta === MOB_PIG;
|
||||
$data = array(
|
||||
"x" => $block->x + 0.5,
|
||||
"y" => $block->y,
|
||||
"z" => $block->z + 0.5,
|
||||
"IsBaby" => $ageable ? Utils::chance(5) ? 1 : 0 : 0
|
||||
);
|
||||
$e = ServerAPI::request()->api->entity->add($block->level, ENTITY_MOB, $this->meta, $data);
|
||||
ServerAPI::request()->api->entity->spawnToAll($e);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
-- $this->count;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue