-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
152 additions
and
10 deletions.
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,36 @@ | ||
package com.zero.retrowrapper; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import net.minecraft.launchwrapper.ITweaker; | ||
import net.minecraft.launchwrapper.LaunchClassLoader; | ||
|
||
public class IsomTweaker implements ITweaker | ||
{ | ||
private List<String> args; | ||
|
||
@Override | ||
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) | ||
{ | ||
this.args = args; | ||
} | ||
|
||
@Override | ||
public void injectIntoClassLoader(LaunchClassLoader classLoader) | ||
{ | ||
classLoader.registerTransformer("com.zero.retrowrapper.injector.IsomTweakInjector"); | ||
} | ||
|
||
@Override | ||
public String getLaunchTarget() | ||
{ | ||
return "com.zero.retrowrapper.injector.IsomTweakInjector"; | ||
} | ||
|
||
@Override | ||
public String[] getLaunchArguments() | ||
{ | ||
return args.toArray(new String[args.size()]); | ||
} | ||
} |
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,95 @@ | ||
package com.zero.retrowrapper.injector; | ||
|
||
import net.minecraft.launchwrapper.IClassTransformer; | ||
import net.minecraft.launchwrapper.Launch; | ||
|
||
import javax.swing.*; | ||
import java.applet.Applet; | ||
import java.awt.*; | ||
import java.awt.event.WindowAdapter; | ||
import java.awt.event.WindowEvent; | ||
import java.lang.reflect.Constructor; | ||
import java.lang.reflect.InvocationTargetException; | ||
import java.util.HashMap; | ||
|
||
public class IsomTweakInjector implements IClassTransformer | ||
{ | ||
/** | ||
* | ||
* THIS IS MODIFIED VERSION OF ALPHAVANILLATWEAKINJECTOR | ||
* ALL RIGHTS TO MOJANG | ||
* | ||
*/ | ||
|
||
@Override | ||
public byte[] transform(final String name, final String transformedName, final byte[] bytes) | ||
{ | ||
return bytes; | ||
} | ||
|
||
public static void main(String[] args) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException | ||
{ | ||
Class<?> clazz = getaClass("net.minecraft.isom.IsomPreviewApplet"); | ||
|
||
System.out.println("IsomTweakInjector.class.getClassLoader() = " + IsomTweakInjector.class.getClassLoader()); | ||
Constructor<?> constructor = clazz.getConstructor(); | ||
Object object = constructor.newInstance(); | ||
|
||
startMinecraft((Applet) object, args); | ||
} | ||
|
||
private static void startMinecraft(final Applet applet, String[] args) | ||
{ | ||
final Frame launcherFrameFake = new Frame(); | ||
launcherFrameFake.setTitle("Isometric Viewer"); | ||
launcherFrameFake.setBackground(Color.BLACK); | ||
|
||
final JPanel panel = new JPanel(); | ||
launcherFrameFake.setLayout(new BorderLayout()); | ||
panel.setPreferredSize(new Dimension(854, 480)); | ||
launcherFrameFake.add(panel, BorderLayout.CENTER); | ||
launcherFrameFake.pack(); | ||
|
||
launcherFrameFake.setLocationRelativeTo(null); | ||
launcherFrameFake.setVisible(true); | ||
|
||
launcherFrameFake.addWindowListener(new WindowAdapter() | ||
{ | ||
@Override | ||
public void windowClosing(WindowEvent e) | ||
{ | ||
System.exit(1); | ||
} | ||
}); | ||
|
||
LauncherFake fakeLauncher = new LauncherFake(new HashMap<String, String>(), applet); | ||
applet.setStub(fakeLauncher); | ||
|
||
fakeLauncher.setLayout(new BorderLayout()); | ||
fakeLauncher.add(applet, BorderLayout.CENTER); | ||
fakeLauncher.validate(); | ||
|
||
launcherFrameFake.removeAll(); | ||
launcherFrameFake.setLayout(new BorderLayout()); | ||
launcherFrameFake.add(fakeLauncher, BorderLayout.CENTER); | ||
launcherFrameFake.validate(); | ||
|
||
applet.init(); | ||
applet.start(); | ||
|
||
Runtime.getRuntime().addShutdownHook(new Thread() | ||
{ | ||
public void run() | ||
{ | ||
applet.stop(); | ||
} | ||
}); | ||
|
||
RetroTweakInjector.loadIconsOnFrames(); | ||
} | ||
|
||
private static Class<?> getaClass(String name) throws ClassNotFoundException | ||
{ | ||
return Launch.classLoader.findClass(name); | ||
} | ||
} |
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