coralType = CoralType::TUBE(); } public function getCoralType() : CoralType{ return $this->coralType; } /** @return $this */ public function setCoralType(CoralType $coralType) : self{ $this->coralType = $coralType; return $this; } public function isDead() : bool{ return $this->dead; } /** @return $this */ public function setDead(bool $dead) : self{ $this->dead = $dead; return $this; } public function onNearbyBlockChange() : void{ if(!$this->dead){ $world = $this->position->getWorld(); $hasWater = false; foreach($this->position->sides() as $vector3){ if($world->getBlock($vector3) instanceof Water){ $hasWater = true; break; } } //TODO: check water inside the block itself (not supported on the API yet) if(!$hasWater){ $world->setBlock($this->position, $this->setDead(true)); } } } public function getDropsForCompatibleTool(Item $item) : array{ return []; } public function isAffectedBySilkTouch() : bool{ return true; } public function isSolid() : bool{ return false; } protected function recalculateCollisionBoxes() : array{ return []; } }