Cleanup Entity age handling, fixed arrows despawning too quickly after long flight

This commit is contained in:
Dylan K. Taylor
2018-09-08 14:23:06 +01:00
parent a3b78236eb
commit c7d58db7eb
9 changed files with 39 additions and 35 deletions

View File

@ -88,6 +88,9 @@ class ExperienceOrb extends Entity{
public $gravity = 0.04;
public $drag = 0.02;
/** @var int */
protected $age = 0;
/**
* @var int
* Ticker used for determining interval in which to look for new target players.
@ -159,6 +162,7 @@ class ExperienceOrb extends Entity{
public function entityBaseTick(int $tickDiff = 1) : bool{
$hasUpdate = parent::entityBaseTick($tickDiff);
$this->age += $tickDiff;
if($this->age > 6000){
$this->flagForDespawn();
return true;