public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
{
$down = $block->getSide(Vector3::SIDE_DOWN);
if ($down->isTransparent() === false || $down instanceof Slab && ($down->meta & 0x8) === 0x8 || $down instanceof WoodSlab && ($down->meta & 0x8) === 0x8 || $down instanceof Stair && ($down->meta & 0x4) === 0x4) {
$this->getLevel()->setBlock($this, Block::get($this->id, 0));
$up = $block->getSide(Vector3::SIDE_UP);
if ($block->getSide(Vector3::SIDE_EAST) && $block->getSide(Vector3::SIDE_WEST)) {
if ($up->getSide(Vector3::SIDE_EAST)) {
$this->setDirection(Vector3::SIDE_EAST, true);
} elseif ($up->getSide(Vector3::SIDE_WEST)) {
$this->setDirection(Vector3::SIDE_WEST, true);
} else {
$this->setDirection(Vector3::SIDE_EAST);
}
} elseif ($block->getSide(Vector3::SIDE_SOUTH) && $block->getSide(Vector3::SIDE_NORTH)) {
if ($up->getSide(Vector3::SIDE_SOUTH)) {
$this->setDirection(Vector3::SIDE_SOUTH, true);
} elseif ($up->getSide(Vector3::SIDE_NORTH)) {
$this->setDirection(Vector3::SIDE_NORTH, true);
} else {
$this->setDirection(Vector3::SIDE_SOUTH);
}
} else {
$this->setDirection(Vector3::SIDE_NORTH);
}
return true;
}
return false;
}