mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
replacing new Vector3(0, 0, 0) with Vector3::zero() (#5640)
This commit is contained in:
parent
f696a5881b
commit
2751e1ec02
@ -246,7 +246,7 @@ abstract class Entity{
|
||||
if($nbt !== null){
|
||||
$this->motion = EntityDataHelper::parseVec3($nbt, self::TAG_MOTION, true);
|
||||
}else{
|
||||
$this->motion = new Vector3(0, 0, 0);
|
||||
$this->motion = Vector3::zero();
|
||||
}
|
||||
|
||||
$this->resetLastMovements();
|
||||
|
@ -80,7 +80,7 @@ final class EntityDataHelper{
|
||||
public static function parseVec3(CompoundTag $nbt, string $tagName, bool $optional) : Vector3{
|
||||
$pos = $nbt->getTag($tagName);
|
||||
if($pos === null && $optional){
|
||||
return new Vector3(0, 0, 0);
|
||||
return Vector3::zero();
|
||||
}
|
||||
if(!($pos instanceof ListTag) || ($pos->getTagType() !== NBT::TAG_Double && $pos->getTagType() !== NBT::TAG_Float)){
|
||||
throw new SavedDataLoadingException("'$tagName' should be a List<Double> or List<Float>");
|
||||
|
@ -255,7 +255,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;
|
||||
|
@ -59,7 +59,7 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
|
||||
$this->player = $player;
|
||||
$this->item = $item;
|
||||
$this->blockTouched = $block;
|
||||
$this->touchVector = $touchVector ?? new Vector3(0, 0, 0);
|
||||
$this->touchVector = $touchVector ?? Vector3::zero();
|
||||
$this->blockFace = $face;
|
||||
$this->action = $action;
|
||||
}
|
||||
|
@ -1376,7 +1376,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
if($this->spawned){
|
||||
Timings::$playerMove->startTiming();
|
||||
$this->processMostRecentMovements();
|
||||
$this->motion = new Vector3(0, 0, 0); //TODO: HACK! (Fixes player knockback being messed up)
|
||||
$this->motion = Vector3::zero(); //TODO: HACK! (Fixes player knockback being messed up)
|
||||
if($this->onGround){
|
||||
$this->inAirTicks = 0;
|
||||
}else{
|
||||
|
Loading…
x
Reference in New Issue
Block a user