ÂLeaves: use a constant for max distance from wood

This commit is contained in:
Dylan K. Taylor 2023-10-20 11:20:30 +01:00
parent dbb5a32a96
commit eb935ca80f
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -38,6 +38,8 @@ use pocketmine\world\World;
use function mt_rand; use function mt_rand;
class Leaves extends Transparent{ class Leaves extends Transparent{
private const MAX_LOG_DISTANCE = 4;
protected LeavesType $leavesType; //immutable for now protected LeavesType $leavesType; //immutable for now
protected bool $noDecay = false; protected bool $noDecay = false;
protected bool $checkDecay = false; protected bool $checkDecay = false;
@ -91,7 +93,7 @@ class Leaves extends Transparent{
return true; return true;
} }
if($block instanceof Leaves && $distance <= 4){ if($block instanceof Leaves && $distance <= self::MAX_LOG_DISTANCE){
foreach(Facing::ALL as $side){ foreach(Facing::ALL as $side){
if($this->findLog($pos->getSide($side), $visited, $distance + 1)){ if($this->findLog($pos->getSide($side), $visited, $distance + 1)){
return true; return true;