mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
Big update about mobs
Removes some array() and some another minor changes.
Cow now drop 0-3 meat.
Pigs can be saddled, and if pig saddled it will drop them.
Creeper can be blown up with flint and steel ("power" => 3).
You can ride on pig (some buggy).
Now Saddle maxStackSize = 1.
Using shears and flint&steel on sheep and creeper they will break.
Saddled will save with closing the server.
This commit is contained in:
parent
2a52e6c69c
commit
f5222be9d2
17 changed files with 221 additions and 180 deletions
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
class Chicken extends Animal{
|
||||
const TYPE = MOB_CHICKEN;
|
||||
function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||
function __construct(Level $level, $eid, $class, $type = 0, $data = []){
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$this->server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg"));
|
||||
$this->server->schedule(mt_rand(0,6000) + 6000, [$this, "dropAnEgg"]);
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 4, "generic");
|
||||
$this->setName('Chicken');
|
||||
$this->setSize($this->isBaby() ? 0.2 : 0.4, $this->isBaby() ? 0.35 : 0.7);
|
||||
|
|
@ -17,15 +17,14 @@ class Chicken extends Animal{
|
|||
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"));
|
||||
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, [$this, "dropAnEgg"]);
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
return $this->isBaby() ? parent::getDrops() :
|
||||
array(
|
||||
array(FEATHER, 0, mt_rand(0,2)),
|
||||
array(($this->fire > 0 ? COOKED_CHICKEN : RAW_CHICKEN), 0, 1),
|
||||
);
|
||||
return $this->isBaby() ? parent::getDrops() : [
|
||||
[FEATHER, 0, mt_rand(0,2)],
|
||||
[[$this->fire > 0 ? COOKED_CHICKEN : RAW_CHICKEN], 0, 1]
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue