Beispiel #1
0
    /// <summary>
    /// Returns the block at the given position. The position should be given in chunk coordinates.
    /// </summary>
    /// <param name="blockPos">The given block position in the chunk</param>
    public Block GetBlock(Vector3 blockPos)
    {
        // if the block is not in the range of the chunk, return an air block in order to render the outer blocks of the chunk
        if (!InsideChunk(blockPos))
        {
            return(blockTerrain.GetBlock(blockPos + chunkPos));
        }

        return(blocks[(int)blockPos.x, (int)blockPos.y, (int)blockPos.z]);
    }