Taught AlphaVanillaTweakInjector about com.mojang
This commit is contained in:
parent
4132777c85
commit
6ee0ba5518
3 changed files with 22 additions and 10 deletions
|
@ -10,7 +10,7 @@ repositories {
|
|||
|
||||
group = 'net.minecraft'
|
||||
archivesBaseName = 'launchwrapper'
|
||||
version = '1.5'
|
||||
version = '1.6'
|
||||
|
||||
dependencies {
|
||||
compile 'net.sf.jopt-simple:jopt-simple:4.5'
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package net.minecraft.launchwrapper.injector;
|
||||
|
||||
import net.minecraft.launchwrapper.AlphaVanillaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraft.launchwrapper.VanillaTweaker;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.applet.Applet;
|
||||
|
@ -17,7 +15,8 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.lang.reflect.Modifier;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AlphaVanillaTweakInjector implements IClassTransformer {
|
||||
public AlphaVanillaTweakInjector() {
|
||||
|
@ -29,7 +28,14 @@ public class AlphaVanillaTweakInjector implements IClassTransformer {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
|
||||
Class clazz = getaClass("net.minecraft.client.MinecraftApplet");
|
||||
Class clazz;
|
||||
|
||||
try {
|
||||
clazz = getaClass("net.minecraft.client.MinecraftApplet");
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
clazz = getaClass("com.mojang.minecraft.MinecraftApplet");
|
||||
}
|
||||
|
||||
System.out.println("AlphaVanillaTweakInjector.class.getClassLoader() = " + AlphaVanillaTweakInjector.class.getClassLoader());
|
||||
Constructor constructor = clazz.getConstructor();
|
||||
Object object = constructor.newInstance();
|
||||
|
@ -37,7 +43,7 @@ public class AlphaVanillaTweakInjector implements IClassTransformer {
|
|||
for (Field field : clazz.getDeclaredFields()) {
|
||||
String name = field.getType().getName();
|
||||
|
||||
if (!name.contains("awt") && !name.contains("java")) {
|
||||
if (!name.contains("awt") && !name.contains("java") && !name.equals("long")) {
|
||||
System.out.println("Found likely Minecraft candidate: " + field);
|
||||
|
||||
Field fileField = getWorkingDirField(name);
|
||||
|
@ -107,6 +113,16 @@ public class AlphaVanillaTweakInjector implements IClassTransformer {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getCodeBase() {
|
||||
try {
|
||||
return new URL("http://www.minecraft.net/game/");
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String paramName) {
|
||||
if (params.containsKey(paramName)) {
|
||||
|
|
|
@ -23,10 +23,6 @@ public class IndevVanillaTweakInjector implements IClassTransformer {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (name.equals("net.minecraft.client.d")) {
|
||||
String beep = name.toLowerCase();
|
||||
}
|
||||
|
||||
final ClassNode classNode = new ClassNode();
|
||||
final ClassReader classReader = new ClassReader(bytes);
|
||||
classReader.accept(classNode, ClassReader.EXPAND_FRAMES);
|
||||
|
|
Loading…
Reference in a new issue