mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
chickens do not drop eggs after they were killed/disappeared for other reason
This commit is contained in:
parent
f5ad87e4a5
commit
fd46b1e4f5
1 changed files with 5 additions and 2 deletions
|
|
@ -5,7 +5,7 @@ class Chicken extends Animal{
|
|||
function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$server = ServerAPI::request();
|
||||
$server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg"));
|
||||
$server->schedule(1, array($this, "dropAnEgg"));
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 4, "generic");
|
||||
$this->update();
|
||||
//$this->setName('Chicken');
|
||||
|
|
@ -15,8 +15,11 @@ class Chicken extends Animal{
|
|||
return $id === PUMPKIN_SEEDS || $id === MELON_SEEDS || $id === BEETROOT_SEEDS || $id === WHEAT_SEEDS;
|
||||
}
|
||||
public function dropAnEgg(){
|
||||
if($this->closed){
|
||||
return;
|
||||
}
|
||||
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"));
|
||||
$this->server->schedule(1, array($this, "dropAnEgg"));
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue