This is the Taman Sari, or Water Palace next to the Yogya Kraton.
It was also built starting in the 1750s as a sort of "pleasure
palace" for the Sultan. Some of it was damaged by an earthquake
in 1865.
Legend has it that the Sultan in those days had the Portuguese
architect executed so nobody would find out the secret pleasure
rooms inside the castle.