33 public const MAX_AGE = 3;
36 $this->position->getWorld()->scheduleDelayedBlockUpdate($this->position, mt_rand(20, 40));
40 $world = $this->position->getWorld();
41 if((!$this->checkAdjacentBlocks(4) || mt_rand(0, 2) === 0) &&
42 $world->getHighestAdjacentFullLightAt($this->position->x, $this->position->y, $this->position->z) >= 12 - $this->age){
44 foreach($this->getAllSides() as $block){
45 if($block instanceof FrostedIce){
51 $world->scheduleDelayedBlockUpdate($this->position, mt_rand(20, 40));
56 $this->onRandomTick();
59 private function checkAdjacentBlocks(
int $requirement) : bool{
61 for($x = -1; $x <= 1; ++$x){
62 for($z = -1; $z <= 1; ++$z){
63 if($x === 0 && $z === 0){
67 $this->position->getWorld()->getBlockAt($this->position->x + $x, $this->position->y, $this->position->z + $z) instanceof
FrostedIce &&
68 ++$found >= $requirement
82 private function tryMelt() : bool{
83 $world = $this->position->getWorld();
84 if($this->age >= self::MAX_AGE){
85 BlockEventHelper::melt($this, VanillaBlocks::WATER());
90 $world->setBlock($this->position, $this);
91 $world->scheduleDelayedBlockUpdate($this->position, mt_rand(20, 40));