chickens can hatch eggs, shears fix

This commit is contained in:
GameHerobrine 2022-05-29 00:50:29 +03:00
parent bf7ff2b36b
commit ce43fb6c30
2 changed files with 17 additions and 5 deletions

View file

@ -110,10 +110,15 @@ class Entity extends Position{
$this->size = 0.75;
break;
case ENTITY_MOB:
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic");
$this->update();
//$this->setName((isset($mobs[$this->type]) ? $mobs[$this->type]:$this->type));
$this->size = 1;
switch($this->type){
case MOB_CHICKEN:
$this->server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg"));
default: //no break uwu?
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:10, "generic");
$this->update();
//$this->setName((isset($mobs[$this->type]) ? $mobs[$this->type]:$this->type));
$this->size = 1;
}
break;
case ENTITY_FALLING:
$this->setHealth(PHP_INT_MAX, "generic");
@ -148,7 +153,10 @@ class Entity extends Position{
$this->close();
}
}
public function dropAnEgg(){
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"));
}
public function updateFuse(){
if($this->closed === true){
return false;
@ -626,6 +634,7 @@ class Entity extends Position{
$d = array(
0 => array("type" => 0, "value" => $flags),
1 => array("type" => 1, "value" => $this->air),
//14 => array("type" => 0, "value" => 1), wip
16 => array("type" => 0, "value" => 0),
17 => array("type" => 6, "value" => array(0, 0, 0)),
);