From bf4b96e144ae3412653491c92c2c46ad08700a41 Mon Sep 17 00:00:00 2001 From: dktapps Date: Tue, 6 Sep 2016 17:31:24 +0100 Subject: [PATCH] Block: Fix fence gate rotation when opened or closed. TODO: fix gate opening direction --- src/pocketmine/block/FenceGate.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/pocketmine/block/FenceGate.php b/src/pocketmine/block/FenceGate.php index 4ffef72f71..65ddc0f47f 100644 --- a/src/pocketmine/block/FenceGate.php +++ b/src/pocketmine/block/FenceGate.php @@ -59,7 +59,7 @@ class FenceGate extends Transparent{ } $i = ($this->getDamage() & 0x03); - if($i === 2 and $i === 0){ + if($i === 2 or $i === 0){ return new AxisAlignedBB( $this->x, $this->y, @@ -100,13 +100,9 @@ class FenceGate extends Transparent{ } public function onActivate(Item $item, Player $player = null){ - $faces = [ - 0 => 3, - 1 => 0, - 2 => 1, - 3 => 2, - ]; - $this->meta = ($faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03) | ((~$this->meta) & 0x04); + $this->meta ^= 0x04; //Flip open/close state + //TODO: Face player when opened + $this->getLevel()->setBlock($this, $this, true); $this->level->addSound(new DoorSound($this)); return true;