Added SignLikeRotationTrait

This commit is contained in:
Dylan K. Taylor
2020-10-04 21:09:45 +01:00
parent fc1084d65c
commit dfee8b7fa5
3 changed files with 52 additions and 7 deletions

View File

@ -23,16 +23,15 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\SignLikeRotationTrait;
use pocketmine\item\Item;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function floor;
final class FloorSign extends BaseSign{
/** @var int */
protected $rotation = 0;
use SignLikeRotationTrait;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->rotation = $stateMeta;
@ -56,7 +55,7 @@ final class FloorSign extends BaseSign{
}
if($player !== null){
$this->rotation = ((int) floor((($player->getLocation()->getYaw() + 180) * 16 / 360) + 0.5)) & 0x0f;
$this->rotation = self::getRotationFromYaw($player->getLocation()->getYaw());
}
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}