本文整理匯總了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());
}
}
示例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;
}
示例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;
}
示例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();
}
}
}
示例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();
}
}
}
示例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;
}