diff --git a/src/entity/object/Painting.php b/src/entity/object/Painting.php index 8aa53f6aa..3ccb6b100 100644 --- a/src/entity/object/Painting.php +++ b/src/entity/object/Painting.php @@ -70,11 +70,11 @@ class Painting extends Entity{ protected $blockIn; /** @var int */ protected $facing = Facing::NORTH; - /** @var string */ + /** @var PaintingMotive */ protected $motive; public function __construct(Location $location, Vector3 $blockIn, int $facing, PaintingMotive $motive, ?CompoundTag $nbt = null){ - $this->motive = $motive->getName(); //TODO: use motive directly + $this->motive = $motive; $this->blockIn = $blockIn->asVector3(); $this->facing = $facing; parent::__construct($location, $nbt); @@ -95,7 +95,7 @@ class Painting extends Entity{ $nbt->setByte("Facing", self::FACING_TO_DATA[$this->facing]); $nbt->setByte("Direction", self::FACING_TO_DATA[$this->facing]); //Save both for full compatibility - $nbt->setString("Motive", $this->motive); + $nbt->setString("Motive", $this->motive->getName()); return $nbt; } @@ -153,7 +153,7 @@ class Painting extends Entity{ ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2 ); $pk->direction = self::FACING_TO_DATA[$this->facing]; - $pk->title = $this->motive; + $pk->title = $this->motive->getName(); $player->getNetworkSession()->sendDataPacket($pk); } @@ -162,7 +162,7 @@ class Painting extends Entity{ * Returns the painting motive (which image is displayed on the painting) */ public function getMotive() : PaintingMotive{ - return PaintingMotive::getMotiveByName($this->motive); + return $this->motive; } public function getFacing() : int{ diff --git a/tests/phpstan/configs/l8-baseline.neon b/tests/phpstan/configs/l8-baseline.neon index d7379254a..f25a71493 100644 --- a/tests/phpstan/configs/l8-baseline.neon +++ b/tests/phpstan/configs/l8-baseline.neon @@ -145,11 +145,6 @@ parameters: count: 1 path: ../../../src/entity/Living.php - - - message: "#^Method pocketmine\\\\entity\\\\object\\\\Painting\\:\\:getMotive\\(\\) should return pocketmine\\\\entity\\\\object\\\\PaintingMotive but returns pocketmine\\\\entity\\\\object\\\\PaintingMotive\\|null\\.$#" - count: 1 - path: ../../../src/entity/object/Painting.php - - message: "#^Cannot call method getEffectLevel\\(\\) on pocketmine\\\\entity\\\\effect\\\\EffectInstance\\|null\\.$#" count: 2