isBaby changed to IsBaby, methods for animals were added

This commit is contained in:
GameHerobrine 2022-06-07 21:39:23 +03:00
parent 327e74e7aa
commit eb1f1e3d02
9 changed files with 88 additions and 79 deletions

View file

@ -3,7 +3,6 @@
class Chicken extends Animal{
const TYPE = MOB_CHICKEN;
function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
console("A constructor which indicates it works! ".":".$eid.":".$class.":".$type);
parent::__construct($level, $eid, $class, $type, $data);
$server = ServerAPI::request();
$server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg"));
@ -17,4 +16,12 @@ class Chicken extends Animal{
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 getDrops(){
return $this->isBaby() ? array() :
array(
array(FEATHER, 0, mt_rand(0,2)),
array(($this->fire > 0 ? COOKED_CHICKEN : RAW_CHICKEN), 0, 1),
);
}
}