mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
early breeding classes, it still doesnt work although it might be implemented later
This commit is contained in:
parent
7ec27bfb04
commit
d7bfd96739
7 changed files with 22 additions and 5 deletions
|
|
@ -97,6 +97,7 @@ require_once(FILE_PATH."/src/world/Position.php");
|
|||
require_once(FILE_PATH."/src/pmf/PMF.php");
|
||||
require_once(FILE_PATH."/src/entity/Entity.php");
|
||||
require_once(FILE_PATH."/src/entity/Damageable.php");
|
||||
require_once(FILE_PATH."/src/entity/Breedable.php");
|
||||
require_once(FILE_PATH."/src/entity/Living.php");
|
||||
require_once(FILE_PATH."/src/entity/Creature.php");
|
||||
require_once(FILE_PATH."/src/entity/Ageable.php");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
TODO:
|
||||
move methods
|
||||
*/
|
||||
class Animal extends Creature implements Ageable{
|
||||
abstract class Animal extends Creature implements Ageable, Breedable{
|
||||
public function isBaby(){
|
||||
return $this->data["IsBaby"];
|
||||
}
|
||||
|
|
|
|||
5
src/entity/Breedable.php
Normal file
5
src/entity/Breedable.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
interface Breedable{
|
||||
public function isFood($id); //original name
|
||||
}
|
||||
|
|
@ -6,12 +6,14 @@ class Chicken extends Animal{
|
|||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
$server = ServerAPI::request();
|
||||
$server->schedule(mt_rand(0,6000) + 6000, array($this, "dropAnEgg"));
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"]:4, "generic");
|
||||
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 4, "generic");
|
||||
$this->update();
|
||||
//$this->setName('Chicken');
|
||||
$this->size = $this->isBaby() ? 0.35 : 0.7;
|
||||
}
|
||||
|
||||
public function isFood($id){
|
||||
return $id === PUMPKIN_SEEDS || $id === MELON_SEEDS || $id === BEETROOT_SEEDS || $id === WHEAT_SEEDS;
|
||||
}
|
||||
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"));
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ class Cow extends Animal{
|
|||
//$this->setName('Cow');
|
||||
$this->size = $this->isBaby() ? 0.65 : 1.4;
|
||||
}
|
||||
|
||||
public function isFood($id){
|
||||
return $id === WHEAT;
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
return $this->isBaby() ? array() :
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ class Pig extends Animal{
|
|||
//$this->setName('Pig');
|
||||
$this->size = $this->isBaby() ? 0.60 : 1.1875;
|
||||
}
|
||||
|
||||
public function isFood($id){
|
||||
return $id === POTATO || $id === CARROT || $id === BEETROOT;
|
||||
}
|
||||
public function getDrops(){
|
||||
return $this->isBaby() ? array() :
|
||||
array(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ class Sheep extends Animal{
|
|||
array(WOOL, $this->data["Color"] & 0x0F, 1),
|
||||
);
|
||||
}
|
||||
|
||||
public function isFood($id){
|
||||
return $id === WHEAT;
|
||||
}
|
||||
|
||||
public function getMetadata(){
|
||||
$d = parent::getMetadata();
|
||||
if(!isset($this->data["Sheared"])){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue