RedstoneLamp: implement Lightable, shimmed to powered

This commit is contained in:
Dylan K. Taylor 2025-08-22 18:27:32 +01:00
parent e824266457
commit 47140cb8d7
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -23,11 +23,12 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Lightable;
use pocketmine\block\utils\PoweredByRedstone;
use pocketmine\block\utils\PoweredByRedstoneTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
class RedstoneLamp extends Opaque implements PoweredByRedstone{
class RedstoneLamp extends Opaque implements PoweredByRedstone, Lightable{
use PoweredByRedstoneTrait;
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
@ -37,4 +38,14 @@ class RedstoneLamp extends Opaque implements PoweredByRedstone{
public function getLightLevel() : int{
return $this->powered ? 15 : 0;
}
public function isLit() : bool{
return $this->powered;
}
/** @return $this */
public function setLit(bool $lit = true) : self{
$this->powered = $lit;
return $this;
}
}