當前位置: 首頁>>代碼示例>>Java>>正文


Java LaunchClassLoader.getClassBytes方法代碼示例

本文整理匯總了Java中net.minecraft.launchwrapper.LaunchClassLoader.getClassBytes方法的典型用法代碼示例。如果您正苦於以下問題:Java LaunchClassLoader.getClassBytes方法的具體用法?Java LaunchClassLoader.getClassBytes怎麽用?Java LaunchClassLoader.getClassBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.launchwrapper.LaunchClassLoader的用法示例。


在下文中一共展示了LaunchClassLoader.getClassBytes方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readClass

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
public static ClassNode readClass(String classname) {
    LaunchClassLoader rcl = (LaunchClassLoader) ASMTransformer.class.getClassLoader();
    try {
        byte[] classBytes = rcl.getClassBytes(classname);
        ClassReader cr = new ClassReader(classBytes);
        ClassNode cn = new ClassNode();
        cr.accept(cn, 0);
        return cn;
    } catch (IOException e) {
        e.printStackTrace();
    }   
    return null;
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:14,代碼來源:ASMTransformer.java

示例2: loadClass

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
private static ClassNode loadClass(String className) throws IOException {

        LaunchClassLoader loader = (LaunchClassLoader) STPClassTransformer.class.getClassLoader();
        ClassNode classNode = new ClassNode();
        ClassReader classReader = new ClassReader(loader.getClassBytes(className));
        classReader.accept(classNode, 0);
        return classNode;
    }
 
開發者ID:MCServerTools,項目名稱:ServerTools-PERMISSION,代碼行數:9,代碼來源:STPClassTransformer.java

示例3: handleLaunch

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
public static void handleLaunch(File mcDir, LaunchClassLoader classLoader, FMLTweaker tweaker)
{
    CoreModManager.mcDir = mcDir;
    CoreModManager.tweaker = tweaker;
    try
    {
        // Are we in a 'decompiled' environment?
        byte[] bs = classLoader.getClassBytes("net.minecraft.world.World");
        if (bs != null)
        {
            FMLRelaunchLog.info("Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation");
            deobfuscatedEnvironment = true;
        }
    }
    catch (IOException e1)
    {
        // NOOP
    }

    if (!deobfuscatedEnvironment)
    {
        FMLRelaunchLog.fine("Enabling runtime deobfuscation");
    }

    tweaker.injectCascadingTweak("net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker");
    try
    {
        classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.PatchingTransformer");
    }
    catch (Exception e)
    {
        FMLRelaunchLog.log(Level.ERROR, e, "The patch transformer failed to load! This is critical, loading cannot continue!");
        throw Throwables.propagate(e);
    }

    loadPlugins = new ArrayList<FMLPluginWrapper>();
    for (String rootPluginName : rootPlugins)
    {
        loadCoreMod(classLoader, rootPluginName, new File(FMLTweaker.getJarLocation()));
    }

    if (loadPlugins.isEmpty())
    {
        throw new RuntimeException("A fatal error has occurred - no valid fml load plugin was found - this is a completely corrupt FML installation.");
    }

    FMLRelaunchLog.fine("All fundamental core mods are successfully located");
    // Now that we have the root plugins loaded - lets see what else might
    // be around
    String commandLineCoremods = System.getProperty("fml.coreMods.load", "");
    for (String coreModClassName : commandLineCoremods.split(","))
    {
        if (coreModClassName.isEmpty())
        {
            continue;
        }
        FMLRelaunchLog.info("Found a command line coremod : %s", coreModClassName);
        loadCoreMod(classLoader, coreModClassName, null);
    }
    discoverCoreMods(mcDir, classLoader);

}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:63,代碼來源:CoreModManager.java

示例4: getPatchedResource

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
public byte[] getPatchedResource(String name, String mappedName, LaunchClassLoader loader) throws IOException
{
    byte[] rawClassBytes = loader.getClassBytes(name);
    return applyPatch(name, mappedName, rawClassBytes);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:6,代碼來源:ClassPatchManager.java

示例5: handleLaunch

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
public static void handleLaunch(File mcDir, LaunchClassLoader classLoader, FMLTweaker tweaker)
{
    CoreModManager.mcDir = mcDir;
    CoreModManager.tweaker = tweaker;
    try
    {
        // Are we in a 'decompiled' environment?
        byte[] bs = classLoader.getClassBytes("net.minecraft.world.World");
        if (bs != null)
        {
            FMLRelaunchLog.info("Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation");
            deobfuscatedEnvironment = true;
        }
    }
    catch (IOException e1)
    {
    }

    if (!deobfuscatedEnvironment)
    {
        FMLRelaunchLog.fine("Enabling runtime deobfuscation");
    }

    tweaker.injectCascadingTweak("cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker");
    try
    {
        classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.PatchingTransformer");
    }
    catch (Exception e)
    {
        FMLRelaunchLog.log(Level.ERROR, e, "The patch transformer failed to load! This is critical, loading cannot continue!");
        throw Throwables.propagate(e);
    }

    loadPlugins = new ArrayList<FMLPluginWrapper>();
    for (String rootPluginName : rootPlugins)
    {
        loadCoreMod(classLoader, rootPluginName, new File(FMLTweaker.getJarLocation()));
    }

    if (loadPlugins.isEmpty())
    {
        throw new RuntimeException("A fatal error has occured - no valid fml load plugin was found - this is a completely corrupt FML installation.");
    }

    FMLRelaunchLog.fine("All fundamental core mods are successfully located");
    // Now that we have the root plugins loaded - lets see what else might
    // be around
    String commandLineCoremods = System.getProperty("fml.coreMods.load", "");
    for (String coreModClassName : commandLineCoremods.split(","))
    {
        if (coreModClassName.isEmpty())
        {
            continue;
        }
        FMLRelaunchLog.info("Found a command line coremod : %s", coreModClassName);
        loadCoreMod(classLoader, coreModClassName, null);
    }
    discoverCoreMods(mcDir, classLoader);

}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:62,代碼來源:CoreModManager.java

示例6: getClassByteArray

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
@Nullable
public static final byte[] getClassByteArray(LaunchClassLoader loader, String name) {
	try {
		return loader.getClassBytes(name.replace('/', '.'));
	} catch (IOException e) { return null; }
}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:7,代碼來源:Tool.java

示例7: handleLaunch

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
public static void handleLaunch(File mcDir, LaunchClassLoader classLoader, FMLTweaker tweaker)
{
    CoreModManager.mcDir = mcDir;
    CoreModManager.tweaker = tweaker;
    try
    {
        // Are we in a 'decompiled' environment?
        byte[] bs = classLoader.getClassBytes("net.minecraft.world.World");
        if (bs != null)
        {
            FMLRelaunchLog.info("Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation");
            deobfuscatedEnvironment = true;
        }
    }
    catch (IOException e1)
    {
    }

    if (!deobfuscatedEnvironment)
    {
        FMLRelaunchLog.fine("Enabling runtime deobfuscation");
    }

    tweaker.injectCascadingTweak("cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker");
    try
    {
        classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.PatchingTransformer");
    }
    catch (Exception e)
    {
        FMLRelaunchLog.log(Level.ERROR, e, "The patch transformer failed to load! This is critical, loading cannot continue!");
        throw Throwables.propagate(e);
    }

    loadPlugins = new ArrayList<FMLPluginWrapper>();
    for (String rootPluginName : rootPlugins)
    {
        loadCoreMod(classLoader, rootPluginName, new File(FMLTweaker.getJarLocation()));
    }

    if (loadPlugins.isEmpty())
    {
        throw new RuntimeException("A fatal error has occured - no valid fml load plugin was found - this is a completely corrupt FML installation.");
    }

    FMLRelaunchLog.fine("All fundamental core mods are successfully located");
    // Now that we have the root plugins loaded - lets see what else might
    // be around
    String commandLineCoremods = System.getProperty("fml.coreMods.load", "");
    for (String coreModClassName : commandLineCoremods.split(","))
    {
        if (coreModClassName.isEmpty())
        {
            continue;
        }
        FMLRelaunchLog.info("Found a command line coremod : %s", coreModClassName);
        loadCoreMod(classLoader, coreModClassName, null);
    }
    discoverCoreMods(mcDir, classLoader);

    // Cauldron start - group output of @MCVersion warnings
    if (!noVersionAnnotationCoreMods.isEmpty()) {
        FMLRelaunchLog.warning("The following coremods do not have a @MCVersion annotation. They may cause problems if this is not the correct version of Minecraft for them.");
        StringBuilder sb = new StringBuilder("Missing @MCVersion: ");
        for (String className : noVersionAnnotationCoreMods) {
            sb.append(className).append("  ");
        }
        FMLRelaunchLog.warning(sb.toString());
    }
    // Cauldron end
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:72,代碼來源:CoreModManager.java

示例8: handleLaunch

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
public static void handleLaunch(File mcDir, LaunchClassLoader classLoader, FMLTweaker tweaker)
{
    CoreModManager.mcDir = mcDir;
    CoreModManager.tweaker = tweaker;
    try
    {
        // Are we in a 'decompiled' environment?
        byte[] bs = classLoader.getClassBytes("net.minecraft.world.World");
        if (bs != null)
        {
            FMLRelaunchLog.info("Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation");
            deobfuscatedEnvironment = true;
        }
    }
    catch (IOException e1)
    {
    }

    if (!deobfuscatedEnvironment)
    {
        FMLRelaunchLog.fine("Enabling runtime deobfuscation");
    }

    tweaker.injectCascadingTweak("cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker");
    try
    {
        classLoader.registerTransformer("cpw.mods.fml.common.asm.transformers.PatchingTransformer");
    }
    catch (Exception e)
    {
        FMLRelaunchLog.log(Level.SEVERE, e, "The patch transformer failed to load! This is critical, loading cannot continue!");
        throw Throwables.propagate(e);
    }

    loadPlugins = new ArrayList<FMLPluginWrapper>();
    for (String rootPluginName : rootPlugins)
    {
        loadCoreMod(classLoader, rootPluginName, new File(FMLTweaker.getJarLocation()));
    }

    if (loadPlugins.isEmpty())
    {
        throw new RuntimeException("A fatal error has occured - no valid fml load plugin was found - this is a completely corrupt FML installation.");
    }

    FMLRelaunchLog.fine("All fundamental core mods are successfully located");
    // Now that we have the root plugins loaded - lets see what else might
    // be around
    String commandLineCoremods = System.getProperty("fml.coreMods.load", "");
    for (String coreModClassName : commandLineCoremods.split(","))
    {
        if (coreModClassName.isEmpty())
        {
            continue;
        }
        FMLRelaunchLog.info("Found a command line coremod : %s", coreModClassName);
        loadCoreMod(classLoader, coreModClassName, null);
    }
    discoverCoreMods(mcDir, classLoader);

}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:62,代碼來源:CoreModManager.java


注:本文中的net.minecraft.launchwrapper.LaunchClassLoader.getClassBytes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。