本文整理匯總了Java中net.minecraft.launchwrapper.LaunchClassLoader類的典型用法代碼示例。如果您正苦於以下問題:Java LaunchClassLoader類的具體用法?Java LaunchClassLoader怎麽用?Java LaunchClassLoader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LaunchClassLoader類屬於net.minecraft.launchwrapper包,在下文中一共展示了LaunchClassLoader類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: build
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
static void build(File mcHome, LaunchClassLoader classLoader)
{
minecraftHome = mcHome;
InputStream stream = classLoader.getResourceAsStream("fmlversion.properties");
Properties properties = new Properties();
if (stream != null)
{
try
{
properties.load(stream);
}
catch (IOException ex)
{
FMLRelaunchLog.log(Level.ERROR, ex, "Could not get FML version information - corrupted installation detected!");
}
}
major = properties.getProperty("fmlbuild.major.number", "missing");
minor = properties.getProperty("fmlbuild.minor.number", "missing");
rev = properties.getProperty("fmlbuild.revision.number", "missing");
build = properties.getProperty("fmlbuild.build.number", "missing");
mccversion = properties.getProperty("fmlbuild.mcversion", "missing");
mcpversion = properties.getProperty("fmlbuild.mcpversion", "missing");
deobfuscationDataHash = properties.getProperty("fmlbuild.deobfuscation.hash","deadbeef");
}
示例3: injectIntoClassLoader
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
// Adds SpongeCoremod to FML's 'root plugins' so it always loads
// before other coremods
// Add to end of array so FML plugins are first
try {
logger.info("Performing SpongeCoremod injection");
Field rootPluginsField = CoreModManager.class.getDeclaredField("rootPlugins");
rootPluginsField.setAccessible(true);
String[] rootPlugins = (String[]) rootPluginsField.get(null);
String[] rootPlugins2 = new String[rootPlugins.length + 1];
System.arraycopy(rootPlugins, 0, rootPlugins2, 0, rootPlugins.length);
rootPlugins2[rootPlugins.length] = COREMOD;
rootPluginsField.set(null, rootPlugins2);
mixinHackLookAwayNow();
logger.info("SpongeCoremod successfully injected into FML");
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: discoverClassloader
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
public static void discoverClassloader(final LaunchClassLoader loader, final DataScanner scanner) {
final List<DiscoverCandidate> candidates = new LinkedList<DiscoverCandidate>();
for (final URL url : loader.getSources()) {
try {
final File file = new File(url.toURI());
if (!file.exists()) {
continue;
}
if (file.isDirectory() && isDirValid(file)) {
candidates.add(new DirCandidate(file, false));
}
else {
if (!file.isFile() || !isFileValid(file)) {
continue;
}
candidates.add(new JarCandidate(file, false));
}
}
catch (Exception ex) {}
}
scan(loader, candidates, scanner);
}
示例5: addDLCFile
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
private static void addDLCFile(File file) {
logger.info("Add DLC: " + file.getPath());
IDLCInfo dlc = null;
try {
if ((dlc = checkFileIsDLC(file)) != null) {
if (file.isFile()) {
LaunchClassLoader loader = AlchemyEngine.getLaunchClassLoader();
AlchemySetup.injectAccessTransformer(file, loader);
AlchemySetup.injectAccessTransformer(file, dlc.id() + "_at.cfg", loader);
}
URL url = file.toURI().toURL();
Tool.addURLToClassLoader(AlchemyDLCLoader.class.getClassLoader(), url);
AnnotationInvocationHandler invocationHandler = AnnotationInvocationHandler.asOneOfUs(dlc);
invocationHandler.memberValues.put("getDLCContainer", new DLCContainer(dlc));
invocationHandler.memberValues.put("getDLCAllClass", ImmutableList.copyOf(AlchemyEngine.findClassFromURL(url)));
invocationHandler.memberValues.put("getDLCFile", file);
file_mapping.put(dlc.name(), file);
dlc_mapping.put(dlc.name(), dlc);
logger.info("Successfully loaded DLC: " + file.getPath());
} else
logger.warn("DLC: " + file.getPath() + ", is not a standard Alchemy DLC");
} catch (Exception e) {
logger.warn("Failed to load DLC: " + file.getPath(), e);
}
}
示例6: call
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
@Override
public Void call() throws Exception {
AlchemyThrowables.checkThrowables();
logger.info("Setup: " + AlchemySetup.class.getName());
LaunchClassLoader loader = AlchemyEngine.getLaunchClassLoader();
// Support for optifine in a development environment
if (!AlchemyEngine.isRuntimeDeobfuscationEnabled())
if (AlchemyEngine.runtimeSide().isClient())
TransformerInjectOptifine.tryInject(loader);
// Injection is used to modify the at(AccessTransformer) logic of forge
// See build.gradle#L73 & ast.gradle
injectAccessTransformer(AlchemyEngine.getAlchemyCoreLocation(), loader);
// Should not be transformer javafx
loader.addTransformerExclusion("javafx.");
// An extension to net.minecraftforge.fml.common.asm.transformers.SideTransformer when transformer Alchemy's class
TransformerSide.inject(loader);
// Init DLC main class
AlchemyDLCLoader.stream().forEach(IDLCInfo::clinitDLCMainClass);
// Debug info
List<IClassTransformer> transformers = $(loader, "transformers");
AlchemyTransformerManager.logger.info(Joiner.on('\n').appendTo(new StringBuilder("Transformers: \n"), transformers).toString());
return Tool.VOID;
}
示例7: injectAccessTransformer
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
public static void injectAccessTransformer(File file, String atName, LaunchClassLoader loader) throws IOException {
if (!AlchemyEngine.isRuntimeDeobfuscationEnabled() || file == null)
return;
String at = null;
try (JarFile jar = new JarFile(file)) {
ZipEntry entry = jar.getEntry("META-INF/" + atName);
if (entry != null)
at = Tool.read(jar.getInputStream(entry));
}
if (at != null) {
List<IClassTransformer> transformers = $(loader, "transformers");
for (IClassTransformer t : transformers)
if (t instanceof AccessTransformer) {
AccessTransformer transformer = (AccessTransformer) t;
$(transformer, "processATFile", CharSource.wrap(at));
break;
}
}
}
示例8: Meddle
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public Meddle()
{
// Prevent classloader collisions, mostly due to keeping
// the deprecated DynamicMappings class.
Launch.classLoader.addClassLoaderExclusion("org.objectweb.asm.");
blacklistedTweaks.add(Meddle.class.getName());
// Launchwrapper adds the package without a period on the end, which
// covers any similarly-named packages. We could solve by putting
// Meddle's tweak class in a deeper package, but this works too
// while maintaining backwards compatibility.
try {
Field exceptionsField = LaunchClassLoader.class.getDeclaredField("classLoaderExceptions");
exceptionsField.setAccessible(true);
classloaderExceptions = (Set<String>) exceptionsField.get(Launch.classLoader);
} catch (Exception e) { e.printStackTrace(); }
classloaderExceptions.remove("net.fybertech.meddle");
classloaderExceptions.add("net.fybertech.meddle.");
}
示例9: runsAfterDeobfRemapper
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
/**
* @return Whether or not the current environment has been deobfuscated by FML
*/
public static boolean runsAfterDeobfRemapper()
{
if (runsAfterDeobfRemapper == null)
{
try
{
byte[] bytes = ((LaunchClassLoader) ObfHelper.class.getClassLoader()).getClassBytes("net.minecraft.world.World");
ObfHelper.setRunsAfterDeobfRemapper(bytes != null);
}
catch (IOException e)
{
runsAfterDeobfRemapper = false;
}
}
return runsAfterDeobfRemapper;
}
示例10: isObfuscated
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
/**
* @return Whether or not the current environment contains obfuscated Minecraft code
*/
public static boolean isObfuscated()
{
if (obfuscated == null)
{
try
{
byte[] bytes = ((LaunchClassLoader) ObfHelper.class.getClassLoader()).getClassBytes("net.minecraft.world.World");
ObfHelper.setObfuscated(bytes == null);
}
catch (IOException e)
{
obfuscated = true;
}
}
return obfuscated;
}
示例11: configureLaunchClassLoader
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
private static void configureLaunchClassLoader(final LaunchClassLoader loader) {
// Logging
loader.addClassLoaderExclusion("org.slf4j.");
loader.addClassLoaderExclusion("org.jline.");
loader.addClassLoaderExclusion("com.sun.");
loader.addClassLoaderExclusion("com.mojang.util.QueueLogAppender");
// Neptune Launch
loader.addClassLoaderExclusion("com.google.common.");
loader.addClassLoaderExclusion("org.neptunepowered.vanilla.launch.");
// Don't allow transforming libraries
loader.addTransformerExclusion("com.google.");
loader.addTransformerExclusion("org.apache.");
loader.addTransformerExclusion("joptsimple.");
loader.addTransformerExclusion("io.netty.");
loader.addTransformerExclusion("it.unimi.dsi.fastutil.");
loader.addTransformerExclusion("com.github.benmanes.caffeine.");
loader.addTransformerExclusion("net.visualillusionsent.utils.");
// Add a transformer exclusion for translator so we can get the JAR path from it
loader.addTransformerExclusion("net.canarymod.Translator");
}
示例12: injectIntoClassLoader
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader)
{
if (!hasRun)
{
FMLRelaunchLog.log.info("[LegacyJavaFixer] Replacing sort");
sort();
URL is = FMLInjectionAndSortingTweaker.class.getResource("/cpw/mods/fml/common/launcher/TerminalTweaker.class");
if (is != null)
{
FMLRelaunchLog.log.info("[LegacyJavaFixer] Detected TerminalTweaker");
@SuppressWarnings("unchecked")
List<String> newTweaks = (List<String>) Launch.blackboard.get("TweakClasses");
newTweaks.add("cpw.mods.fml.common.launcher.TerminalTweaker");
}
}
hasRun = true;
}
示例13: build
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
static void build(File mcHome, LaunchClassLoader classLoader)
{
minecraftHome = mcHome;
InputStream stream = classLoader.getResourceAsStream("fmlversion.properties");
Properties properties = new Properties();
if (stream != null)
{
try
{
properties.load(stream);
}
catch (IOException ex)
{
FMLRelaunchLog.log(Level.SEVERE, ex, "Could not get FML version information - corrupted installation detected!");
}
}
major = properties.getProperty("fmlbuild.major.number", "missing");
minor = properties.getProperty("fmlbuild.minor.number", "missing");
rev = properties.getProperty("fmlbuild.revision.number", "missing");
build = properties.getProperty("fmlbuild.build.number", "missing");
mccversion = properties.getProperty("fmlbuild.mcversion", "missing");
mcpversion = properties.getProperty("fmlbuild.mcpversion", "missing");
deobfuscationDataHash = properties.getProperty("fmlbuild.deobfuscation.hash","deadbeef");
}
示例14: injectIntoClassLoader
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的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);
}
}
示例15: injectIntoClassLoader
import net.minecraft.launchwrapper.LaunchClassLoader; //導入依賴的package包/類
@Override
public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) {
MixinBootstrap.init();
Mixins.addConfiguration("mixins.past.json");
MixinEnvironment.getDefaultEnvironment()
.setSide(MixinEnvironment.Side.CLIENT);
MixinEnvironment.getDefaultEnvironment()
.setOption(Option.DEBUG_EXPORT, true);
//launchClassLoader.registerTransformer("net.gogume1er.past.transformer.PastClassTransformer");
}