mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Disable random ticking for some blocks depending on their states
we don't need to waste CPU time attempting to tick fully grown crops.
This commit is contained in:
parent
ca69f08da0
commit
390cc3060a
@ -99,7 +99,7 @@ class CocoaBlock extends Transparent{
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return true;
|
||||
return $this->age < self::MAX_AGE;
|
||||
}
|
||||
|
||||
public function onRandomTick() : void{
|
||||
|
@ -62,7 +62,7 @@ abstract class Crops extends Flowable{
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return true;
|
||||
return $this->age < self::MAX_AGE;
|
||||
}
|
||||
|
||||
public function onRandomTick() : void{
|
||||
|
@ -97,7 +97,7 @@ final class DoublePitcherCrop extends DoublePlant{
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return true;
|
||||
return $this->age < self::MAX_AGE && !$this->top;
|
||||
}
|
||||
|
||||
public function onRandomTick() : void{
|
||||
|
@ -110,7 +110,7 @@ class Leaves extends Transparent{
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return true;
|
||||
return !$this->noDecay && $this->checkDecay;
|
||||
}
|
||||
|
||||
public function onRandomTick() : void{
|
||||
|
@ -59,10 +59,6 @@ class NetherVines extends Flowable{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function canClimb() : bool{
|
||||
return true;
|
||||
}
|
||||
@ -98,6 +94,10 @@ class NetherVines extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return $this->age < self::MAX_AGE;
|
||||
}
|
||||
|
||||
public function onRandomTick() : void{
|
||||
if(mt_rand(1, 10) === 1 && $this->age < self::MAX_AGE){
|
||||
if($this->getSide($this->growthFace)->canBeReplaced()){
|
||||
|
@ -42,7 +42,7 @@ class NetherWartPlant extends Flowable{
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return true;
|
||||
return $this->age < self::MAX_AGE;
|
||||
}
|
||||
|
||||
public function onRandomTick() : void{
|
||||
|
@ -70,7 +70,7 @@ class RedstoneOre extends Opaque{
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return true;
|
||||
return $this->lit;
|
||||
}
|
||||
|
||||
public function onRandomTick() : void{
|
||||
|
@ -102,7 +102,7 @@ class SweetBerryBush extends Flowable{
|
||||
}
|
||||
|
||||
public function ticksRandomly() : bool{
|
||||
return true;
|
||||
return $this->age < self::STAGE_MATURE;
|
||||
}
|
||||
|
||||
public function onRandomTick() : void{
|
||||
|
Loading…
x
Reference in New Issue
Block a user