mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Block: fixed LSP violations in blocks using BlockIdentifierFlattened
a property's type can't be changed by a subclass
This commit is contained in:
@ -26,22 +26,23 @@ namespace pocketmine\block;
|
||||
class RedstoneTorch extends Torch{
|
||||
|
||||
/** @var BlockIdentifierFlattened */
|
||||
protected $idInfo;
|
||||
protected $idInfoFlattened;
|
||||
|
||||
/** @var bool */
|
||||
protected $lit = true;
|
||||
|
||||
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
|
||||
$this->idInfoFlattened = $idInfo;
|
||||
parent::__construct($idInfo, $name, $breakInfo);
|
||||
}
|
||||
|
||||
public function getId() : int{
|
||||
return $this->lit ? parent::getId() : $this->idInfo->getSecondId();
|
||||
return $this->lit ? parent::getId() : $this->idInfoFlattened->getSecondId();
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
parent::readStateFromData($id, $stateMeta);
|
||||
$this->lit = $id !== $this->idInfo->getSecondId();
|
||||
$this->lit = $id !== $this->idInfoFlattened->getSecondId();
|
||||
}
|
||||
|
||||
public function isLit() : bool{
|
||||
|
Reference in New Issue
Block a user