Initializes the 5zig Mod and sets up the workspace. @throws IllegalStateException if the method has been called more than once.
()
| 139 | * @throws IllegalStateException if the method has been called more than once. |
| 140 | */ |
| 141 | public static void init() { |
| 142 | if (initialized) { |
| 143 | throw new IllegalStateException("The 5zig Mod has been already initialized!"); |
| 144 | } |
| 145 | initialized = true; |
| 146 | |
| 147 | long start = System.currentTimeMillis(); |
| 148 | |
| 149 | logger.info("Initializing the 5zig Mod!"); |
| 150 | if (Transformer.FORGE) { |
| 151 | logger.info("Forge detected!"); |
| 152 | } |
| 153 | |
| 154 | modDirectory = new File(The5zigMod.getVars().getMinecraftDataDirectory(), "the5zigmod"); |
| 155 | // Workaround to allow Minecraft specific classes the interaction with mod core classes. |
| 156 | MinecraftFactory.setClassProxyCallback(new ClassProxyCallbackImpl()); |
| 157 | |
| 158 | // Initialize Crash Hopper |
| 159 | CrashHopper.init(); |
| 160 | |
| 161 | // Directories and config |
| 162 | try { |
| 163 | setupDirs(); |
| 164 | } catch (IOException e) { |
| 165 | logger.fatal("Could not create Mod directories! Exiting!", e); |
| 166 | CrashReportUtil.makeCrashReport(e, "Creating Directory."); |
| 167 | } |
| 168 | |
| 169 | try { |
| 170 | loadConfig(); |
| 171 | } catch (IOException e) { |
| 172 | logger.fatal("Could not load Main Configuration!"); |
| 173 | CrashReportUtil.makeCrashReport(e, "Loading Main Configuration."); |
| 174 | } |
| 175 | DEBUG = config.getBool("debug"); |
| 176 | setupLogger(); |
| 177 | variables.updateOverlayCount(getConfig().getInt("maxOverlays")); |
| 178 | chatFilterConfig = new ChatFilterConfiguration(modDirectory); |
| 179 | lastServerConfig = new LastServerConfiguration(modDirectory); |
| 180 | textReplacementConfig = new TextReplacementConfiguration(modDirectory); |
| 181 | textMacroConfiguration = new TextMacroConfiguration(modDirectory); |
| 182 | joinTextConfiguration = new JoinTextConfiguration(modDirectory); |
| 183 | |
| 184 | // Listener and manager classes. |
| 185 | listener = new EventListener(); |
| 186 | datamanager = new DataManager(); |
| 187 | keybindingManager = new KeybindingManager(); |
| 188 | scheduler = new Scheduler(); |
| 189 | listener.registerListener(scheduler); |
| 190 | renderer = new DisplayRenderer(); |
| 191 | serverAPIBackend = new ServerAPIBackend(); |
| 192 | moduleItemRegistry = new ModuleItemRegistry(); |
| 193 | moduleMaster = new ModuleMaster(modDirectory); |
| 194 | guiIngame = new GuiIngame(); |
| 195 | |
| 196 | // Networking stuff |
| 197 | conversationManager = new ConversationManager(); |
| 198 | groupChatManager = new GroupChatManager(); |
no test coverage detected