From 233616aa6aa9a3393b4edaaadccc50bbd759bfb1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 6 Feb 2021 19:02:13 +0000 Subject: [PATCH] RedstoneLamp now uses PoweredByRedstoneTrait --- src/block/RedstoneLamp.php | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/block/RedstoneLamp.php b/src/block/RedstoneLamp.php index c09f73b45..0d538167d 100644 --- a/src/block/RedstoneLamp.php +++ b/src/block/RedstoneLamp.php @@ -23,39 +23,27 @@ declare(strict_types=1); namespace pocketmine\block; +use pocketmine\block\utils\PoweredByRedstoneTrait; + class RedstoneLamp extends Opaque{ + use PoweredByRedstoneTrait; /** @var BlockIdentifierFlattened */ protected $idInfo; - /** @var bool */ - protected $lit = false; - public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.3)); } public function getId() : int{ - return $this->lit ? $this->idInfo->getSecondId() : parent::getId(); + return $this->powered ? $this->idInfo->getSecondId() : parent::getId(); } public function readStateFromData(int $id, int $stateMeta) : void{ - $this->lit = $id === $this->idInfo->getSecondId(); - } - - public function isLit() : bool{ - return $this->lit; - } - - /** - * @return $this - */ - public function setLit(bool $lit = true) : self{ - $this->lit = $lit; - return $this; + $this->powered = $id === $this->idInfo->getSecondId(); } public function getLightLevel() : int{ - return $this->lit ? 15 : 0; + return $this->powered ? 15 : 0; } }