Posted July 23, 201312 yr so with the help of this guide http://download.forge.objectweb.org/asm/asm4-guide.pdf i was able to understand a bit more about how the JVM works and bytecode is assembled. (note i already did assembly in university before). Thing is everything i seem to try when visiting a method seems to result in a crash. I did search on the wiki to find a ASM tutorial and its only to change visibility of fields and methods, i need a bit more (make method call and load variable inside method) Is there anyone that make these kind of things that would share his knowledge with me ? how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr The asm website recommends using their eclipse extension. Then create a simple class and convert it to asm instructions using the plugin. Then add to the class some more stuff, and look at the new set of asm, then you can compare the two files of asm instructions to see what had to change for the asm to generate the additions If you guys dont get it.. then well ya.. try harder...
July 23, 201312 yr Author @mazetar yea that would help a lot, thanks, at least i learned more about how the jvm works @pelep: dynamicly implement vanilla change that i had to hard code before list(maybe incomplete): block place/break event entity living heal event player right click event redirect visible equipped item in hand btw maybe some of those are new feature in recent forge version but they werent when i started coding (6-7 month ago) so i also need to check the latest event/feature to checkthat i still need asm/vanilla transforms to implement my mod correctly how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr well, you can actually do what mazetar said. should be easy enough with the eclipse plugin. you can also check out dynamic light's source (atomic stryker). he does some modifications to the World.class to get his mod working. if you still need help after that, i can help if all you're all you're doing is what you listed above and nothing else too extravagant
July 23, 201312 yr Author @pelep: i will deffinitely also check out that mod but yeah my hard coded things are usually one line it shoulnt be a problem to implement in asm can i pm you if i need more help? and the thing is, i understand in assembly what im supposed to be doing. i just cant seem to call the right bethods in the right order to realise what i want. so if i at least know what im doing i would be able to do the "extravagant" asm on my own without any problem how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr sure, though i think you'd be able to get the info you need in his source already. if you need more help, you can pm me, but just so you know, even though i've used asm, i'm in no way an expert in it. so... nothing too huge please. lol
July 23, 201312 yr Author nah dont just copy paste from his mod into the forums, i can do that too i do it all the time for java newbie. how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr Author oh shit my bad. i misread like crazy "i think youd be able to get the info" became "i thin id be able to get the info" so i tought you were gonna copy pasta some code my bad how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr haha no worries. and just a heads-up: once you get your asm stuff running in your dev environment, compiling it is gonna be a bitch. you're gonna have to get the obfuscated names of the classes that you used in the lines you injected. nothing difficult, but soooo f*cking tedious .___.
July 23, 201312 yr Author yeah i heard about that. i didnt start making a mapping but it looks easy enough is there any way to know if youre working a obfucsated/deobf environnement? (i didnt not search so fell free to tell me to look harder or look at the wili etc ) how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr well, i know of one way, but i don't use it. forge injects the data through injectData(Map) in your IFMLLoadingPlugin class, but the last time i tried using it, it was called after the transformers started running. so, if the class you want to modify was "modified" before the data's injected, you miss your chance for that class. i got too lazy too keep digging around after that, so the way i do it now is i have a boolean in the constructor of my transformer which i manually change every time before i recompile. if you find out another way to do it, feel free to tell me hahah EDIT: i just looked into it now, and it might have changed. it seems to be called before the transformers are ran now. gonna have to look around the stuff first to see if it really is. if it is... <3
July 23, 201312 yr You have probably seen or knowlegde of this already: https://www.google.no/url?sa=t&source=web&cd=1&ved=0CC8QFjAA&url=http%3A%2F%2Fwww.minecraftforum.net%2Ftopic%2F1854988-tutorial-152161-changing-vanilla-without-editing-base-classes-coremods-and-events-very-advanced%2F&ei=DU7uUbTMH4iC4ASe24HgBQ&usg=AFQjCNFiKTE2wJjA0G5jxeVsCQKv-ljOHQ I found the included video to be quite informative, even tough they say its not needed to know I like to know as much as possible when doing stuff If you guys dont get it.. then well ya.. try harder...
July 23, 201312 yr Author i was thinking to decide obfuscated or not pick a class (any class) use reflection to check if that class exists something like Class.forName("net.minecraft.block.Block") != null; (or is it throwing an exception if it cant find it? dont remember) if it doesnt find it try the same class with its obfuscated name (if it finds it you are in deob environnement) Class.forName("jd") != null;//i have no idea what Block class obfuscated name is btw, didnt bother to look in the configs if it finds it you are in obf envir, if it doesnt (and you have correct names) you're screwed would that work ? how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr If you want to dynamically change class files at runtime, I recommend using a tool called Javassist. It will make your life much easier. http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/
July 23, 201312 yr Author and then force my mod users to download another library, thanks but ill stick with ASM, it works i jsut need to figure out how and why how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr Author the eclipse plugin is at the same time the craziest things I've seen in my life (coding life ) and the worst curse you could give me. basicly the plugin will allot you to have a ASM view of the code and you can just kinda copy paste what you need WITHOUT knowing what you're doing(welll ... without knowing too much, you still have to understand what you're doing). ill end up doing whatever i want without ever exactly knowing what's going on in ASM ..... thanks mazetar how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr Or just distribute Javassist with your library. Up to you. Or tell Forge to download it for your you. I support javassist.
July 23, 201312 yr Author too late guys, already made an api for ASM that work great (2-3 minute per modification so far) but thanks for the help how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr too late guys, already made an api for ASM that work great (2-3 minute per modification so far) but thanks for the help Nice would you share it ?
July 23, 201312 yr Author i tought you were a fanboy of javassist ? the answer is yes btw but ill clean it up first to make things clearer adn more generic ( MyModNameClassReplacer isnt exactly generic ) how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
July 23, 201312 yr Author im even going to make a tutorial for it how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.