diff --git a/src/pocketmine/block/Crops.php b/src/pocketmine/block/Crops.php index 4c6e84536..2609134d6 100644 --- a/src/pocketmine/block/Crops.php +++ b/src/pocketmine/block/Crops.php @@ -36,6 +36,10 @@ abstract class Crops extends Flowable{ /** @var int */ protected $age = 0; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/pocketmine/block/Dandelion.php b/src/pocketmine/block/Dandelion.php index b80b8d8b7..d562afbd8 100644 --- a/src/pocketmine/block/Dandelion.php +++ b/src/pocketmine/block/Dandelion.php @@ -30,6 +30,9 @@ use pocketmine\Player; class Dandelion extends Flowable{ + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ $down = $this->getSide(Facing::DOWN); diff --git a/src/pocketmine/block/DoublePlant.php b/src/pocketmine/block/DoublePlant.php index c58abbab0..8b2562a94 100644 --- a/src/pocketmine/block/DoublePlant.php +++ b/src/pocketmine/block/DoublePlant.php @@ -35,6 +35,10 @@ class DoublePlant extends Flowable{ /** @var bool */ protected $top = false; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return ($this->top ? self::BITFLAG_TOP : 0); } diff --git a/src/pocketmine/block/EndRod.php b/src/pocketmine/block/EndRod.php index 129081538..ecf724302 100644 --- a/src/pocketmine/block/EndRod.php +++ b/src/pocketmine/block/EndRod.php @@ -35,6 +35,10 @@ class EndRod extends Flowable{ /** @var int */ protected $facing = Facing::DOWN; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ if(Facing::axis($this->facing) === Facing::AXIS_Y){ return $this->facing; diff --git a/src/pocketmine/block/Fire.php b/src/pocketmine/block/Fire.php index 29dd6caae..68b96942b 100644 --- a/src/pocketmine/block/Fire.php +++ b/src/pocketmine/block/Fire.php @@ -40,6 +40,10 @@ class Fire extends Flowable{ /** @var int */ protected $age = 0; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/pocketmine/block/Flowable.php b/src/pocketmine/block/Flowable.php index 146192507..fd98e057f 100644 --- a/src/pocketmine/block/Flowable.php +++ b/src/pocketmine/block/Flowable.php @@ -27,10 +27,6 @@ use pocketmine\math\AxisAlignedBB; abstract class Flowable extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - public function canBeFlowedInto() : bool{ return true; } diff --git a/src/pocketmine/block/Flower.php b/src/pocketmine/block/Flower.php index 165abadfe..af4ff97ff 100644 --- a/src/pocketmine/block/Flower.php +++ b/src/pocketmine/block/Flower.php @@ -41,6 +41,10 @@ class Flower extends Flowable{ public const TYPE_CORNFLOWER = 9; public const TYPE_LILY_OF_THE_VALLEY = 10; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ $down = $this->getSide(Facing::DOWN); if($down->getId() === BlockLegacyIds::GRASS or $down->getId() === BlockLegacyIds::DIRT or $down->getId() === BlockLegacyIds::FARMLAND){ diff --git a/src/pocketmine/block/FlowerPot.php b/src/pocketmine/block/FlowerPot.php index 1c2644c9b..2cd993830 100644 --- a/src/pocketmine/block/FlowerPot.php +++ b/src/pocketmine/block/FlowerPot.php @@ -42,6 +42,10 @@ class FlowerPot extends Flowable{ /** @var Block|null */ protected $plant = null; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return $this->occupied ? 1 : 0; } diff --git a/src/pocketmine/block/NetherWartPlant.php b/src/pocketmine/block/NetherWartPlant.php index 6d14c1c43..8fd0a6a31 100644 --- a/src/pocketmine/block/NetherWartPlant.php +++ b/src/pocketmine/block/NetherWartPlant.php @@ -37,6 +37,10 @@ class NetherWartPlant extends Flowable{ /** @var int */ protected $age = 0; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/pocketmine/block/RedMushroom.php b/src/pocketmine/block/RedMushroom.php index 1f6a98bad..40c065200 100644 --- a/src/pocketmine/block/RedMushroom.php +++ b/src/pocketmine/block/RedMushroom.php @@ -30,6 +30,10 @@ use pocketmine\Player; class RedMushroom extends Flowable{ + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + public function ticksRandomly() : bool{ return true; } diff --git a/src/pocketmine/block/RedstoneComparator.php b/src/pocketmine/block/RedstoneComparator.php index aea91205c..2ec142ea0 100644 --- a/src/pocketmine/block/RedstoneComparator.php +++ b/src/pocketmine/block/RedstoneComparator.php @@ -46,8 +46,8 @@ class RedstoneComparator extends Flowable{ /** @var int */ protected $signalStrength = 0; - public function __construct(BlockIdentifierFlattened $idInfo, string $name){ - parent::__construct($idInfo, $name); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); } public function getId() : int{ diff --git a/src/pocketmine/block/RedstoneRepeater.php b/src/pocketmine/block/RedstoneRepeater.php index 6f7a4070f..8c4dbec51 100644 --- a/src/pocketmine/block/RedstoneRepeater.php +++ b/src/pocketmine/block/RedstoneRepeater.php @@ -42,8 +42,8 @@ class RedstoneRepeater extends Flowable{ /** @var int */ protected $delay = 1; - public function __construct(BlockIdentifierFlattened $idInfo, string $name){ - parent::__construct($idInfo, $name); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); } public function getId() : int{ diff --git a/src/pocketmine/block/RedstoneWire.php b/src/pocketmine/block/RedstoneWire.php index 6f95e906b..a665db097 100644 --- a/src/pocketmine/block/RedstoneWire.php +++ b/src/pocketmine/block/RedstoneWire.php @@ -30,6 +30,10 @@ class RedstoneWire extends Flowable{ /** @var int */ protected $power = 0; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + public function readStateFromData(int $id, int $stateMeta) : void{ $this->power = BlockDataValidator::readBoundedInt("power", $stateMeta, 0, 15); } diff --git a/src/pocketmine/block/Sapling.php b/src/pocketmine/block/Sapling.php index 06a164e11..a16cadb71 100644 --- a/src/pocketmine/block/Sapling.php +++ b/src/pocketmine/block/Sapling.php @@ -40,8 +40,8 @@ class Sapling extends Flowable{ /** @var TreeType */ private $treeType; - public function __construct(BlockIdentifier $idInfo, string $name, TreeType $treeType){ - parent::__construct($idInfo, $name); + public function __construct(BlockIdentifier $idInfo, string $name, TreeType $treeType, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); $this->treeType = $treeType; } diff --git a/src/pocketmine/block/Stem.php b/src/pocketmine/block/Stem.php index 0bc2b478b..4d0dbf849 100644 --- a/src/pocketmine/block/Stem.php +++ b/src/pocketmine/block/Stem.php @@ -31,6 +31,10 @@ use function mt_rand; abstract class Stem extends Crops{ + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + abstract protected function getPlant() : Block; public function onRandomTick() : void{ diff --git a/src/pocketmine/block/Sugarcane.php b/src/pocketmine/block/Sugarcane.php index 9c2abd907..4f8c01c4c 100644 --- a/src/pocketmine/block/Sugarcane.php +++ b/src/pocketmine/block/Sugarcane.php @@ -36,6 +36,10 @@ class Sugarcane extends Flowable{ /** @var int */ protected $age = 0; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/pocketmine/block/Torch.php b/src/pocketmine/block/Torch.php index e5a5533b6..24e7e4573 100644 --- a/src/pocketmine/block/Torch.php +++ b/src/pocketmine/block/Torch.php @@ -34,6 +34,10 @@ class Torch extends Flowable{ /** @var int */ protected $facing = Facing::UP; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return 6 - $this->facing; } diff --git a/src/pocketmine/block/Tripwire.php b/src/pocketmine/block/Tripwire.php index 3b68142ac..d1a4732c4 100644 --- a/src/pocketmine/block/Tripwire.php +++ b/src/pocketmine/block/Tripwire.php @@ -34,6 +34,10 @@ class Tripwire extends Flowable{ /** @var bool */ protected $disarmed = false; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return ($this->triggered ? 0x01 : 0) | ($this->suspended ? 0x02 : 0) | ($this->connected ? 0x04 : 0) | ($this->disarmed ? 0x08 : 0); } diff --git a/src/pocketmine/block/TripwireHook.php b/src/pocketmine/block/TripwireHook.php index b91887f36..f54ed36aa 100644 --- a/src/pocketmine/block/TripwireHook.php +++ b/src/pocketmine/block/TripwireHook.php @@ -39,6 +39,10 @@ class TripwireHook extends Flowable{ /** @var bool */ protected $powered = false; + public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + } + protected function writeStateToMeta() : int{ return Bearing::fromFacing($this->facing) | ($this->connected ? 0x04 : 0) | ($this->powered ? 0x08 : 0); }