22declare(strict_types=1);
32 public const MIN_LIGHT_LEVEL = 0;
33 public const MAX_LIGHT_LEVEL = 15;
35 private int $level = self::MAX_LIGHT_LEVEL;
38 $w->boundedIntAuto(self::MIN_LIGHT_LEVEL, self::MAX_LIGHT_LEVEL, $this->level);
45 if($level < self::MIN_LIGHT_LEVEL || $level > self::MAX_LIGHT_LEVEL){
46 throw new \InvalidArgumentException(
"Light level must be in the range " . self::MIN_LIGHT_LEVEL .
" ... " . self::MAX_LIGHT_LEVEL);
48 $this->level = $level;
56 return $blockReplace->canBeReplaced() && $blockReplace->getTypeId() !== $this->getTypeId();
60 $this->level = $this->level === self::MAX_LIGHT_LEVEL ?
61 self::MIN_LIGHT_LEVEL :
64 $this->position->getWorld()->setBlock($this->position, $this);
onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player=null, array &$returnedItems=[])
canBePlacedAt(Block $blockReplace, Vector3 $clickVector, int $face, bool $isClickedBlock)
describeBlockItemState(RuntimeDataDescriber $w)
setLightLevel(int $level)