public function onActivate(Item $item, Player $player = null)
{
$faces = [0 => 3, 1 => 0, 2 => 1, 3 => 2];
if ($player !== null) {
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0] & 0x3 | ~$this->meta & 0x4;
} else {
$this->meta ^= 0x4;
}
$this->getLevel()->setBlock($this, $this, true);
$this->level->addSound(new DoorSound($this));
return true;
}