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,28 +33,28 @@ class SnowLayer extends Flowable{
protected $id = self::SNOW_LAYER;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Snow Layer";
}
public function canBeReplaced(){
public function canBeReplaced() : bool{
return true;
}
public function getHardness(){
public function getHardness() : float{
return 0.1;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
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($block->getSide(Vector3::SIDE_DOWN)->isSolid()){
//TODO: fix placement
$this->getLevel()->setBlock($block, $this, true);
@ -65,7 +65,7 @@ class SnowLayer 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)->isSolid()){
$this->getLevel()->setBlock($this, Block::get(Block::AIR), false, false);