PhpStorm inspections

Fixed some minor bugs and dropped some obsolete code

pocketmine\level\generator namespace is ignored in this commit
This commit is contained in:
SOFe
2016-10-21 22:38:49 +08:00
committed by Dylan K. Taylor
parent e790573f2e
commit 175dd0efa6
21 changed files with 46 additions and 38 deletions

View File

@ -287,6 +287,11 @@ class Level implements ChunkManager, Metadatable{
}
}
/**
* @param string|int $hash
* @param int|null $x
* @param int|null $z
*/
public static function getXZ($hash, &$x, &$z){
if(PHP_INT_SIZE === 8){
$x = ($hash >> 32) << 32 >> 32;
@ -1785,7 +1790,7 @@ class Level implements ChunkManager, Metadatable{
* Returns the entities colliding the current one inside the AxisAlignedBB
*
* @param AxisAlignedBB $bb
* @param Entity $entity
* @param Entity|null $entity
*
* @return Entity[]
*/
@ -2316,8 +2321,6 @@ class Level implements ChunkManager, Metadatable{
if(count($this->chunkSendQueue) > 0){
$this->timings->syncChunkSendTimer->startTiming();
$x = null;
$z = null;
foreach($this->chunkSendQueue as $index => $players){
if(isset($this->chunkSendTasks[$index])){
continue;
@ -2778,9 +2781,6 @@ class Level implements ChunkManager, Metadatable{
public function doChunkGarbageCollection(){
$this->timings->doChunkGC->startTiming();
$X = null;
$Z = null;
foreach($this->chunks as $index => $chunk){
if(!isset($this->unloadQueue[$index]) and (!isset($this->usedChunks[$index]) or count($this->usedChunks[$index]) === 0)){
Level::getXZ($index, $X, $Z);

View File

@ -50,9 +50,11 @@ class Location extends Position{
* @param Level|null $level default null
* @param float $yaw default 0.0
* @param float $pitch default 0.0
*
* @return Location
*/
public static function fromObject(Vector3 $pos, Level $level = null, $yaw = 0.0, $pitch = 0.0){
return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, ($level === null) ? (($pos instanceof Position) ? $pos->level : null) : $level);
return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, $level ?? (($pos instanceof Position) ? $pos->level : null));
}
public function getYaw(){

View File

@ -84,6 +84,7 @@ abstract class BaseFullChunk implements FullChunk{
* @param int[] $heightMap
* @param CompoundTag[] $entities
* @param CompoundTag[] $tiles
* @param int[] $extraData
*/
protected function __construct($provider, $x, $z, $blocks, $data, $skyLight, $blockLight, array $biomeColors = [], array $heightMap = [], array $entities = [], array $tiles = [], array $extraData = []){
$this->provider = $provider;