enum($this->facing); $w->boundedIntAuto(self::MIN_DELAY, self::MAX_DELAY, $this->delay); $w->bool($this->powered); } public function getDelay() : int{ return $this->delay; } /** @return $this */ public function setDelay(int $delay) : self{ if($delay < self::MIN_DELAY || $delay > self::MAX_DELAY){ throw new \InvalidArgumentException("Delay must be in range " . self::MIN_DELAY . " ... " . self::MAX_DELAY); } $this->delay = $delay; return $this; } protected function recalculateCollisionBoxes() : array{ return [AxisAlignedBB::one()->trimmedCopy(Facing::UP, 7 / 8)]; } public function onInteract(Item $item, Facing $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{ if(++$this->delay > self::MAX_DELAY){ $this->delay = self::MIN_DELAY; } $this->position->getWorld()->setBlock($this->position, $this); return true; } private function canBeSupportedAt(Block $block) : bool{ return $block->getAdjacentSupportType(Facing::DOWN) !== SupportType::NONE; } //TODO: redstone functionality }