Eradicate remaining usages of Position->getWorld()

This commit is contained in:
Dylan K. Taylor 2020-06-29 21:03:55 +01:00
parent 43ae1a5cb4
commit fc22fd80d8
4 changed files with 5 additions and 5 deletions

View File

@ -79,7 +79,7 @@ class Block{
}
public function __clone(){
$this->pos = Position::fromObject($this->pos, $this->pos->getWorld());
$this->pos = Position::fromObject($this->pos, $this->pos->getWorldNonNull());
}
public function getIdInfo() : BlockIdentifier{

View File

@ -713,7 +713,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
}
protected function switchWorld(World $targetWorld) : bool{
$oldWorld = $this->location->getWorld();
$oldWorld = $this->location->isValid() ? $this->location->getWorldNonNull() : null;
if(parent::switchWorld($targetWorld)){
if($oldWorld !== null){
foreach($this->usedChunks as $index => $status){

View File

@ -119,7 +119,7 @@ class Position extends Vector3{
public function equals(Vector3 $v) : bool{
if($v instanceof Position){
return parent::equals($v) and $v->getWorld() === $this->getWorld();
return parent::equals($v) and $v->world === $this->world;
}
return parent::equals($v);
}

View File

@ -2043,7 +2043,7 @@ class World implements ChunkManager{
throw new \InvalidArgumentException("Attempted to add a garbage closed Tile to world");
}
$pos = $tile->getPos();
if($pos->getWorld() !== $this){
if(!$pos->isValid() || $pos->getWorldNonNull() !== $this){
throw new \InvalidArgumentException("Invalid Tile world");
}
@ -2065,7 +2065,7 @@ class World implements ChunkManager{
*/
public function removeTile(Tile $tile) : void{
$pos = $tile->getPos();
if($pos->getWorld() !== $this){
if(!$pos->isValid() || $pos->getWorldNonNull() !== $this){
throw new \InvalidArgumentException("Invalid Tile world");
}