mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
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:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user