public ItemElectricBase() { super(); this.setMaxStackSize(1); this.setMaxDamage(100); this.setNoRepair(); this.setMaxTransfer(); this.mcVersion = new DefaultArtifactVersion((String) FMLInjectionData.data()[4]); if (EnergyConfigHandler.isIndustrialCraft2Loaded()) { if (VersionParser.parseRange("[1.7.2]").containsVersion(mcVersion)) { itemManagerIC2 = new ElectricItemManagerIC2(); } else { itemManagerIC2 = new ElectricItemManagerIC2_1710(); } } }
public DepLoadInst() { String mcVer = (String) FMLInjectionData.data()[4]; File mcDir = (File) FMLInjectionData.data()[6]; modsDir = new File(mcDir, "mods"); v_modsDir = new File(mcDir, "mods/" + mcVer); System.out.println("MicdoodleCore searching for dependencies in mods file: " + modsDir.getAbsolutePath()); if (!v_modsDir.exists()) { if (!v_modsDir.mkdirs()) { System.err.println("Failed to create mods subdirectory: " + v_modsDir.getAbsolutePath() + " !!!"); } } }
public static File confDirectoryGuess(int i, ConfigTag tag) { File mcDir = (File) FMLInjectionData.data()[6]; switch (i) { case 0: return tag.value != null ? new File(tag.getValue()) : null; case 1: return new File(mcDir, "../conf"); case 2: return new File(mcDir, "../build/unpacked/conf"); case 3: return new File(System.getProperty("user.home"), ".gradle/caches/minecraft/net/minecraftforge/forge/"+ FMLInjectionData.data()[4]+"-"+ ForgeVersion.getVersion()+"/unpacked/conf"); default: JFileChooser fc = new JFileChooser(mcDir); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setDialogTitle("Select an mcp conf dir for the deobfuscator."); int ret = fc.showDialog(null, "Select"); return ret == JFileChooser.APPROVE_OPTION ? fc.getSelectedFile() : null; } }
public static void setup(String deobFileName){ try{ LZMAInputSupplier zis = new LZMAInputSupplier(FMLInjectionData.class.getResourceAsStream(deobFileName)); InputSupplier<InputStreamReader> srgSupplier = CharStreams.newReaderSupplier(zis, Charsets.UTF_8); List<String> srgList = CharStreams.readLines(srgSupplier); for (String line : srgList) { line = line.replace(" #C", "").replace(" #S", ""); if (line.startsWith("CL")) { parseClass(line); } else if (line.startsWith("FD")) { parseField(line); } else if (line.startsWith("MD")) { parseMethod(line); } } }catch(Exception e){ e.printStackTrace(); } }
@Override public void injectIntoClassLoader(LaunchClassLoader classLoader) { // Deobfuscation transformer, always last if (!(Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment")) { classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.DeobfuscationTransformer"); } try { FMLRelaunchLog.fine("Validating minecraft"); Class<?> loaderClazz = Class.forName("cpw.mods.fml.common.Loader", true, classLoader); Method m = loaderClazz.getMethod("injectData", Object[].class); m.invoke(null, (Object)FMLInjectionData.data()); m = loaderClazz.getMethod("instance"); m.invoke(null); FMLRelaunchLog.fine("Minecraft validated, launching..."); } catch (Exception e) { // Load in the Loader, make sure he's ready to roll - this will initialize most of the rest of minecraft here System.out.println("A CRITICAL PROBLEM OCCURED INITIALIZING MINECRAFT - LIKELY YOU HAVE AN INCORRECT VERSION FOR THIS FML"); throw new RuntimeException(e); } }
/** * Create a configuration file for the file given in parameter. */ public Configuration(File file) { this.file = file; String basePath = ((File)(FMLInjectionData.data()[6])).getAbsolutePath().replace(File.separatorChar, '/').replace("/.", ""); String path = file.getAbsolutePath().replace(File.separatorChar, '/').replace("/./", "/").replace(basePath, ""); if (PARENT != null) { PARENT.setChild(path, this); isChild = true; } else { fileName = path; load(); } }
public static void versionCheck(String reqVersion, String mod) { final String mcVersion = (String) FMLInjectionData.data()[4]; if (!VersionParser.parseRange(reqVersion).containsVersion(new DefaultArtifactVersion(mcVersion))) { final String err = "This version of " + mod + " does not support minecraft version " + mcVersion; System.err.println(err); final JEditorPane ep = new JEditorPane("text/html", "<html>" + err + "<br>Remove it from your mods folder and check <a href=\"http://micdoodle8.com\">here</a> for updates" + "</html>"); ep.setEditable(false); ep.setOpaque(false); ep.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent event) { try { if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { Desktop.getDesktop().browse(event.getURL().toURI()); } } catch (final Exception e) { } } }); JOptionPane.showMessageDialog(null, ep, "Fatal error", JOptionPane.ERROR_MESSAGE); System.exit(1); } }
public DepLoadInst() { String mcVer = (String) FMLInjectionData.data()[4]; File mcDir = (File) FMLInjectionData.data()[6]; modsDir = new File(mcDir, "mods"); v_modsDir = new File(mcDir, "mods/" + mcVer); if (!v_modsDir.exists()) v_modsDir.mkdirs(); }
public CodeChickenCorePlugin() { if (minecraftDir != null) return;//get called twice, once for IFMLCallHook minecraftDir = (File) FMLInjectionData.data()[6]; currentMcVersion = (String) FMLInjectionData.data()[4]; DepLoader.load(); injectDeobfPlugin(); }
public static void versionCheck(String reqVersion, String mod) { String mcVersion = (String) FMLInjectionData.data()[4]; if (!VersionParser.parseRange(reqVersion).containsVersion(new DefaultArtifactVersion(mcVersion))) { String err = "This version of " + mod + " does not support minecraft version " + mcVersion; logger.error(err); JEditorPane ep = new JEditorPane("text/html", "<html>" + err + "<br>Remove it from your coremods folder and check <a href=\"http://www.minecraftforum.net/topic/909223-\">here</a> for updates" + "</html>"); ep.setEditable(false); ep.setOpaque(false); ep.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent event) { try { if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) Desktop.getDesktop().browse(event.getURL().toURI()); } catch (Exception ignored) {} } }); JOptionPane.showMessageDialog(null, ep, "Fatal error", JOptionPane.ERROR_MESSAGE); System.exit(1); } }
@Override public void injectIntoClassLoader(LaunchClassLoader classLoader) { // Deobfuscation transformer, always last, and the access transformer tweaker as well if (!(Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment")) { classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.DeobfuscationTransformer"); } // Add all the access transformers now as well for (String transformer : CoreModManager.getAccessTransformers()) { classLoader.registerTransformer(transformer); } classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.ModAccessTransformer"); classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.ItemStackTransformer"); try { FMLRelaunchLog.fine("Validating minecraft"); Class<?> loaderClazz = Class.forName("cpw.mods.fml.common.Loader", true, classLoader); Method m = loaderClazz.getMethod("injectData", Object[].class); m.invoke(null, (Object)FMLInjectionData.data()); m = loaderClazz.getMethod("instance"); m.invoke(null); FMLRelaunchLog.fine("Minecraft validated, launching..."); } catch (Exception e) { // Load in the Loader, make sure he's ready to roll - this will initialize most of the rest of minecraft here System.out.println("A CRITICAL PROBLEM OCCURED INITIALIZING MINECRAFT - LIKELY YOU HAVE AN INCORRECT VERSION FOR THIS FML"); throw new RuntimeException(e); } }
/** * Create a configuration file for the file given in parameter with the provided config version number. */ public Configuration(File file, String configVersion) { this.file = file; this.definedConfigVersion = configVersion; String basePath = ((File)(FMLInjectionData.data()[6])).getAbsolutePath().replace(File.separatorChar, '/').replace("/.", ""); String path = file.getAbsolutePath().replace(File.separatorChar, '/').replace("/./", "/").replace(basePath, ""); if (PARENT != null) { PARENT.setChild(path, this); isChild = true; } else { fileName = path; try { load(); } catch (Throwable e) { File fileBak = new File(file.getAbsolutePath() + "_" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored"); FMLLog.severe("An exception occurred while loading config file %s. This file will be renamed to %s " + "and a new config file will be generated.", file.getName(), fileBak.getName()); e.printStackTrace(); file.renameTo(fileBak); load(); } } }
@Override public void injectIntoClassLoader(LaunchClassLoader classLoader) { // Deobfuscation transformer, always last, and the access transformer tweaker as well if (!(Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment")) { classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.DeobfuscationTransformer"); } // Add all the access transformers now as well for (String transformer : CoreModManager.getAccessTransformers()) { classLoader.registerTransformer(transformer); } classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.ModAccessTransformer"); try { FMLRelaunchLog.fine("Validating minecraft"); Class<?> loaderClazz = Class.forName("cpw.mods.fml.common.Loader", true, classLoader); Method m = loaderClazz.getMethod("injectData", Object[].class); m.invoke(null, (Object)FMLInjectionData.data()); m = loaderClazz.getMethod("instance"); m.invoke(null); FMLRelaunchLog.fine("Minecraft validated, launching..."); } catch (Exception e) { // Load in the Loader, make sure he's ready to roll - this will initialize most of the rest of minecraft here System.out.println("A CRITICAL PROBLEM OCCURED INITIALIZING MINECRAFT - LIKELY YOU HAVE AN INCORRECT VERSION FOR THIS FML"); throw new RuntimeException(e); } }
public EQLoadingPlugin() { if(minecraftDir != null) { return; } minecraftDir = (File) FMLInjectionData.data()[6]; currentMcVersion = (String) FMLInjectionData.data()[4]; }
public DepLoader(File rootDir, LaunchClassLoader cl) { String mcVer = (String) FMLInjectionData.data()[4]; File mcDir = (File) FMLInjectionData.data()[6]; this.rootDir = rootDir; this.cl = cl; modsDir = new File(mcDir, "mods"); vModsDir = new File(mcDir, "mods/" + mcVer); if (!vModsDir.exists()) vModsDir.mkdirs(); depMap = new HashMap<String, Dependency>(); downloader = new Downloader(rootDir); }
@Override public Void call() throws Exception { File mcDir = (File) FMLInjectionData.data()[6]; new myessentials.deploader.DepLoader(new File(mcDir, "MyEssentials/libs"), (LaunchClassLoader) myessentials.deploader.DepLoader.class.getClassLoader()).load(); return null; }
public static String mcVersion() { return (String) FMLInjectionData.data()[4]; }
public Loader(final File codemodLocation, final File mcLocation, final boolean runtimeDeobfuscationEnabled) { this.coremodLocation = codemodLocation; this.mcLocation = mcLocation; this.runtimeDeobfuscationEnabled = runtimeDeobfuscationEnabled; this.libDir = new File(this.mcLocation, "mods/"+(String) FMLInjectionData.data()[4]); }
/** * Gets the Minecraft base directory. * @return base directory */ public File getMinecraftDir() { return (File)FMLInjectionData.data()[6]; }
/** * Gets the Minecraft base directory. * @return base directory */ public File getMinecraftDir() { return (File) FMLInjectionData.data()[6]; }