mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Entity: add getHorizontalFacing(), clean up some boilerplate code
This commit is contained in:
@ -69,7 +69,7 @@ class FenceGate 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();
|
||||
}
|
||||
|
||||
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||
@ -78,7 +78,7 @@ class FenceGate extends Transparent{
|
||||
public function onActivate(Item $item, Player $player = null) : bool{
|
||||
$this->open = !$this->open;
|
||||
if($this->open and $player !== null){
|
||||
$playerFacing = Bearing::toFacing($player->getDirection());
|
||||
$playerFacing = $player->getHorizontalFacing();
|
||||
if($playerFacing === Facing::opposite($this->facing)){
|
||||
$this->facing = $playerFacing;
|
||||
}
|
||||
|
Reference in New Issue
Block a user