mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Block: rework addVelocityToEntity() to avoid vector3 mutation
This commit is contained in:
@ -234,13 +234,11 @@ abstract class Liquid extends Transparent{
|
||||
return $this->flowVector = $vector->normalize();
|
||||
}
|
||||
|
||||
public function addVelocityToEntity(Entity $entity, Vector3 $vector) : void{
|
||||
public function addVelocityToEntity(Entity $entity) : ?Vector3{
|
||||
if($entity->canBeMovedByCurrents()){
|
||||
$flow = $this->getFlowVector();
|
||||
$vector->x += $flow->x;
|
||||
$vector->y += $flow->y;
|
||||
$vector->z += $flow->z;
|
||||
return $this->getFlowVector();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
abstract public function tickRate() : int;
|
||||
|
Reference in New Issue
Block a user