Jump to content

Replacing base class


sep87x

Recommended Posts

So, last question: the Methods.class in your patch method ... does it contain a method it should be replaced with?

yes. It has the renderFirstPersonArm() as it is in the jar. THATS VERY IMPORTANT. If there's a return, etc, you still need to do that return.

My function's parameters that I gave you are as follows:

name: the name of the method you need, obfuscated or not. (do both, call it twice)

bytes the bytes you recived from the transform method

desc is the methods description

iFile is the path to the class containing the replacement methods.

rname is the name of the replacement method.

Hope I could help.

Link to comment
Share on other sites

And I don't see it in your code spoiler :P

It is there. Its in the transform method below the first code. It is right under the print saying what kind of transformation is being done and what kind of environment the game is in.

Link to comment
Share on other sites

Yes, I know, but I wanted to know what the newimport method looks like. I have the call setup in my class now:

 

		if (arg0.equals("acv")) {
		System.out.println("******** INSIDE OBFUSCATED BIOMEGENDESERT TRANSFORMER ABOUT TO PATCH: " + arg0);
		newimport("", arg2);

 

But there must be somewhere the code for the newimport method, you know, the

 

	private void newimport(String string, byte[] arg2) {

}

 

thing, or am I literally unable to spot it?

Link to comment
Share on other sites

dude....... you're returning null in

 

@Override
        public byte[] transform(String arg0, String arg1, byte[] arg2) {
                if (arg0.equals("acv")) {
                        System.out.println("******** INSIDE OBFUSCATED BIOMEGENDESERT TRANSFORMER ABOUT TO PATCH: " + arg0);
                        try {
                                return patch("a", arg2, "(Lue;)V", "/net/sep87x/desertwells/ASMMethods.class", "decorate");
                        } catch (IOException e) {
                                e.printStackTrace();
                        }
                }
               
                if (arg0.equals("net.minecraft.world.biome.BiomeGenDesert")) {
                        System.out.println("******** INSIDE BIOMEGENDESERT TRANSFORMER ABOUT TO PATCH: " + arg0);
                        try {
                                return patch("decorate", arg2, "(Lnet/minecraft/world/World;Ljava/util/Random;II)V", "/net/sep87x/desertwells/ASMMethods.class", "decorate");
                        } catch (IOException e) {
                                e.printStackTrace();
                        }
                }
               
                return null;
        }

 

change that "return null" to "return arg2"

Link to comment
Share on other sites

I would never had thought that the fault lies in the return of the transform method. Shut up and take all my Thank-you's :)

 

One last question before beta testing. This works absolutely sweet in a deobfuscated environment, but I am a bit worried about the functionality in an obfuscated environment.

 

return patch("a", arg2, "(Lue;)V", "/net/sep87x/desertwells/ASMMethods.class", "decorate");

 

What does the description "(Lue;)V" stand for? I know what the V means, but what does Lue; mean? Is that the obfuscated name of the RenderPlayer class? And if so, how do I need to make it fit the unobfuscated description "(Lnet/minecraft/world/World;Ljava/util/Random;II)V". Does it stay the same?

Link to comment
Share on other sites

i'm too lazy to check what class it is, but yes, it's the obfuscated name of some class, and yes, you need to change it. you need to find out the obfuscated name of World.class and use that. so, for example:

 

if World.class's obfuscated name is "asdfasdf.class"

 

(Lnet/minecraft/world/World;Ljava/util/Random;II)V

 

will turn into

 

(Lasdfasdf;Ljava/util/Random;II)V

 

that goes for all classes that get obfuscated.

 

 

 

EDIT:

 

if i remember right, "arg1" in

 

public byte[] transform(String arg0, String arg1, byte[] arg2)

 

is already the unobfuscated name. if it is, that would make things much easier. normally, i use the obfuscated names whenever i recompile and run my coremods in mc. i don't remember why i opted not to use that second argument. i'll have to look into again and do some testing to see if it is and if it's safe. i'll get back here if i find anything useful

Link to comment
Share on other sites

Wow, it's done crashing and it doesn't seem to works just fine. It seems like the replacement method returns null, but this shouldn't be happening.

 

java.lang.NoClassDefFoundError: net/minecraft/world/biome/BiomeGenDesert
at net.minecraft.world.biome.BiomeGenBase.<clinit>(BiomeGenBase.java:43)
at net.minecraft.world.WorldType.<clinit>(WorldType.java:23)
at net.minecraft.world.storage.WorldInfo.<init>(WorldInfo.java:88)
at net.minecraft.world.storage.SaveFormatOld.func_75803_c(SourceFile:59)
at net.minecraft.world.chunk.storage.AnvilSaveConverter.func_75799_b(SourceFile:57)
at net.minecraft.client.gui.GuiSelectWorld.func_74073_h(SourceFile:75)
at net.minecraft.client.gui.GuiSelectWorld.func_73866_w_(SourceFile:54)
at net.minecraft.client.gui.GuiScreen.func_73872_a(SourceFile:94)
at net.minecraft.client.Minecraft.func_71373_a(Minecraft.java:720)
at net.minecraft.client.gui.GuiMainMenu.func_73875_a(GuiMainMenu.java:297)
at net.minecraft.client.gui.GuiScreen.func_73864_a(SourceFile:69)
at net.minecraft.client.gui.GuiMainMenu.func_73864_a(GuiMainMenu.java:619)
at net.minecraft.client.gui.GuiScreen.func_73867_d(SourceFile:128)
at net.minecraft.client.gui.GuiScreen.func_73862_m(SourceFile:107)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1554)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:898)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)
at net.minecraft.client.main.Main.main(SourceFile:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)
at net.minecraft.launchwrapper.Launch.main(Launch.java:18)
Caused by: java.lang.ClassNotFoundException: net.minecraft.world.biome.BiomeGenDesert
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:179)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 24 more
Caused by: java.lang.NullPointerException
at net.sep87x.desertwells.DesertGenClassTransformer.patch(DesertGenClassTransformer.java:80)
at net.sep87x.desertwells.DesertGenClassTransformer.transform(DesertGenClassTransformer.java:23)
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:267)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:165)
... 26 more

 

Again, I have no idea what could be the error. The method exists and is NOT null. Could it be caused by the super-call? http://gw.minecraftforge.net/9j8v http://gw.minecraftforge.net/SQLk

(Done in an obfuscated environment)

 

Edit: The error has been created because there wasn't a replacement method. It exists though. What could be the source of the error?

 

Edit 2: Oh man, I forgot that the method name inside the ASMMethods class is also obfuscated. Changed it. Works. Thanks to anyonw who has helped :)

Link to comment
Share on other sites

Wow, it's done crashing and it doesn't seem to works just fine. It seems like the replacement method returns null, but this shouldn't be happening.

 

java.lang.NoClassDefFoundError: net/minecraft/world/biome/BiomeGenDesert
at net.minecraft.world.biome.BiomeGenBase.<clinit>(BiomeGenBase.java:43)
at net.minecraft.world.WorldType.<clinit>(WorldType.java:23)
at net.minecraft.world.storage.WorldInfo.<init>(WorldInfo.java:88)
at net.minecraft.world.storage.SaveFormatOld.func_75803_c(SourceFile:59)
at net.minecraft.world.chunk.storage.AnvilSaveConverter.func_75799_b(SourceFile:57)
at net.minecraft.client.gui.GuiSelectWorld.func_74073_h(SourceFile:75)
at net.minecraft.client.gui.GuiSelectWorld.func_73866_w_(SourceFile:54)
at net.minecraft.client.gui.GuiScreen.func_73872_a(SourceFile:94)
at net.minecraft.client.Minecraft.func_71373_a(Minecraft.java:720)
at net.minecraft.client.gui.GuiMainMenu.func_73875_a(GuiMainMenu.java:297)
at net.minecraft.client.gui.GuiScreen.func_73864_a(SourceFile:69)
at net.minecraft.client.gui.GuiMainMenu.func_73864_a(GuiMainMenu.java:619)
at net.minecraft.client.gui.GuiScreen.func_73867_d(SourceFile:128)
at net.minecraft.client.gui.GuiScreen.func_73862_m(SourceFile:107)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1554)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:898)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)
at net.minecraft.client.main.Main.main(SourceFile:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)
at net.minecraft.launchwrapper.Launch.main(Launch.java:18)
Caused by: java.lang.ClassNotFoundException: net.minecraft.world.biome.BiomeGenDesert
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:179)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 24 more
Caused by: java.lang.NullPointerException
at net.sep87x.desertwells.DesertGenClassTransformer.patch(DesertGenClassTransformer.java:80)
at net.sep87x.desertwells.DesertGenClassTransformer.transform(DesertGenClassTransformer.java:23)
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:267)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:165)
... 26 more

 

Again, I have no idea what could be the error. The method exists and is NOT null. Could it be caused by the super-call? http://gw.minecraftforge.net/9j8v http://gw.minecraftforge.net/SQLk

(Done in an obfuscated environment)

 

Edit: The error has been created because there wasn't a replacement method. It exists though. What could be the source of the error?

 

Edit 2: Oh man, I forgot that the method name inside the ASMMethods class is also obfuscated. Changed it. Works. Thanks to anyonw who has helped :)

I knew your problem was in the returning of the bytes xD. Guess I just missed that, because I assumed after you changed your code it would be fixed. Glad you got this worked out.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.