Пример #1
0
    public IBlock SetBlock(BlockType blockType, int x, int y, int z)
    {
        if (x < 0 || x >= Size)
        {
            throw new InvalidOperationException("X position is out of chunk bounds.");
        }

        if (z < 0 || z >= Size)
        {
            throw new InvalidOperationException("Z position is out of chunk bounds.");
        }

        IChunkSection section = GetChunkSection(y);
        IBlock        block   = section.SetBlock(blockType, x, y % Size, z);

        // TODO: improve heightmap generation when placing a block.
        GenerateHeightMap();

        return(block);
    }