@Override protected void actionPerformed(GuiButton button) throws IOException { switch (button.id) { case 0: // Means Done ErrorHandling.CleanErrors(); /* Closes the text editor, saves the .oc file and attempts to compile and load it */ mc.thePlayer.closeScreen(); text.deleteCharAt(cursorLocation); saveFile(); try { Compiler.main( String.format(System.getProperty("user.dir") + "/ObsidiCode/Test/SimpleMiner.oc")); } catch (Exception e) { e.printStackTrace(); } ArrayList<String> currentErrors = (ArrayList<String>) ErrorHandling.GetErrors().clone(); if (currentErrors.size() == 0) { loadRobot(); } else { ErrorBook eb = ObsidiSkriveMaskineMod.errorBook(); ObsidiCodingMachine.dropErrorLog(eb); } break; case 1: // Means reset // Resets the text on the screen. text = text.delete(0, text.toString().length()); cursorLocation = 0; break; default: break; } super.actionPerformed(button); }