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

@ -41,11 +41,11 @@ class Flower extends Flowable{
protected $id = self::RED_FLOWER;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
static $names = [
self::TYPE_POPPY => "Poppy",
self::TYPE_BLUE_ORCHID => "Blue Orchid",
@ -60,7 +60,7 @@ class Flower extends Flowable{
return $names[$this->meta] ?? "Unknown";
}
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{
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){
$this->getLevel()->setBlock($block, $this, true);
@ -71,7 +71,7 @@ class Flower extends Flowable{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
$this->getLevel()->useBreakOn($this);