Entity: add getHorizontalFacing(), clean up some boilerplate code

This commit is contained in:
Dylan K. Taylor
2018-12-05 20:27:43 +00:00
parent f60d13548e
commit 39e383a175
14 changed files with 20 additions and 23 deletions

View File

@ -25,7 +25,6 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Bearing;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\Player;
@ -108,7 +107,7 @@ abstract class Stair extends Transparent{
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
if($player !== null){
$this->facing = Bearing::toFacing($player->getDirection());
$this->facing = $player->getHorizontalFacing();
}
$this->upsideDown = (($clickVector->y > 0.5 and $face !== Facing::UP) or $face === Facing::DOWN);