Merge branch 'minor-next' into major-next

This commit is contained in:
Dylan K. Taylor
2023-03-20 22:12:54 +00:00
12 changed files with 169 additions and 88 deletions

View File

@ -163,7 +163,8 @@ abstract class Projectile extends Entity{
protected function move(float $dx, float $dy, float $dz) : void{
$this->blocksAround = null;
Timings::$entityMove->startTiming();
Timings::$projectileMove->startTiming();
Timings::$projectileMoveRayTrace->startTiming();
$start = $this->location->asVector3();
$end = $start->add($dx, $dy, $dz);
@ -209,6 +210,8 @@ abstract class Projectile extends Entity{
}
}
Timings::$projectileMoveRayTrace->stopTiming();
$this->location = Location::fromObject(
$end,
$this->location->world,
@ -240,7 +243,7 @@ abstract class Projectile extends Entity{
}
$this->isCollided = $this->onGround = true;
$this->motion = new Vector3(0, 0, 0);
$this->motion = Vector3::zero();
}else{
$this->isCollided = $this->onGround = false;
$this->blockHit = null;
@ -256,7 +259,7 @@ abstract class Projectile extends Entity{
$this->getWorld()->onEntityMoved($this);
$this->checkBlockIntersections();
Timings::$entityMove->stopTiming();
Timings::$projectileMove->stopTiming();
}
/**