-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Tweaker which will ensure transformer is last, if possible.
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package me.nallar.modpatcher; | ||
|
||
import net.minecraft.launchwrapper.ITweaker; | ||
import net.minecraft.launchwrapper.Launch; | ||
import net.minecraft.launchwrapper.LaunchClassLoader; | ||
|
||
import java.io.*; | ||
import java.util.*; | ||
|
||
/** | ||
* Tries to ensure that our transformer is last | ||
*/ | ||
public class ModPatcherTweaker implements ITweaker { | ||
@SuppressWarnings("unchecked") | ||
public static void add() { | ||
List<String> newTweaks = (List<String>) Launch.blackboard.get("TweakClasses"); | ||
newTweaks.add(ModPatcherTweaker.class.getName()); | ||
} | ||
|
||
private static void inject() { | ||
LaunchClassLoaderUtil.addTransformer(ModPatcherTransformer.getInstance()); | ||
} | ||
|
||
@Override | ||
public void acceptOptions(List<String> list, File file, File file1, String s) { | ||
inject(); | ||
} | ||
|
||
@Override | ||
public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) { | ||
inject(); | ||
} | ||
|
||
@Override | ||
public String getLaunchTarget() { | ||
inject(); | ||
return null; | ||
} | ||
|
||
@Override | ||
public String[] getLaunchArguments() { | ||
inject(); | ||
return new String[0]; | ||
} | ||
} |