Sync code to MadEdit-Mod 0.3.1