From 3b772f54e94fcfd5db6be4852caaef87af49a723 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 13 Sep 2018 16:49:22 +0100 Subject: [PATCH] Leaves: make more findLog() params optional --- src/pocketmine/block/Leaves.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/block/Leaves.php b/src/pocketmine/block/Leaves.php index b7c1fa9e8..aadc9b7ab 100644 --- a/src/pocketmine/block/Leaves.php +++ b/src/pocketmine/block/Leaves.php @@ -68,7 +68,7 @@ class Leaves extends Transparent{ } - protected function findLog(Block $pos, array $visited, int $distance, ?int $fromSide = null) : bool{ + protected function findLog(Block $pos, array $visited = [], int $distance = 0, ?int $fromSide = null) : bool{ $index = $pos->x . "." . $pos->y . "." . $pos->z; if(isset($visited[$index])){ return false; @@ -111,11 +111,10 @@ class Leaves extends Transparent{ public function onRandomTick() : void{ if(($this->meta & 0b00001100) === 0x08){ $this->meta &= 0x03; - $visited = []; $this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new LeavesDecayEvent($this)); - if($ev->isCancelled() or $this->findLog($this, $visited, 0)){ + if($ev->isCancelled() or $this->findLog($this)){ $this->getLevel()->setBlock($this, $this, false, false); }else{ $this->getLevel()->useBreakOn($this);