public NetworkModHandler findNetworkModHandler(Object mc) { if (mc instanceof InjectedModContainer) { return networkModHandlers.get(((InjectedModContainer)mc).wrappedContainer); } if (mc instanceof ModContainer) { return networkModHandlers.get(mc); } else if (mc instanceof Integer) { return networkIdLookup.get(mc); } else { return networkModHandlers.get(FMLCommonHandler.instance().findContainerFor(mc)); } }
/** * We must force the following load order, otherwise many things break: * - TFC * - This mod * - Anything else */ public static void doLoadOrderHaxing() { File injectedDepFile = new File(Loader.instance().getConfigDir(), "injectedDependencies.json"); JsonArray deps = new JsonArray(); JsonObject dep = new JsonObject(); dep.addProperty("type", "after"); dep.addProperty("target", TFC); deps.add(dep); for (ModContainer container : Loader.instance().getModList()) { if (container instanceof DummyModContainer || container instanceof InjectedModContainer) continue; String modid = container.getModId(); if (modid.equals(MODID) || modid.equals(TFC)) continue; dep = new JsonObject(); dep.addProperty("type", "before"); dep.addProperty("target", modid); deps.add(dep); } JsonArray root = new JsonArray(); JsonObject mod = new JsonObject(); mod.addProperty("modId", MODID); mod.add("deps", deps); root.add(mod); try { FileUtils.write(injectedDepFile, GSON.toJson(root)); } catch (IOException e) { throw new RuntimeException(e); } }