From c671d8a80b0cf496b09f02cd963432fc6c773012 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 12 Jan 2023 21:57:35 +0000 Subject: [PATCH] ItemFrame: fixed support conditions --- src/block/ItemFrame.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/block/ItemFrame.php b/src/block/ItemFrame.php index 6d92d3334..8828a8097 100644 --- a/src/block/ItemFrame.php +++ b/src/block/ItemFrame.php @@ -25,6 +25,7 @@ namespace pocketmine\block; use pocketmine\block\tile\ItemFrame as TileItemFrame; use pocketmine\block\utils\AnyFacingTrait; +use pocketmine\block\utils\SupportType; use pocketmine\data\runtime\RuntimeDataReader; use pocketmine\data\runtime\RuntimeDataWriter; use pocketmine\item\Item; @@ -165,14 +166,18 @@ class ItemFrame extends Flowable{ return true; } + private function canBeSupportedBy(Block $block, int $face) : bool{ + return !$block->getSupportType($face)->equals(SupportType::NONE()); + } + public function onNearbyBlockChange() : void{ - if(!$this->getSide(Facing::opposite($this->facing))->isSolid()){ + if(!$this->canBeSupportedBy($this->getSide(Facing::opposite($this->facing)), $this->facing)){ $this->position->getWorld()->useBreakOn($this->position); } } public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ - if(!$blockClicked->isSolid()){ + if(!$this->canBeSupportedBy($blockReplace->getSide(Facing::opposite($face)), $face)){ return false; }