remove a couple more Position->getWorld() usages

This commit is contained in:
Dylan K. Taylor 2020-05-19 21:38:51 +01:00
parent 81dff6d4c5
commit 3f1f135a59
4 changed files with 4 additions and 15 deletions

View File

@ -163,7 +163,7 @@ class Block{
} }
} }
if($oldTile === null and $tileType !== null){ if($oldTile === null and $tileType !== null){
$this->pos->getWorldNonNull()->addTile(TileFactory::getInstance()->create($tileType, $this->pos->getWorld(), $this->pos->asVector3())); $this->pos->getWorldNonNull()->addTile(TileFactory::getInstance()->create($tileType, $this->pos->getWorldNonNull(), $this->pos->asVector3()));
} }
} }

View File

@ -1329,7 +1329,7 @@ abstract class Entity{
} }
public function getWorld() : World{ public function getWorld() : World{
return $this->location->getWorld(); return $this->location->getWorldNonNull();
} }
protected function setPosition(Vector3 $pos) : bool{ protected function setPosition(Vector3 $pos) : bool{

View File

@ -805,8 +805,7 @@ class NetworkSession{
public function startUsingChunk(int $chunkX, int $chunkZ, \Closure $onCompletion) : void{ public function startUsingChunk(int $chunkX, int $chunkZ, \Closure $onCompletion) : void{
Utils::validateCallableSignature(function(int $chunkX, int $chunkZ) : void{}, $onCompletion); Utils::validateCallableSignature(function(int $chunkX, int $chunkZ) : void{}, $onCompletion);
$world = $this->player->getLocation()->getWorld(); $world = $this->player->getLocation()->getWorldNonNull();
assert($world !== null);
ChunkCache::getInstance($world, $this->compressor)->request($chunkX, $chunkZ)->onResolve( ChunkCache::getInstance($world, $this->compressor)->request($chunkX, $chunkZ)->onResolve(
//this callback may be called synchronously or asynchronously, depending on whether the promise is resolved yet //this callback may be called synchronously or asynchronously, depending on whether the promise is resolved yet
@ -814,7 +813,7 @@ class NetworkSession{
if(!$this->isConnected()){ if(!$this->isConnected()){
return; return;
} }
$currentWorld = $this->player->getLocation()->getWorld(); $currentWorld = $this->player->getLocation()->getWorldNonNull();
if($world !== $currentWorld or !$this->player->isUsingChunk($chunkX, $chunkZ)){ if($world !== $currentWorld or !$this->player->isUsingChunk($chunkX, $chunkZ)){
$this->logger->debug("Tried to send no-longer-active chunk $chunkX $chunkZ in world " . $world->getFolderName()); $this->logger->debug("Tried to send no-longer-active chunk $chunkX $chunkZ in world " . $world->getFolderName());
return; return;

View File

@ -25,11 +25,6 @@ parameters:
count: 1 count: 1
path: ../../../src/block/Block.php path: ../../../src/block/Block.php
-
message: "#^Parameter \\#2 \\$world of method pocketmine\\\\block\\\\tile\\\\TileFactory\\:\\:create\\(\\) expects pocketmine\\\\world\\\\World, pocketmine\\\\world\\\\World\\|null given\\.$#"
count: 1
path: ../../../src/block/Block.php
- -
message: "#^Parameter \\#2 \\$item of method pocketmine\\\\world\\\\World\\:\\:dropItem\\(\\) expects pocketmine\\\\item\\\\Item, pocketmine\\\\item\\\\Item\\|null given\\.$#" message: "#^Parameter \\#2 \\$item of method pocketmine\\\\world\\\\World\\:\\:dropItem\\(\\) expects pocketmine\\\\item\\\\Item, pocketmine\\\\item\\\\Item\\|null given\\.$#"
count: 1 count: 1
@ -185,11 +180,6 @@ parameters:
count: 1 count: 1
path: ../../../src/entity/Entity.php path: ../../../src/entity/Entity.php
-
message: "#^Method pocketmine\\\\entity\\\\Entity\\:\\:getWorld\\(\\) should return pocketmine\\\\world\\\\World but returns pocketmine\\\\world\\\\World\\|null\\.$#"
count: 1
path: ../../../src/entity/Entity.php
- -
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\protocol\\\\AddActorPacket\\:\\:\\$type \\(string\\) does not accept string\\|null\\.$#" message: "#^Property pocketmine\\\\network\\\\mcpe\\\\protocol\\\\AddActorPacket\\:\\:\\$type \\(string\\) does not accept string\\|null\\.$#"
count: 1 count: 1