Java Code Examples for net.minecraft.launchwrapper.LaunchClassLoader#registerTransformer()

The following examples show how to use net.minecraft.launchwrapper.LaunchClassLoader#registerTransformer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Meddle.java    From Meddle with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader)
{
	// Register any transformer classes specified in mod manifests
	for (ModContainer mod : discoveredModsList)
	{
		if (mod.transformerClass != null) {
			try {
				Class.forName(mod.transformerClass, true, classLoader);
			} catch (ClassNotFoundException e) {}
			classLoader.registerTransformer(mod.transformerClass);
		}
	}
}
 
Example 2
Source File: TweakerMixinLoader.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
    System.out.println("[LiquidBounce] Injecting with TweakerMixinLoader.");

    MixinBootstrap.init();
    Mixins.addConfiguration("liquidbounce.vanilla.mixins.json");
    MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);

    classLoader.registerTransformer(AbstractJavaLinkerTransformer.class.getName());
}
 
Example 3
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 4
Source File: AuthlibTweaker.java    From authlib-agent with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) {
	LOGGER.info("injecting AuthlibClassTransformer into LaunchClassLoader");
	launchClassLoader.registerTransformer(AuthlibClassTransformer.class.getName());
}
 
Example 5
Source File: FabricTweaker.java    From fabric-loader with Apache License 2.0 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) {
	isDevelopment = Boolean.parseBoolean(System.getProperty("fabric.development", "false"));
	Launch.blackboard.put("fabric.development", isDevelopment);
	setProperties(Launch.blackboard);

	this.launchClassLoader = launchClassLoader;
	launchClassLoader.addClassLoaderExclusion("org.objectweb.asm.");
	launchClassLoader.addClassLoaderExclusion("org.spongepowered.asm.");
	launchClassLoader.addClassLoaderExclusion("net.fabricmc.loader.");

	launchClassLoader.addClassLoaderExclusion("net.fabricmc.api.Environment");
	launchClassLoader.addClassLoaderExclusion("net.fabricmc.api.EnvType");

	GameProvider provider = new MinecraftGameProvider();
	provider.acceptArguments(arguments);

	if (!provider.locateGame(getEnvironmentType(), launchClassLoader)) {
		throw new RuntimeException("Could not locate Minecraft: provider locate failed");
	}

	@SuppressWarnings("deprecation")
	FabricLoader loader = FabricLoader.INSTANCE;
	loader.setGameProvider(provider);
	loader.load();
	loader.freeze();

	launchClassLoader.registerTransformer("net.fabricmc.loader.launch.FabricClassTransformer");

	if (!isDevelopment) {
		// Obfuscated environment
		Launch.blackboard.put("fabric.development", false);
		try {
			String target = getLaunchTarget();
			URL loc = launchClassLoader.findResource(target.replace('.', '/') + ".class");
			JarURLConnection locConn = (JarURLConnection) loc.openConnection();
			File jarFile = UrlUtil.asFile(locConn.getJarFileURL());
			if (!jarFile.exists()) {
				throw new RuntimeException("Could not locate Minecraft: " + jarFile.getAbsolutePath() + " not found");
			}

			FabricLauncherBase.deobfuscate(provider.getGameId(), provider.getNormalizedGameVersion(), provider.getLaunchDirectory(), jarFile.toPath(), this);
		} catch (IOException | UrlConversionException e) {
			throw new RuntimeException("Failed to deobfuscate Minecraft!", e);
		}
	}

	FabricLoader.INSTANCE.getAccessWidener().loadFromMods();

	MinecraftGameProvider.TRANSFORMER.locateEntrypoints(this);

	// Setup Mixin environment
	MixinBootstrap.init();
	FabricMixinBootstrap.init(getEnvironmentType(), FabricLoader.INSTANCE);
	MixinEnvironment.getDefaultEnvironment().setSide(getEnvironmentType() == EnvType.CLIENT ? MixinEnvironment.Side.CLIENT : MixinEnvironment.Side.SERVER);

	EntrypointUtils.invoke("preLaunch", PreLaunchEntrypoint.class, PreLaunchEntrypoint::onPreLaunch);
}
 
Example 6
Source File: TcpNoDelayTweaker.java    From TcpNoDelayMod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
    classLoader.registerTransformer(ClassTransformer.class.getName());
}
 
Example 7
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 8
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 9
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 10
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 11
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 12
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 13
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 14
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 15
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 16
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 17
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}
 
Example 18
Source File: ClassTweaker.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
	classLoader.registerTransformer(Transformer.class.getName());
}