lit ? $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; } /** * @param bool $lit * * @return $this */ public function setLit(bool $lit = true) : self{ $this->lit = $lit; return $this; } public function getLightLevel() : int{ return $this->lit ? 9 : 0; } public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ return $this->getWorld()->setBlock($this, $this, false); } public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ if(!$this->lit){ $this->lit = true; $this->getWorld()->setBlock($this, $this); //no return here - this shouldn't prevent block placement } return false; } public function onNearbyBlockChange() : void{ if(!$this->lit){ $this->lit = true; $this->getWorld()->setBlock($this, $this); } } public function ticksRandomly() : bool{ return true; } public function onRandomTick() : void{ if($this->lit){ $this->lit = false; $this->world->setBlock($this, $this); } } public function getDropsForCompatibleTool(Item $item) : array{ return [ ItemFactory::get(Item::REDSTONE_DUST, 0, mt_rand(4, 5)) ]; } protected function getXpDropAmount() : int{ return mt_rand(1, 5); } }