Whoever in the past, future, or present produces psychic abilities, all of them do so through the development and frequent practice of the four bases of psychic ability.

Iddhipadesa sutta - Limited Psychic Ability

"Bhikkhus, whoever in the past, whether ascetics or brāhmins, have produced psychic abilities, all of them did so through the development and frequent practice of the four bases of psychic ability. Bhikkhus, whoever in the future, whether ascetics or brāhmins, will produce psychic abilities, all of them will do so through the development and frequent practice of the four bases of psychic ability. Bhikkhus, whoever at present, whether ascetics or brāhmins, are producing psychic abilities, all of them are doing so through the development and frequent practice of the four bases of psychic ability.

What four?

Here, bhikkhus, a bhikkhu develops the basis of psychic ability that is endowed with collectedness arising from aspiration and accompanied by intentional effort. He develops the basis of psychic ability that is endowed with collectedness arising from energy and accompanied by intentional effort. He develops the basis of psychic ability that is endowed with collectedness arising from [purification of] mind and accompanied by intentional effort. And he develops the basis of psychic ability that is endowed with collectedness arising from investigation and accompanied by intentional effort.

Bhikkhus, whoever in the past, whether ascetics or brāhmins, have produced psychic abilities, all of them did so through the development and frequent practice of these very four bases of psychic ability. Bhikkhus, whoever in the future, whether ascetics or brāhmins, will produce psychic abilities, all of them will do so through the development and frequent practice of these very four bases of psychic ability. Bhikkhus, whoever at present, whether ascetics or brāhmins, are producing psychic abilities, all of them are doing so through the development and frequent practice of these very four bases of psychic ability."