Avoid more Vector3 mutations using withComponents()

This commit is contained in:
Dylan K. Taylor
2020-09-25 18:40:13 +01:00
parent 1d8e7abdd4
commit db7fb25196
3 changed files with 12 additions and 22 deletions

View File

@ -288,7 +288,7 @@ abstract class Living extends Entity{
*/
public function jump() : void{
if($this->onGround){
$this->motion->y = $this->getJumpVelocity(); //Y motion should already be 0 if we're jumping from the ground.
$this->motion = $this->motion->withComponents(null, $this->getJumpVelocity(), null); //Y motion should already be 0 if we're jumping from the ground.
}
}