mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 18:41:47 +00:00
ItemFrame: fixed support conditions
This commit is contained in:
parent
ca1f1bf09f
commit
c671d8a80b
@ -25,6 +25,7 @@ namespace pocketmine\block;
|
|||||||
|
|
||||||
use pocketmine\block\tile\ItemFrame as TileItemFrame;
|
use pocketmine\block\tile\ItemFrame as TileItemFrame;
|
||||||
use pocketmine\block\utils\AnyFacingTrait;
|
use pocketmine\block\utils\AnyFacingTrait;
|
||||||
|
use pocketmine\block\utils\SupportType;
|
||||||
use pocketmine\data\runtime\RuntimeDataReader;
|
use pocketmine\data\runtime\RuntimeDataReader;
|
||||||
use pocketmine\data\runtime\RuntimeDataWriter;
|
use pocketmine\data\runtime\RuntimeDataWriter;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
@ -165,14 +166,18 @@ class ItemFrame extends Flowable{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function canBeSupportedBy(Block $block, int $face) : bool{
|
||||||
|
return !$block->getSupportType($face)->equals(SupportType::NONE());
|
||||||
|
}
|
||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
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);
|
$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{
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user