famine in 1770 Maximilian sold some of the crown jewels to pay for grain imports to relieve hunger. In that year, he also issued an edict against the extravagant pomposity of the Church which contributed to the end of the era of Bavarian rococo. He also forbade the Oberammergau Passion Play. In 1771 the elector regulated general school attendance. In December 1777 Maximilian Joseph rode in his carriage through Munich; on the ride, as he passed one of the tower clocks, the mechanism broke, and the clock struck 77 times. Commenting to the passengers, Max Joseph decided this was an omen, and that his years had run out. Within days, he was stricken with a strange disease. None of his 15 doctors could diagnose it, but by Christmas, it had become clear that it was a particularly virulent strain of smallpox, called "purple small pox" at the time. By the last day of the month he was dead without leaving an heir. Maximilian III Joseph is buried in the crypt of the Theatinerkirche in Munich. Succession As the last of the junior branch of the Wittelsbach dynasty which derived from Louis IV, Holy Roman Emperor and had ruled Bavaria since early 14th century, Maximilian's death led to a succession dispute and the brief War of the Bavarian Succession. He was succeeded by his (in the male line) 12th cousin, once removed, the Elector Palatine Charles Theodore from the senior branch of the dynasty. Maximilian's widow Maria Anna Sophia of Saxony and Maximilian's sister Duchess Maria Antonia of Bavaria as well as Maria Anna of Palatinate-Sulzbach, the widow of the former Bavarian crown prince Duke Clement Francis of Bavaria negotiated with Max's reluctant heir and intervened together with Frederick II. of Prussia and the new elector's supposed successor, Charles II August, Duke of Zweibrücken, to secure Bavaria's independence from Austria. The Prussian king had to threaten both the emperor and Bavaria itself with war. Austria had already invaded portions of the duchy immediately after the Elector's death and the new elector had less than any interest in his new realm. Instead, Charles Theodore, much to public annoyance, repeatedly tried to change it for Further Austria or the Austrian Netherlands, even better, for proximity to his Palatinian homelands. Cultural legacy Maximilian III Joseph ordered in 1751 François de Cuvilliés to construct the splendid rococo Cuvilliés Theatre and in 1755 the Stone Hall