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

@ -24,7 +24,6 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\math\Bearing;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
@ -94,7 +93,7 @@ class Lever extends Flowable{
if(Facing::axis($face) === Facing::AXIS_Y){
if($player !== null){
$this->facing = Bearing::toFacing(Bearing::opposite($player->getDirection()));
$this->facing = Facing::opposite($player->getHorizontalFacing());
}
$this->position = $face === Facing::DOWN ? self::BOTTOM : self::TOP;
}else{