mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
PHPStan 1.9 features
This commit is contained in:
@ -396,6 +396,9 @@ class World implements ChunkManager{
|
||||
|
||||
/**
|
||||
* @phpstan-param BlockPosHash $hash
|
||||
* @phpstan-param-out int $x
|
||||
* @phpstan-param-out int $y
|
||||
* @phpstan-param-out int $z
|
||||
*/
|
||||
public static function getBlockXYZ(int $hash, ?int &$x, ?int &$y, ?int &$z) : void{
|
||||
[$baseX, $baseY, $baseZ] = morton3d_decode($hash);
|
||||
@ -410,6 +413,8 @@ class World implements ChunkManager{
|
||||
|
||||
/**
|
||||
* @phpstan-param ChunkPosHash $hash
|
||||
* @phpstan-param-out int $x
|
||||
* @phpstan-param-out int $z
|
||||
*/
|
||||
public static function getXZ(int $hash, ?int &$x, ?int &$z) : void{
|
||||
[$x, $z] = morton2d_decode($hash);
|
||||
@ -1764,6 +1769,7 @@ class World implements ChunkManager{
|
||||
* It'll try to lower the durability if Item is a tool, and set it to Air if broken.
|
||||
*
|
||||
* @param Item $item reference parameter (if null, can break anything)
|
||||
* @phpstan-param-out Item $item
|
||||
*/
|
||||
public function useBreakOn(Vector3 $vector, Item &$item = null, ?Player $player = null, bool $createParticles = false) : bool{
|
||||
$vector = $vector->floor();
|
||||
|
@ -191,6 +191,11 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
||||
return PalettedBlockArray::fromData($bitsPerBlock, $words, $palette);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param-out int $x
|
||||
* @phpstan-param-out int $y
|
||||
* @phpstan-param-out int $z
|
||||
*/
|
||||
protected static function deserializeExtraDataKey(int $chunkVersion, int $key, ?int &$x, ?int &$y, ?int &$z) : void{
|
||||
if($chunkVersion >= ChunkVersion::v1_0_0){
|
||||
$x = ($key >> 12) & 0xf;
|
||||
|
@ -276,6 +276,8 @@ class RegionLoader{
|
||||
/**
|
||||
* @param int $x reference parameter
|
||||
* @param int $z reference parameter
|
||||
* @phpstan-param-out int $x
|
||||
* @phpstan-param-out int $z
|
||||
*/
|
||||
protected static function getChunkCoords(int $offset, ?int &$x, ?int &$z) : void{
|
||||
$x = $offset & 0x1f;
|
||||
|
@ -92,6 +92,8 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
|
||||
/**
|
||||
* @param int $regionX reference parameter
|
||||
* @param int $regionZ reference parameter
|
||||
* @phpstan-param-out int $regionX
|
||||
* @phpstan-param-out int $regionZ
|
||||
*/
|
||||
public static function getRegionIndex(int $chunkX, int $chunkZ, &$regionX, &$regionZ) : void{
|
||||
$regionX = $chunkX >> 5;
|
||||
|
Reference in New Issue
Block a user