From eb935ca80f7098a0e711bc1dbb78b44ab59e3420 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 20 Oct 2023 11:20:30 +0100 Subject: [PATCH] =?UTF-8?q?=C3=82Leaves:=20use=20a=20constant=20for=20max?= =?UTF-8?q?=20distance=20from=20wood?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/block/Leaves.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/block/Leaves.php b/src/block/Leaves.php index 0aa3557a4..7fe9eae74 100644 --- a/src/block/Leaves.php +++ b/src/block/Leaves.php @@ -38,6 +38,8 @@ use pocketmine\world\World; use function mt_rand; class Leaves extends Transparent{ + private const MAX_LOG_DISTANCE = 4; + protected LeavesType $leavesType; //immutable for now protected bool $noDecay = false; protected bool $checkDecay = false; @@ -91,7 +93,7 @@ class Leaves extends Transparent{ return true; } - if($block instanceof Leaves && $distance <= 4){ + if($block instanceof Leaves && $distance <= self::MAX_LOG_DISTANCE){ foreach(Facing::ALL as $side){ if($this->findLog($pos->getSide($side), $visited, $distance + 1)){ return true;