Entity: Protect internal methods setPosition() and setPositionAndRotation()

teleport() should be used instead (or setRotation() for rotation-only changes).
This commit is contained in:
Dylan K. Taylor 2019-05-07 17:38:33 +01:00
parent 00944eff72
commit 66481fedeb

View File

@ -1412,7 +1412,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
return $this->asLocation(); return $this->asLocation();
} }
public function setPosition(Vector3 $pos) : bool{ protected function setPosition(Vector3 $pos) : bool{
if($this->closed){ if($this->closed){
return false; return false;
} }
@ -1442,7 +1442,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
$this->scheduleUpdate(); $this->scheduleUpdate();
} }
public function setPositionAndRotation(Vector3 $pos, float $yaw, float $pitch) : bool{ protected function setPositionAndRotation(Vector3 $pos, float $yaw, float $pitch) : bool{
if($this->setPosition($pos)){ if($this->setPosition($pos)){
$this->setRotation($yaw, $pitch); $this->setRotation($yaw, $pitch);