mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 20:28:31 +00:00
ÂLeaves: use a constant for max distance from wood
This commit is contained in:
parent
dbb5a32a96
commit
eb935ca80f
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user