pocketmine\block\FlowerPot::place PHP Method

place() public method

public place ( Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null )
$item pocketmine\item\Item
$block Block
$target Block
$player pocketmine\Player
    public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
    {
        if ($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === false) {
            $this->getLevel()->setBlock($block, $this, true, true);
            $nbt = new CompoundTag("", [new StringTag("id", Tile::FLOWER_POT), new IntTag("x", $block->x), new IntTag("y", $block->y), new IntTag("z", $block->z), new ShortTag("item", 0), new IntTag("data", 0)]);
            if ($item->hasCustomBlockData()) {
                foreach ($item->getCustomBlockData() as $key => $v) {
                    $nbt->{$key} = $v;
                }
            }
            $pot = Tile::createTile("FlowerPot", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
            return true;
        }
        return false;
    }