Skip to content

Commit

Permalink
Fix TickProfiler#70
Browse files Browse the repository at this point in the history
  • Loading branch information
LunNova committed May 22, 2017
1 parent 544bcb5 commit a1c0a8e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,8 @@ public static void releaseSrgBytes(String transformedName) {
cachedSrgClasses.remove(transformedName);
ModPatcherTransformer.pool.dropCache(transformedName, true);
}

public static void removeClassLoaderExclusions(String name) {
classLoaderExceptions.removeIf(it -> it.startsWith(name));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ static void initialiseClassLoader(LaunchClassLoader classLoader) {
classLoader.addTransformerExclusion("javassist");
classLoader.addTransformerExclusion("com.github.javaparser");
LaunchClassLoaderUtil.addTransformer(ModPatcherTransformer.getInstance());
LaunchClassLoaderUtil.dumpTransformersIfEnabled();
LaunchClassLoaderUtil.removeRedundantExclusions();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ private static void inject() {

@Override
public void acceptOptions(List<String> list, File file, File file1, String s) {
LaunchClassLoaderUtil.removeClassLoaderExclusions("org.minimallycorrect.modpatcher");
ModPatcherTweaker2.add();
}

@Override
Expand All @@ -54,7 +56,6 @@ public String getLaunchTarget() {
@Override
public String[] getLaunchArguments() {
inject();
LaunchClassLoaderUtil.dumpTransformersIfEnabled();
return new String[0];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.minimallycorrect.modpatcher.api.tweaker;

import net.minecraft.launchwrapper.Launch;
import org.minimallycorrect.modpatcher.api.LaunchClassLoaderUtil;

import java.io.*;
import java.util.*;

public class ModPatcherTweaker2 extends ModPatcherTweaker {
@SuppressWarnings("unchecked")
public static void add() {
((List<String>) Launch.blackboard.get("TweakClasses")).add(ModPatcherTweaker2.class.getName());
}

@Override
public void acceptOptions(List<String> list, File file, File file1, String s) {
LaunchClassLoaderUtil.removeClassLoaderExclusions("org.minimallycorrect.modpatcher");
}

@Override
public String[] getLaunchArguments() {
LaunchClassLoaderUtil.dumpTransformersIfEnabled();
return super.getLaunchArguments();
}
}

0 comments on commit a1c0a8e

Please sign in to comment.