public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
{
if ($face === 0) {
if ($target->getId() === self::RED_SANDSTONE_SLAB and ($target->getDamage() & 0x8) === 0x8) {
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);
return true;
} elseif ($block->getId() === self::RED_SANDSTONE_SLAB) {
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);
return true;
} else {
$this->meta |= 0x8;
}
} elseif ($face === 1) {
if ($target->getId() === self::RED_SANDSTONE_SLAB and ($target->getDamage() & 0x8) === 0) {
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);
return true;
} elseif ($block->getId() === self::RED_SANDSTONE_SLAB) {
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);
return true;
}
//TODO: check for collision
} else {
if ($block->getId() === self::RED_SANDSTONE_SLAB) {
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);
} else {
if ($fy > 0.5) {
$this->meta |= 0x8;
}
}
}
if ($block->getId() === self::RED_SANDSTONE_SLAB and ($target->getDamage() & 0x7) !== ($this->meta & 0x7)) {
return false;
}
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}