diff --git a/src/block/tile/Tile.php b/src/block/tile/Tile.php index 4afcd3f23..5fb12b184 100644 --- a/src/block/tile/Tile.php +++ b/src/block/tile/Tile.php @@ -89,8 +89,8 @@ abstract class Tile{ * @throws \RuntimeException */ public function copyDataFromItem(Item $item) : void{ - if($item->hasCustomBlockData()){ //TODO: check item root tag (MCPE doesn't use BlockEntityTag) - $this->readSaveData($item->getCustomBlockData()); + if(($blockNbt = $item->getCustomBlockData()) !== null){ //TODO: check item root tag (MCPE doesn't use BlockEntityTag) + $this->readSaveData($blockNbt); } } diff --git a/tests/phpstan/configs/l8-baseline.neon b/tests/phpstan/configs/l8-baseline.neon index da9f71477..1d158dd67 100644 --- a/tests/phpstan/configs/l8-baseline.neon +++ b/tests/phpstan/configs/l8-baseline.neon @@ -45,11 +45,6 @@ parameters: count: 1 path: ../../../src/block/tile/Chest.php - - - message: "#^Parameter \\#1 \\$nbt of method pocketmine\\\\block\\\\tile\\\\Tile\\:\\:readSaveData\\(\\) expects pocketmine\\\\nbt\\\\tag\\\\CompoundTag, pocketmine\\\\nbt\\\\tag\\\\CompoundTag\\|null given\\.$#" - count: 1 - path: ../../../src/block/tile/Tile.php - - message: "#^Parameter \\#2 \\$replace of function str_replace expects array\\|string, string\\|null given\\.$#" count: 1