本文整理汇总了Java中cpw.mods.fml.relauncher.FMLInjectionData类的典型用法代码示例。如果您正苦于以下问题:Java FMLInjectionData类的具体用法?Java FMLInjectionData怎么用?Java FMLInjectionData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FMLInjectionData类属于cpw.mods.fml.relauncher包,在下文中一共展示了FMLInjectionData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ItemElectricBase
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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();
}
}
}
示例2: DepLoadInst
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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() + " !!!");
}
}
}
示例3: confDirectoryGuess
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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;
}
}
示例4: setup
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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();
}
}
示例5: injectIntoClassLoader
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
@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);
}
}
示例6: Configuration
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
/**
* 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();
}
}
示例7: versionCheck
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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);
}
}
示例8: DepLoadInst
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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();
}
示例9: CodeChickenCorePlugin
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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();
}
示例10: versionCheck
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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);
}
}
示例11: injectIntoClassLoader
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
@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);
}
}
示例12: Configuration
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
/**
* 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();
}
}
}
示例13: injectIntoClassLoader
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
@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);
}
}
示例14: DepLoadInst
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
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();
}
示例15: EQLoadingPlugin
import cpw.mods.fml.relauncher.FMLInjectionData; //导入依赖的package包/类
public EQLoadingPlugin() {
if(minecraftDir != null) {
return;
}
minecraftDir = (File) FMLInjectionData.data()[6];
currentMcVersion = (String) FMLInjectionData.data()[4];
}