mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Remove some more Vector3 mutations
This commit is contained in:
parent
c040248dbd
commit
ff00595a48
@ -1270,11 +1270,8 @@ abstract class Entity{
|
||||
}
|
||||
|
||||
if($vector->lengthSquared() > 0){
|
||||
$vector = $vector->normalize();
|
||||
$d = 0.014;
|
||||
$this->motion->x += $vector->x * $d;
|
||||
$this->motion->y += $vector->y * $d;
|
||||
$this->motion->z += $vector->z * $d;
|
||||
$this->motion = $this->motion->addVector($vector->normalize()->multiply($d));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1392,9 +1389,7 @@ abstract class Entity{
|
||||
* Adds the given values to the entity's motion vector.
|
||||
*/
|
||||
public function addMotion(float $x, float $y, float $z) : void{
|
||||
$this->motion->x += $x;
|
||||
$this->motion->y += $y;
|
||||
$this->motion->z += $z;
|
||||
$this->motion = $this->motion->add($x, $y, $z);
|
||||
}
|
||||
|
||||
public function isOnGround() : bool{
|
||||
|
@ -195,11 +195,7 @@ class ExperienceOrb extends Entity{
|
||||
|
||||
$distance = $vector->lengthSquared();
|
||||
if($distance < 1){
|
||||
$diff = $vector->normalize()->multiply(0.2 * (1 - sqrt($distance)) ** 2);
|
||||
|
||||
$this->motion->x += $diff->x;
|
||||
$this->motion->y += $diff->y;
|
||||
$this->motion->z += $diff->z;
|
||||
$this->motion = $this->motion->addVector($vector->normalize()->multiply(0.2 * (1 - sqrt($distance)) ** 2));
|
||||
}
|
||||
|
||||
if($currentTarget->getXpManager()->canPickupXp() and $this->boundingBox->intersectsWith($currentTarget->getBoundingBox())){
|
||||
|
@ -247,7 +247,7 @@ abstract class Projectile extends Entity{
|
||||
}
|
||||
|
||||
$this->isCollided = $this->onGround = true;
|
||||
$this->motion->x = $this->motion->y = $this->motion->z = 0;
|
||||
$this->motion = new Vector3(0, 0, 0);
|
||||
}else{
|
||||
$this->isCollided = $this->onGround = false;
|
||||
$this->blockHit = null;
|
||||
|
@ -1340,7 +1340,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
|
||||
if($this->spawned){
|
||||
$this->processMostRecentMovements();
|
||||
$this->motion->x = $this->motion->y = $this->motion->z = 0; //TODO: HACK! (Fixes player knockback being messed up)
|
||||
$this->motion = new Vector3(0, 0, 0); //TODO: HACK! (Fixes player knockback being messed up)
|
||||
if($this->onGround){
|
||||
$this->inAirTicks = 0;
|
||||
}else{
|
||||
|
Loading…
x
Reference in New Issue
Block a user