From c812ae0488c30bdd50a5086f32707a6c25ca9bdc Mon Sep 17 00:00:00 2001 From: ArkQuark <74979909+ArkQuark@users.noreply.github.com> Date: Fri, 21 Jan 2022 15:38:57 +0300 Subject: [PATCH] Update FenceGate.php --- src/material/block/nonfull/FenceGate.php | 28 +++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/material/block/nonfull/FenceGate.php b/src/material/block/nonfull/FenceGate.php index 6f54ee57..91226fbc 100644 --- a/src/material/block/nonfull/FenceGate.php +++ b/src/material/block/nonfull/FenceGate.php @@ -46,20 +46,18 @@ class FenceGateBlock extends TransparentBlock{ array($this->id, 0, 1), ); } - public function onActivate(Item $item, Player $player){ - $faces = array( - 0 => 3, - 1 => 0, - 2 => 1, - 3 => 2, - ); - $this->meta = ($faces[$player->entity->getDirection()] & 0x03) | ((~$this->meta) & 0x04); - if(($this->meta & 0x04) === 0x04){ - $this->isFullBlock = true; - }else{ - $this->isFullBlock = false; - } - $this->level->setBlock($this, $this, true, false, true); + public function onActivate(Item $item, Player $player){ + $this->meta ^= 0x04; + $this->level->setBlock($this, $this, true, false, true); + $players = ServerAPI::request()->api->player->getAll($this->level); + unset($players[$player->CID]); + $pk = new LevelEventPacket; + $pk->x = $this->x; + $pk->y = $this->y; + $pk->z = $this->z; + $pk->evid = 1003; + $pk->data = 0; + ServerAPI::request()->api->player->broadcastPacket($players, $pk); return true; - } + } } \ No newline at end of file