mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-18 15:05:56 +00:00
Stub PalettedBlockArray functions that work with arrays
and workaround PHPStan stupidity
This commit is contained in:
parent
4a83920db9
commit
5e0f03dff0
@ -45,6 +45,7 @@ parameters:
|
||||
- pocketmine\DEBUG
|
||||
- pocketmine\IS_DEVELOPMENT_BUILD
|
||||
stubFiles:
|
||||
- tests/phpstan/stubs/chunkutils2.stub
|
||||
- tests/phpstan/stubs/JsonMapper.stub
|
||||
- tests/phpstan/stubs/leveldb.stub
|
||||
- tests/phpstan/stubs/pmmpthread.stub
|
||||
|
@ -83,11 +83,11 @@ abstract class BaseWorldProvider implements WorldProvider{
|
||||
}
|
||||
|
||||
try{
|
||||
$newPalette[$k] = $this->blockStateDeserializer->deserialize($newStateData);
|
||||
$newPalette[] = $this->blockStateDeserializer->deserialize($newStateData);
|
||||
}catch(BlockStateDeserializeException $e){
|
||||
//this should never happen anyway - if the upgrader returned an invalid state, we have bigger problems
|
||||
$blockDecodeErrors[] = "Palette offset $k / Failed to deserialize upgraded state $id:$meta: " . $e->getMessage();
|
||||
$newPalette[$k] = $this->blockStateDeserializer->deserialize(GlobalBlockStateHandlers::getUnknownBlockStateData());
|
||||
$newPalette[] = $this->blockStateDeserializer->deserialize(GlobalBlockStateHandlers::getUnknownBlockStateData());
|
||||
}
|
||||
}
|
||||
|
||||
|
15
tests/phpstan/stubs/chunkutils2.stub
Normal file
15
tests/phpstan/stubs/chunkutils2.stub
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace pocketmine\world\format;
|
||||
|
||||
final class PalettedBlockArray{
|
||||
/**
|
||||
* @param list<int> $palette
|
||||
*/
|
||||
public static function fromData(int $bitsPerBlock, string $wordArray, array $palette): PalettedBlockArray {}
|
||||
|
||||
/**
|
||||
* @return list<int>
|
||||
*/
|
||||
public function getPalette(): array {}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user