mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
block: added HorizontalFacingTrait and AnyFacingTrait
these are primarily intended for deduplication of code and ability to cross-reference. Don't expect this API to remain the same.
This commit is contained in:
@ -25,6 +25,7 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\tile\ItemFrame as TileItemFrame;
|
||||
use pocketmine\block\utils\BlockDataSerializer;
|
||||
use pocketmine\block\utils\HorizontalFacingTrait;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
@ -33,10 +34,10 @@ use pocketmine\world\BlockTransaction;
|
||||
use function lcg_value;
|
||||
|
||||
class ItemFrame extends Flowable{
|
||||
use HorizontalFacingTrait;
|
||||
|
||||
public const ROTATIONS = 8;
|
||||
|
||||
/** @var int */
|
||||
protected $facing = Facing::NORTH;
|
||||
/** @var bool */
|
||||
protected $hasMap = false; //makes frame appear large if set
|
||||
/** @var Item|null */
|
||||
@ -86,14 +87,6 @@ class ItemFrame extends Flowable{
|
||||
return 0b111;
|
||||
}
|
||||
|
||||
public function getFacing() : int{
|
||||
return $this->facing;
|
||||
}
|
||||
|
||||
public function setFacing(int $facing) : void{
|
||||
$this->facing = $facing;
|
||||
}
|
||||
|
||||
public function getFramedItem() : ?Item{
|
||||
return $this->framedItem !== null ? clone $this->framedItem : null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user