diff --git a/src/pocketmine/block/BlockFactory.php b/src/pocketmine/block/BlockFactory.php index 7251e6523d..5ad7538ee7 100644 --- a/src/pocketmine/block/BlockFactory.php +++ b/src/pocketmine/block/BlockFactory.php @@ -101,13 +101,9 @@ class BlockFactory{ self::registerBlock(new Bedrock()); self::registerBlock(new Water()); - $b = new Water(); - $b->setStill(); - self::registerBlock($b); //flattening hack + self::registerBlock((new Water())->setStill()); //flattening hack self::registerBlock(new Lava()); - $b = new Lava(); - $b->setStill(); - self::registerBlock($b); //flattening hack + self::registerBlock((new Lava())->setStill()); //flattening hack self::registerBlock(new Sand(Block::SAND, 0, "Sand")); self::registerBlock(new Sand(Block::SAND, 1, "Red Sand")); @@ -214,10 +210,7 @@ class BlockFactory{ self::registerBlock(new Farmland()); self::registerBlock(new Furnace()); - - $furnace = new Furnace(); - $furnace->setLit(); - self::registerBlock($furnace); //flattening hack + self::registerBlock((new Furnace())->setLit()); //flattening hack self::registerBlock(new SignPost()); self::registerBlock(new WoodenDoor(Block::OAK_DOOR_BLOCK, 0, "Oak Door", Item::OAK_DOOR)); @@ -230,16 +223,9 @@ class BlockFactory{ self::registerBlock(new IronDoor()); self::registerBlock(new WoodenPressurePlate()); self::registerBlock(new RedstoneOre()); - - $litRedstone = new RedstoneOre(); - $litRedstone->setLit(); - self::registerBlock($litRedstone); //flattening hack - + self::registerBlock((new RedstoneOre())->setLit()); //flattening hack self::registerBlock(new RedstoneTorch()); - $unlitRedstoneTorch = new RedstoneTorch(); - $unlitRedstoneTorch->setLit(false); - self::registerBlock($unlitRedstoneTorch); //flattening hack - + self::registerBlock((new RedstoneTorch())->setLit()); //flattening hack self::registerBlock(new StoneButton()); self::registerBlock(new SnowLayer()); self::registerBlock(new Ice()); @@ -292,10 +278,7 @@ class BlockFactory{ self::registerBlock(new EndStone()); //TODO: DRAGON_EGG self::registerBlock(new RedstoneLamp()); - $litLamp = new RedstoneLamp(); - $litLamp->setLit(); - self::registerBlock($litLamp); //flattening hack - + self::registerBlock((new RedstoneLamp())->setLit()); //flattening hack //TODO: DROPPER self::registerBlock(new ActivatorRail()); self::registerBlock(new CocoaBlock()); @@ -330,9 +313,7 @@ class BlockFactory{ //TODO: COMPARATOR_BLOCK //TODO: POWERED_COMPARATOR self::registerBlock(new DaylightSensor()); - $invertedSensor = new DaylightSensor(); - $invertedSensor->setInverted(); - self::registerBlock($invertedSensor); //flattening hack + self::registerBlock((new DaylightSensor())->setInverted()); //flattening hack self::registerBlock(new Redstone()); self::registerBlock(new NetherQuartzOre()); diff --git a/src/pocketmine/block/DaylightSensor.php b/src/pocketmine/block/DaylightSensor.php index ee64b39d85..7afda00e3f 100644 --- a/src/pocketmine/block/DaylightSensor.php +++ b/src/pocketmine/block/DaylightSensor.php @@ -62,8 +62,14 @@ class DaylightSensor extends Transparent{ return $this->inverted; } - public function setInverted(bool $inverted = true) : void{ + /** + * @param bool $inverted + * + * @return $this + */ + public function setInverted(bool $inverted = true) : self{ $this->inverted = $inverted; + return $this; } public function getName() : string{ diff --git a/src/pocketmine/block/Furnace.php b/src/pocketmine/block/Furnace.php index 0a7295515e..06473a53a0 100644 --- a/src/pocketmine/block/Furnace.php +++ b/src/pocketmine/block/Furnace.php @@ -85,8 +85,14 @@ class Furnace extends Solid{ return $this->lit; } - public function setLit(bool $lit = true) : void{ + /** + * @param bool $lit + * + * @return $this + */ + public function setLit(bool $lit = true) : self{ $this->lit = $lit; + return $this; } public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{ diff --git a/src/pocketmine/block/Liquid.php b/src/pocketmine/block/Liquid.php index 4665f23737..d365ca2d4a 100644 --- a/src/pocketmine/block/Liquid.php +++ b/src/pocketmine/block/Liquid.php @@ -137,8 +137,14 @@ abstract class Liquid extends Transparent{ return $this->still; } - public function setStill(bool $still = true) : void{ + /** + * @param bool $still + * + * @return $this + */ + public function setStill(bool $still = true) : self{ $this->still = $still; + return $this; } protected function getEffectiveFlowDecay(Block $block) : int{ diff --git a/src/pocketmine/block/RedstoneLamp.php b/src/pocketmine/block/RedstoneLamp.php index 421268d7e6..34b97a212d 100644 --- a/src/pocketmine/block/RedstoneLamp.php +++ b/src/pocketmine/block/RedstoneLamp.php @@ -42,8 +42,14 @@ class RedstoneLamp extends Solid{ return $this->lit; } - public function setLit(bool $lit = true) : void{ + /** + * @param bool $lit + * + * @return $this + */ + public function setLit(bool $lit = true) : self{ $this->lit = $lit; + return $this; } public function getLightLevel() : int{ diff --git a/src/pocketmine/block/RedstoneOre.php b/src/pocketmine/block/RedstoneOre.php index ffcef7ba1b..592b5f0bb3 100644 --- a/src/pocketmine/block/RedstoneOre.php +++ b/src/pocketmine/block/RedstoneOre.php @@ -56,8 +56,14 @@ class RedstoneOre extends Solid{ return $this->lit; } - public function setLit(bool $lit = true) : void{ + /** + * @param bool $lit + * + * @return $this + */ + public function setLit(bool $lit = true) : self{ $this->lit = $lit; + return $this; } public function getLightLevel() : int{ diff --git a/src/pocketmine/block/RedstoneTorch.php b/src/pocketmine/block/RedstoneTorch.php index c8b9ab9a5b..51b03843ff 100644 --- a/src/pocketmine/block/RedstoneTorch.php +++ b/src/pocketmine/block/RedstoneTorch.php @@ -42,8 +42,14 @@ class RedstoneTorch extends Torch{ return $this->lit; } - public function setLit(bool $lit = true) : void{ + /** + * @param bool $lit + * + * @return $this + */ + public function setLit(bool $lit = true) : self{ $this->lit = $lit; + return $this; } public function getLightLevel() : int{