(String[] args)
| 93 | } |
| 94 | |
| 95 | public static void main(String[] args) throws Throwable { |
| 96 | final IClassProvider classProvider = new GuavaClassPathProvider(); |
| 97 | final TransformerManager transformerManager = new TransformerManager(classProvider); |
| 98 | transformerManager.addTransformerPreprocessor(new MixinsTranslator()); |
| 99 | transformerManager.addTransformer("net.raphimc.viaproxy.injection.mixins.**"); |
| 100 | if (instrumentation != null) { |
| 101 | transformerManager.hookInstrumentation(instrumentation); |
| 102 | injectedMain("Launcher Agent", args); |
| 103 | return; |
| 104 | } |
| 105 | try { |
| 106 | transformerManager.hookInstrumentation(Agents.getInstrumentation()); |
| 107 | } catch (Throwable t) { |
| 108 | final InjectionClassLoader injectionClassLoader = new InjectionClassLoader(transformerManager, ClassLoaders.getSystemClassPath()); |
| 109 | injectionClassLoader.setPriority(EnumLoaderPriority.PARENT_FIRST); |
| 110 | Thread.currentThread().setContextClassLoader(injectionClassLoader); |
| 111 | Methods.invoke(null, Methods.getDeclaredMethod(injectionClassLoader.loadClass(ViaProxy.class.getName()), "injectedMain", String.class, String[].class), "Injection ClassLoader", args); |
| 112 | return; |
| 113 | } |
| 114 | injectedMain("Runtime Agent", args); |
| 115 | } |
| 116 | |
| 117 | public static void injectedMain(final String injectionMethod, final String[] args) throws InterruptedException, IOException, InvocationTargetException { |
| 118 | final boolean useUI = args.length == 0 && !GraphicsEnvironment.isHeadless(); |
nothing calls this directly
no test coverage detected