mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 10:19:39 +00:00
Leaves: make more findLog() params optional
This commit is contained in:
parent
fee42e9f34
commit
3b772f54e9
@ -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;
|
$index = $pos->x . "." . $pos->y . "." . $pos->z;
|
||||||
if(isset($visited[$index])){
|
if(isset($visited[$index])){
|
||||||
return false;
|
return false;
|
||||||
@ -111,11 +111,10 @@ class Leaves extends Transparent{
|
|||||||
public function onRandomTick() : void{
|
public function onRandomTick() : void{
|
||||||
if(($this->meta & 0b00001100) === 0x08){
|
if(($this->meta & 0b00001100) === 0x08){
|
||||||
$this->meta &= 0x03;
|
$this->meta &= 0x03;
|
||||||
$visited = [];
|
|
||||||
|
|
||||||
$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new LeavesDecayEvent($this));
|
$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);
|
$this->getLevel()->setBlock($this, $this, false, false);
|
||||||
}else{
|
}else{
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user