Stub PalettedBlockArray functions that work with arrays

and workaround PHPStan stupidity
This commit is contained in:
Dylan K. Taylor 2025-01-08 01:48:15 +00:00
parent 4a83920db9
commit 5e0f03dff0
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 18 additions and 2 deletions

View File

@ -45,6 +45,7 @@ parameters:
- pocketmine\DEBUG - pocketmine\DEBUG
- pocketmine\IS_DEVELOPMENT_BUILD - pocketmine\IS_DEVELOPMENT_BUILD
stubFiles: stubFiles:
- tests/phpstan/stubs/chunkutils2.stub
- tests/phpstan/stubs/JsonMapper.stub - tests/phpstan/stubs/JsonMapper.stub
- tests/phpstan/stubs/leveldb.stub - tests/phpstan/stubs/leveldb.stub
- tests/phpstan/stubs/pmmpthread.stub - tests/phpstan/stubs/pmmpthread.stub

View File

@ -83,11 +83,11 @@ abstract class BaseWorldProvider implements WorldProvider{
} }
try{ try{
$newPalette[$k] = $this->blockStateDeserializer->deserialize($newStateData); $newPalette[] = $this->blockStateDeserializer->deserialize($newStateData);
}catch(BlockStateDeserializeException $e){ }catch(BlockStateDeserializeException $e){
//this should never happen anyway - if the upgrader returned an invalid state, we have bigger problems //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(); $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());
} }
} }

View 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 {}
}