public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
{
if ($face === 1) {
$blockUp = $this->getSide(Vector3::SIDE_UP);
$blockDown = $this->getSide(Vector3::SIDE_DOWN);
if ($blockUp->canBeReplaced() === false or $blockDown->isTransparent() === true) {
return false;
}
$direction = $player instanceof Player ? $player->getDirection() : 0;
$face = [0 => 3, 1 => 4, 2 => 2, 3 => 5];
$next = $this->getSide($face[($direction + 2) % 4]);
$next2 = $this->getSide($face[$direction]);
$metaUp = 0x8;
if ($next->getId() === $this->getId() or $next2->isTransparent() === false and $next->isTransparent() === true) {
//Door hinge
$metaUp |= 0x1;
}
$this->setDamage($player->getDirection() & 0x3);
$this->getLevel()->setBlock($block, $this, true, true);
//Bottom
$this->getLevel()->setBlock($blockUp, $b = Block::get($this->getId(), $metaUp), true);
//Top
return true;
}
return false;
}