Further (major!) performance enhancements to entity ticking

This commit is contained in:
Dylan K. Taylor 2017-08-21 20:28:30 +01:00
parent b8ade18888
commit c32b75fa18

View File

@ -1097,7 +1097,6 @@ abstract class Entity extends Location implements Metadatable{
public function entityBaseTick(int $tickDiff = 1) : bool{
//TODO: check vehicles
$this->blocksAround = null;
$this->justCreated = false;
if(!$this->isAlive()){
@ -1313,6 +1312,8 @@ abstract class Entity extends Location implements Metadatable{
final public function setForceMovementUpdate(bool $value = true){
$this->forceMovementUpdate = $value;
$this->onGround = false;
$this->blocksAround = null;
}
/**
@ -1473,6 +1474,8 @@ abstract class Entity extends Location implements Metadatable{
}
public function fastMove(float $dx, float $dy, float $dz) : bool{
$this->blocksAround = null;
if($dx == 0 and $dz == 0 and $dy == 0){
return true;
}
@ -1512,13 +1515,12 @@ abstract class Entity extends Location implements Metadatable{
}
public function move(float $dx, float $dy, float $dz) : bool{
$this->blocksAround = null;
if($dx == 0 and $dz == 0 and $dy == 0){
return true;
}
$this->blocksAround = null;
if($this->keepMovement){
$this->boundingBox->offset($dx, $dy, $dz);
$this->setPosition($this->temporalVector->setComponents(($this->boundingBox->minX + $this->boundingBox->maxX) / 2, $this->boundingBox->minY, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2));