Typehinted up entity API

Did you guys think ALPHA7 changes were done?!
Sone stuff still needs some work, most notably data-properties can't be typed yet because they are just mushed into a couple of methods.
This commit is contained in:
Dylan K. Taylor
2017-08-16 19:03:39 +01:00
parent ea414ea72d
commit 741394dab1
23 changed files with 197 additions and 149 deletions

View File

@ -41,7 +41,7 @@ class Villager extends Creature implements NPC, Ageable{
public $length = 0.6;
public $height = 1.8;
public function getName(){
public function getName() : string{
return "Villager";
}
@ -73,17 +73,17 @@ class Villager extends Creature implements NPC, Ageable{
/**
* Sets the villager profession
*
* @param $profession
* @param int $profession
*/
public function setProfession($profession){
public function setProfession(int $profession){
$this->namedtag->Profession = new IntTag("Profession", $profession);
}
public function getProfession(){
return $this->namedtag["Profession"];
public function getProfession() : int{
return (int) $this->namedtag["Profession"];
}
public function isBaby(){
public function isBaby() : bool{
return $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_BABY);
}
}