Skip to content

Commit

Permalink
Isometric viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
xa committed Apr 13, 2018
1 parent bb33a07 commit 92da6d7
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 10 deletions.
1 change: 0 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/home/kcx/.minecraft/libraries/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar"/>
<classpathentry kind="lib" path="/home/kcx/.minecraft/libraries/org/ow2/asm/asm-all/5.2/asm-all-5.2.jar" sourcepath="/tmp/.org.sf.feeling.decompiler1519648874867/source/asm-all-5.2-sources-1519666369322.jar"/>
<classpathentry kind="lib" path="/home/kcx/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ Download latest version from releases and launch it.

Select version you want to wrap and click 'Install'

**ISOMECTRIC VIEWER**

Only for inf-20100627 and inf-20100618.

Patch that version, and edit inf-20100627-wrapped.json

Change tweakClass com.zero.retrowrapper.RetroTweaker to tweakClass com.zero.retrowrapper.IsomTweaker

Done

**SINGLEPLAYER HACKS**

- Teleport hack (useful for checking farlands!)
Expand Down
36 changes: 36 additions & 0 deletions src/com/zero/retrowrapper/IsomTweaker.java
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()]);
}
}
95 changes: 95 additions & 0 deletions src/com/zero/retrowrapper/injector/IsomTweakInjector.java
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);
}
}
3 changes: 1 addition & 2 deletions src/com/zero/retrowrapper/injector/RetroTweakInjector.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraft.launchwrapper.Launch;

import org.lwjgl.opengl.Display;
import org.objectweb.asm.*;
import org.objectweb.asm.tree.*;

Expand Down Expand Up @@ -143,7 +142,7 @@ public static void loadIconsOnFrames()
File e = new File(Launch.assetsDir, "icons/icon_16x16.png");
File bigIcon = new File(Launch.assetsDir, "icons/icon_32x32.png");
System.out.println("Loading current icons for window from: " + e + " and " + bigIcon);
Display.setIcon(new ByteBuffer[]{loadIcon(e), loadIcon(bigIcon)});
// Display.setIcon(new ByteBuffer[]{loadIcon(e), loadIcon(bigIcon)});
java.awt.Frame[] frames = java.awt.Frame.getFrames();
if (frames != null)
{
Expand Down
17 changes: 10 additions & 7 deletions src/com/zero/retrowrapper/injector/RetroTweakInjectorTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -50,6 +53,12 @@ public static void main(String[] args) throws ClassNotFoundException, NoSuchMeth

new RetroEmulator().start();

Properties props = System.getProperties();
if(props.getProperty("retrowrapper.hack") != null)
{
new HackThread().start();
}

try
{
Class<?> clazz;
Expand All @@ -59,7 +68,7 @@ public static void main(String[] args) throws ClassNotFoundException, NoSuchMeth
try
{
clazz = getaClass("net.minecraft.client.MinecraftApplet");
} catch (ClassNotFoundException ignored) {
} catch (ClassNotFoundException ex) {
veryOld = true;
clazz = getaClass("com.mojang.minecraft.MinecraftApplet");
}
Expand Down Expand Up @@ -177,12 +186,6 @@ public void run()
}
});

Properties props = System.getProperties();
if(props.getProperty("retrowrapper.hack") != null)
{
new HackThread().start();
}

RetroTweakInjector.loadIconsOnFrames();
}

Expand Down

0 comments on commit 92da6d7

Please sign in to comment.