diff --git a/src/pocketmine/block/Air.php b/src/pocketmine/block/Air.php index 9908bea838..6ba70d3198 100644 --- a/src/pocketmine/block/Air.php +++ b/src/pocketmine/block/Air.php @@ -21,25 +21,26 @@ namespace pocketmine\block; -use pocketmine\math\AxisAlignedBB; - /** * Air block */ class Air extends Transparent{ + public $isActivable = false; + public $breakable = false; + public $isFlowable = true; + public $isTransparent = true; + public $isReplaceable = true; + public $isPlaceable = false; + public $hasPhysics = false; + public $isSolid = false; + public $isFullBlock = true; + protected $id = self::AIR; + protected $meta = 0; + protected $name = "Air"; + protected $hardness = 0; + public function __construct(){ - parent::__construct(self::AIR, 0, "Air"); - $this->isActivable = false; - $this->breakable = false; - $this->isFlowable = true; - $this->isTransparent = true; - $this->isReplaceable = true; - $this->isPlaceable = false; - $this->hasPhysics = false; - $this->isSolid = false; - $this->isFullBlock = true; - $this->hardness = 0; } diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index c468bd4de5..40cbd0cd4f 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -506,9 +506,9 @@ abstract class Block extends Position implements Metadatable{ public static $list = []; protected $id; protected $meta; - protected $name; - protected $breakTime; - protected $hardness; + protected $name = "Unknown"; + protected $breakTime = 0.20; + protected $hardness = 10; public $isActivable = false; public $breakable = true; public $isFlowable = false; @@ -698,8 +698,6 @@ abstract class Block extends Position implements Metadatable{ $this->id = (int) $id; $this->meta = (int) $meta; $this->name = $name; - $this->breakTime = 0.20; - $this->hardness = 10; } /** diff --git a/src/pocketmine/block/Dirt.php b/src/pocketmine/block/Dirt.php index 7eafff6ef4..cf4a26c2cb 100644 --- a/src/pocketmine/block/Dirt.php +++ b/src/pocketmine/block/Dirt.php @@ -25,10 +25,15 @@ use pocketmine\item\Item; use pocketmine\Player; class Dirt extends Solid{ + + public $isActivable = true; + protected $hardness = 2.5; + protected $id = self::DIRT; + protected $meta = 0; + protected $name = "Dirt"; + public function __construct(){ - parent::__construct(self::DIRT, 0, "Dirt"); - $this->isActivable = true; - $this->hardness = 2.5; + } public function onActivate(Item $item, Player $player = null){ diff --git a/src/pocketmine/block/Fallable.php b/src/pocketmine/block/Fallable.php index 825482a14c..518f4e79f3 100644 --- a/src/pocketmine/block/Fallable.php +++ b/src/pocketmine/block/Fallable.php @@ -26,10 +26,7 @@ use pocketmine\Player; class Fallable extends Solid{ - public function __construct($id, $meta = 0, $name = "Unknown"){ - parent::__construct($id, $meta, $name); - $this->hasPhysics = true; - } + public $hasPhysics = true; public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ $ret = $this->getLevel()->setBlock($this, $this, true, false, true); diff --git a/src/pocketmine/block/Flowable.php b/src/pocketmine/block/Flowable.php index 0a4a7aa295..b328529cf4 100644 --- a/src/pocketmine/block/Flowable.php +++ b/src/pocketmine/block/Flowable.php @@ -23,10 +23,9 @@ namespace pocketmine\block; class Flowable extends Transparent{ - public function __construct($id, $meta = 0, $name = "Unknown"){ - parent::__construct($id, $meta, $name); - $this->isFlowable = true; - $this->isFullBlock = false; - $this->isSolid = false; - } + + public $isFlowable = true; + public $isFullBlock = false; + public $isSolid = false; + } \ No newline at end of file diff --git a/src/pocketmine/block/Generic.php b/src/pocketmine/block/Generic.php index 429ccc5198..491b44c228 100644 --- a/src/pocketmine/block/Generic.php +++ b/src/pocketmine/block/Generic.php @@ -27,15 +27,6 @@ use pocketmine\Player; class Generic extends Block{ - /** - * @param int $id - * @param int $meta - * @param string $name - */ - public function __construct($id, $meta = 0, $name = "Unknown"){ - parent::__construct($id, $meta, $name); - } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ return $this->getLevel()->setBlock($this, $this, true, false, true); } diff --git a/src/pocketmine/block/Grass.php b/src/pocketmine/block/Grass.php index 991a97dc94..7af32df9bf 100644 --- a/src/pocketmine/block/Grass.php +++ b/src/pocketmine/block/Grass.php @@ -29,10 +29,15 @@ use pocketmine\Player; use pocketmine\utils\Random; class Grass extends Solid{ + + public $isActivable = true; + protected $hardness = 3; + protected $id = self::GRASS; + protected $meta = 0; + protected $name = "Grass"; + public function __construct(){ - parent::__construct(self::GRASS, 0, "Grass"); - $this->isActivable = true; - $this->hardness = 3; + } public function getDrops(Item $item){ diff --git a/src/pocketmine/block/Liquid.php b/src/pocketmine/block/Liquid.php index 7125d2e990..5b04662ffe 100644 --- a/src/pocketmine/block/Liquid.php +++ b/src/pocketmine/block/Liquid.php @@ -23,12 +23,9 @@ namespace pocketmine\block; class Liquid extends Transparent{ - public function __construct($id, $meta = 0, $name = "Unknown"){ - parent::__construct($id, $meta, $name); - $this->isLiquid = true; - $this->breakable = false; - $this->isReplaceable = true; - $this->isSolid = false; - $this->isFullBlock = true; - } + public $isLiquid = true; + public $breakable = false; + public $isReplaceable = true; + public $isSolid = false; + public $isFullBlock = true; } \ No newline at end of file diff --git a/src/pocketmine/block/Stone.php b/src/pocketmine/block/Stone.php index 688326d04c..6044a7bed9 100644 --- a/src/pocketmine/block/Stone.php +++ b/src/pocketmine/block/Stone.php @@ -32,8 +32,11 @@ class Stone extends Solid{ const ANDESITE = 5; const POLISHED_ANDESITE = 6; + protected $hardness = 30; + protected $id = self::STONE; + public function __construct($meta = 0){ - parent::__construct(self::STONE, $meta, "Stone"); + $this->meta = $meta; $names = [ self::NORMAL => "Stone", self::GRANITE => "Granite", @@ -44,7 +47,6 @@ class Stone extends Solid{ self::POLISHED_ANDESITE => "Polished Andesite", ]; $this->name = $names[$this->meta & 0x07]; - $this->hardness = 30; } public function getBreakTime(Item $item){ diff --git a/src/pocketmine/block/Transparent.php b/src/pocketmine/block/Transparent.php index c2b33b24ef..6771685d7e 100644 --- a/src/pocketmine/block/Transparent.php +++ b/src/pocketmine/block/Transparent.php @@ -22,16 +22,13 @@ namespace pocketmine\block; -class Transparent extends Generic{ - public function __construct($id, $meta = 0, $name = "Unknown"){ - parent::__construct($id, $meta, $name); - $this->isActivable = false; - $this->breakable = true; - $this->isFlowable = false; - $this->isTransparent = true; - $this->isReplaceable = false; - $this->isPlaceable = true; - $this->isSolid = true; - } +class Transparent extends Generic{ + public $isActivable = false; + public $breakable = true; + public $isFlowable = false; + public $isTransparent = true; + public $isReplaceable = false; + public $isPlaceable = true; + public $isSolid = true; } \ No newline at end of file