22declare(strict_types=1);
24namespace pocketmine\block\utils;
30trait HorizontalFacingTrait{
31 protected int $facing = Facing::NORTH;
33 protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
34 $w->horizontalFacing($this->facing);
37 public function getFacing() : int{ return $this->facing; }
40 public function setFacing(
int $facing) : self{
41 $axis = Facing::axis($facing);
42 if($axis !== Axis::X && $axis !== Axis::Z){
43 throw new \InvalidArgumentException(
"Facing must be horizontal");
45 $this->facing = $facing;