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


Java LaunchClassLoader.addURL方法代碼示例

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


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

示例1: handleCascadingTweak

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
private static void handleCascadingTweak(File coreMod, JarFile jar, String cascadedTweaker, LaunchClassLoader classLoader, Integer sortingOrder)
{
    try
    {
        // Have to manually stuff the tweaker into the parent classloader
        if (ADDURL == null)
        {
            ADDURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
            ADDURL.setAccessible(true);
        }
        ADDURL.invoke(classLoader.getClass().getClassLoader(), coreMod.toURI().toURL());
        classLoader.addURL(coreMod.toURI().toURL());
        CoreModManager.tweaker.injectCascadingTweak(cascadedTweaker);
        tweakSorting.put(cascadedTweaker,sortingOrder);
    }
    catch (Exception e)
    {
        FMLRelaunchLog.log(Level.INFO, e, "There was a problem trying to load the mod dir tweaker %s", coreMod.getAbsolutePath());
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:21,代碼來源:CoreModManager.java

示例2: addJarToClasspath

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
private boolean addJarToClasspath(File file) {
    LaunchClassLoader currentLoader = (LaunchClassLoader) Thread.currentThread().getContextClassLoader();
    try {
        currentLoader.addURL(file.toURI().toURL());
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return false;
    }
    return true;
}
 
開發者ID:PizzaCrust,項目名稱:Novous,代碼行數:11,代碼來源:SimpleModLoader.java

示例3: getTransformerWrapper

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
public static String getTransformerWrapper(LaunchClassLoader launchLoader, String parentClass, String coreMod)
{
    if(!injected)
    {
        injected = true;
        launchLoader.addURL(asmGenRoot);
    }

    String name = getWrapperName(parentClass);
    String fileName = name.replace('.', '/') + ".class";
    wrapperModMap.put(fileName, coreMod);
    wrapperParentMap.put(fileName, parentClass);
    return name;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:15,代碼來源:ASMTransformerWrapper.java

示例4: injectClassLoader

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
@Override
public void injectClassLoader(final LaunchClassLoader classLoader) {
    if (this.mNeedInjection) {
        try {
            classLoader.addURL(this.mDir.toURI().toURL());
        }
        catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:CyberdyneCC,項目名稱:ThermosRebased,代碼行數:12,代碼來源:DirCandidate.java

示例5: injectClassLoader

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
@Override
public void injectClassLoader(final LaunchClassLoader classLoader) {
    if (this.mNeedInjection) {
        try {
            classLoader.addURL(this.mJarFile.toURI().toURL());
        }
        catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:CyberdyneCC,項目名稱:ThermosRebased,代碼行數:12,代碼來源:JarCandidate.java

示例6: call

import net.minecraft.launchwrapper.LaunchClassLoader; //導入方法依賴的package包/類
@Override
public Void call() {
    if ((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) return null;
    try {
        LaunchClassLoader loader = (LaunchClassLoader) getClass().getClassLoader();

        String nativeName = "jxbrowser-%s-6.18.jar";

        if (OSValidator.isWindows()) {
            nativeName = String.format(nativeName, "win32");
        } else if (OSValidator.isMac()) {
            nativeName = String.format(nativeName, "mac");
        } else if (OSValidator.isUnix()) {
            nativeName = String.format(nativeName, "linux64");
        } else {
            System.err.println("----------------ERROR UNKNOWN OS: NO NATIVE BINARY AVAILABLE----------------");
            throw new Exception();
        }

        URL nativesUrl = new URL(String.format(urlBase, nativeName));
        File natives = new File(Paths.get(minecraftDir.getAbsolutePath(),"mods", "lda", "natives", nativeName).toString());

        if (!natives.exists()) {
            natives.getParentFile().mkdirs();
            natives.createNewFile();

            InputStream is = nativesUrl.openStream();
            OutputStream os = new FileOutputStream(natives);

            byte[] b = new byte[2048];
            int length;

            while ((length = is.read(b)) != -1) {
                os.write(b, 0, length);
                //Gui.drawRect(0, 0, is.available(), 10, new Color(255, 0, 0).getRGB());
                //RenderUtil.drawStringClipped("Downlaoding natives... " + is.available(), 0, 10, 100, new Color(255, 0, 0).getRGB(), false);
            }
            is.close();
            os.close();
        }

        loader.addURL(natives.toURI().toURL());
    } catch (Exception e) {
        System.err.println("----------------ERROR DURING DOWNLOAD OF NATIVES----------------");
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:lukas2005,項目名稱:Device-Mod-Apps,代碼行數:49,代碼來源:CoreModMain.java


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