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

@ -1848,6 +1848,9 @@ class Player{
ServerAPI::request()->api->entity->drop(new Position($target->x + 0.5, $target->y, $target->z + 0.5, $target->level), BlockAPI::getItem(WOOL, $target->data["Color"], mt_rand(1,3))); ServerAPI::request()->api->entity->drop(new Position($target->x + 0.5, $target->y, $target->z + 0.5, $target->level), BlockAPI::getItem(WOOL, $target->data["Color"], mt_rand(1,3)));
$target->data["Sheared"] = 1; //i hope it means sheared right? $target->data["Sheared"] = 1; //i hope it means sheared right?
$target->updateMetadata(); $target->updateMetadata();
if($slot->getMetadata() >= $slot->getMaxDurability()){
$this->removeItem($slot->getID(), $slot->getMetadata(), $slot->count, true);
}
$needsBreak = true; $needsBreak = true;
} }
} }

View file

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