Block API typehints

This commit is contained in:
Dylan K. Taylor
2017-08-17 13:50:19 +01:00
parent f6c31680f6
commit 83af4dcd59
162 changed files with 665 additions and 667 deletions

View File

@ -33,7 +33,7 @@ use pocketmine\Player;
abstract class Door extends Transparent{
public function isSolid(){
public function isSolid() : bool{
return false;
}
@ -201,7 +201,7 @@ abstract class Door extends Transparent{
return $bb;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false);
@ -216,7 +216,7 @@ abstract class Door extends Transparent{
return false;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
if($face === 1){
$blockUp = $this->getSide(Vector3::SIDE_UP);
$blockDown = $this->getSide(Vector3::SIDE_DOWN);
@ -246,7 +246,7 @@ abstract class Door extends Transparent{
return false;
}
public function onBreak(Item $item){
public function onBreak(Item $item) : bool{
if(($this->getDamage() & 0x08) === 0x08){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === $this->getId()){
@ -263,7 +263,7 @@ abstract class Door extends Transparent{
return true;
}
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
if(($this->getDamage() & 0x08) === 0x08){ //Top
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === $this->getId()){