mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Block API typehints
This commit is contained in:
@ -41,19 +41,19 @@ class Leaves extends Transparent{
|
||||
protected $id = self::LEAVES;
|
||||
protected $woodType = self::WOOD;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
public function __construct(int $meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getHardness(){
|
||||
public function getHardness() : float{
|
||||
return 0.2;
|
||||
}
|
||||
|
||||
public function getToolType(){
|
||||
public function getToolType() : int{
|
||||
return Tool::TYPE_SHEARS;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
public function getName() : string{
|
||||
static $names = [
|
||||
self::OAK => "Oak Leaves",
|
||||
self::SPRUCE => "Spruce Leaves",
|
||||
@ -132,7 +132,7 @@ class Leaves extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
public function onUpdate(int $type){
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if(($this->meta & 0b00001100) === 0){
|
||||
$this->meta |= 0x08;
|
||||
@ -159,9 +159,9 @@ class Leaves 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{
|
||||
$this->meta |= 0x04;
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
return $this->getLevel()->setBlock($this, $this, true);
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
|
Reference in New Issue
Block a user