Thanks! Those should be easily doable if they are non-static (and only used by non-static methods), I will have to look at the render classes though.
Haha convenient timing! GUI functions should be easy, openGui especially.
I hope to implement both of those, especially since they usually require jar modding or reflection.
If you're going to modify the class for it, you can use a event system, so all class that register it are called in the place when event is registered.
<Or a ArrayList, also>
If you're going to modify the class for it, you can use a event system, so all class that register it are called in the place when event is registered.
<Or a ArrayList, also>
The way I have currently been doing events is to add a method event<whatever> to the base Mod class, load all mods into a single ArrayList, and iterate over it calling the event<whatever> method for whatever event. Mod that want to handle that event only have to override the event<whatever> for that event.
I don't understand the difference between this and FML, as the things you specified in the list like mobs, GUIs, tick handlers, hooks etc are possible in forge quite easily...
I don't understand the difference between this and FML, as the things you specified in the list like mobs, GUIs, tick handlers, hooks etc are possible in forge quite easily...
They are, but they don't have specific functions to make it really easy. You can do most anything in forge with ASM, but without it it becomes a bit harder to override vanilla behavior.
This is just an alternative to Forge for people who don't want to utilise all of Forge's features, which can be pretty resource intensive at times. Modloader was originally used for mods like this after Forge became a standalone API instead of requiring Modloader to run, but now with the possible death of Risugami's Modloader this should replace (and be much better than it)
Exactly! And with BL I am also trying to cover ground that forge does not have much API for.
I hope it can be useful! I have tried to change as few classes as possible (currently only Main.class) to ensure compatibility with other APIs like LiteLoader (Minecraft.class), ModLoader if ever updated (some random minor class), and Forge (pretty much everything except Main.class). This does have the side effect of somewhat limiting the API's access, though.
Sorry but just to clarify, LiteLoader doesn't modify any base classes except for "CallableJVMFlags" which is only used to hook into crash reports. I nearly posted on your reddit thread actually because I wondered if you wanted to use LiteLoader as the "loader" base (it literally is a loader not an API in any way) because you could build your API on top of it and leverage the quite robust versioning/metadata system that I have already developed with LiteLoader - kind of like the relationship Forge has to FML.
I'd be happy to discuss it with you if you're interested in going down that route, and if not then it'll be great to have yet more options for players in the form of another API/Loader, since the very reason I persist with LiteLoader is that I feel like choice is good for end-users.
Just a final thought, is there a reason you're not using the tweak system? My experience with it, and talking with cpw to ensure compatibility etc, has been nothing but good and the power it puts in your hands is very great, just wondered why the choice to override Main rather than going with a tweak.
Anyway, best of luck with your project, if my experiences are anything to go by players will be quite confrontational about another loader to deal with, but my advice is to ignore them and try to do what's best regardless of criticism.
EDIT: LiteLoader sources are here if you are interested
Sorry but just to clarify, LiteLoader doesn't modify any base classes except for "CallableJVMFlags" which is only used to hook into crash reports. I nearly posted on your reddit thread actually because I wondered if you wanted to use LiteLoader as the "loader" base (it literally is a loader not an API in any way) because you could build your API on top of it and leverage the quite robust versioning/metadata system that I have already developed with LiteLoader - kind of like the relationship Forge has to FML. I'd be happy to discuss it with you if you're interested in going down that route, and if not then it'll be great to have yet more options for players in the form of another API/Loader, since the very reason I persist with LiteLoader is that I feel like choice is good for end-users. Just a final thought, is there a reason you're not using the tweak system? My experience with it, and talking with cpw to ensure compatibility etc, has been nothing but good and the power it puts in your hands is very great, just wondered why the choice to override Main rather than going with a tweak. Anyway, best of luck with your project, if my experiences are anything to go by players will be quite confrontational about another loader to deal with, but my advice is to ignore them and try to do what's best regardless of criticism. EDIT: LiteLoader sources are here if you are interested
Sorry about the confusion with LiteLoader, last time I used it I thought it modified Minecraft.class. I will correct that! The reason I am not using the tweak system is that I don't really know how. I could look into using it but I would need to know more about it.
Sorry about the confusion with LiteLoader, last time I used it I thought it modified Minecraft.class. I will correct that!
Nope, base clean as much as possible because I've always been dead set against jar modding, the only reason for the single base mod is like I said because there's no other way to hook into crash reports and I felt it was important enough to break my rule.
The reason I am not using the tweak system is that I don't really know how. I could look into using it but I would need to know more about it.
It's actually really simple, that's the big secret. cpw was really helpful in getting me started with it and I'm more than happy to pay on that favour if you're interested. It gives you a lot of power and also buys you some extra compatibility to boot, the reason I linked the liteloader source is that it's a pretty bijou implementation of a tweaker and only really uses the tweaker as a jumping-off point to save having to override base classes. The other thing is you get a neat "inb4 x" functionality in being able to hook into the classloader itself before the game is loaded - very handy for injecting external jar mods if that was likely to be a route you'd consider, without needing to get people to touch the mc jar itself.
Also, whilst the FML sources need the forge version of MCP, all the liteloader sources are against vanilla MCP so they may be a bit easier to follow what's going on and experiment with the source yourself if you're already familiar with MCP.
Nope, base clean as much as possible because I've always been dead set against jar modding, the only reason for the single base mod is like I said because there's no other way to hook into crash reports and I felt it was important enough to break my rule.
It's actually really simple, that's the big secret. cpw was really helpful in getting me started with it and I'm more than happy to pay on that favour if you're interested. It gives you a lot of power and also buys you some extra compatibility to boot, the reason I linked the liteloader source is that it's a pretty bijou implementation of a tweaker and only really uses the tweaker as a jumping-off point to save having to override base classes. The other thing is you get a neat "inb4 x" functionality in being able to hook into the classloader itself before the game is loaded - very handy for injecting external jar mods if that was likely to be a route you'd consider, without needing to get people to touch the mc jar itself.
Also, whilst the FML sources need the forge version of MCP, all the liteloader sources are against vanilla MCP so they may be a bit easier to follow what's going on and experiment with the source yourself if you're already familiar with MCP.
I'll check out the source, thanks! One question would I be able to disable Main.class's main() function? The way I load BL is by replace the call to create a new Minecraft with a call to create a new MinecraftProxy (which extends Minecraft). I would have to disable that call in order to load the proxy class.
I'll check out the source, thanks! One question would I be able to disable Main.class's main() function? The way I load BL is by replace the call to create a new Minecraft with a call to create a new MinecraftProxy (which extends Minecraft). I would have to disable that call in order to load the proxy class.
The "primary" tweaker has the opportunity to nominate the main class, so yes you could actually call an entirely different main without having to resort to redistributing Mojang's, you could also register a class transformer and just replace the reference to the Minecraft class with your own using asm (hint, check out Mojang's own source for the tweak system to see the simple transformations they apply to load old indev versions and such).
So yeah, lots of options
Edit: sorry to clarify, the primary tweaker is the first one in the chain, since multiple tweakers can be active at once but only one can nominate the "Main"
The "primary" tweaker has the opportunity to nominate the main class, so yes you could actually call an entirely different main without having to resort to redistributing Mojang's, you could also register a class transformer and just replace the reference to the Minecraft class with your own using asm (hint, check out Mojang's own source for the tweak system to see the simple transformations they apply to load old indev versions and such).
So yeah, lots of options
Edit: sorry to clarify, the primary tweaker is the first one in the chain, since multiple tweakers can be active at once but only one can nominate the "Main"
That will do exactly what I want, thanks a lot! So if I were to write a Tweaker for BL, how would you install the mod? And would it still be possible to install as a JAR mod or with a launcher like MagicLauncher?
That will do exactly what I want, thanks a lot! So if I were to write a Tweaker for BL, how would you install the mod? And would it still be possible to install as a JAR mod or with a launcher like MagicLauncher?
Well no, unless you put base class mods in there as well, using the tweaker is a deliberate step away from wantonly violating the Mojang ToU by distributing base classes, however there is a convenient open source installer that installs the tweak library and required arguments. MagicLauncher isn't an issue because it doesn't really do anything any more, it just loads the "environment" that is defined in the real launcher anyway since the new launcher is orders of magnitude more powerful now.
Don't forget also that being a tweak means that other tweakers that support it can also load you, so for example in the near future it will be possible for FML to load liteloader and vice versa (and also other tweakers like Optifine), so that means that once you have one tweak installed, installing others is a drag-n-drop affair, but with more power than just being a plain mod.
In addition, in the future even that won't be necessary, since when the new launcher is completed there will be a nice GUI for all of this, it just doesn't exist yet, making the installers the easiest way for now.
Well no, unless you put base class mods in there as well, using the tweaker is a deliberate step away from wantonly violating the Mojang ToU by distributing base classes, however there is a convenient open source installer that installs the tweak library and required arguments. MagicLauncher isn't an issue because it doesn't really do anything any more, it just loads the "environment" that is defined in the real launcher anyway since the new launcher is orders of magnitude more powerful now.
Don't forget also that being a tweak means that other tweakers that support it can also load you, so for example in the near future it will be possible for FML to load liteloader and vice versa (and also other tweakers like Optifine), so that means that once you have one tweak installed, installing others is a drag-n-drop affair, but with more power than just being a plain mod.
In addition, in the future even that won't be necessary, since when the new launcher is completed there will be a nice GUI for all of this, it just doesn't exist yet, making the installers the easiest way for now.
From minecraft.net/terms: "Basically, mods (or plugins, or tools) are cool (you can distribute those)" But anyway how would I install the tweaker version? Just add it to the classpath?
From minecraft.net/terms: "Basically, mods (or plugins, or tools) are cool (you can distribute those)" But anyway how would I install the tweaker version? Just add it to the classpath?
Kind of, add your jar to the class path as well as the tweak system itself, add an entry on the command line specifying your tweak class and any others you want to load, and set the main class to the tweaker main, the installer does all that for you.
The tweaker main then handles setting up the funky classloader and loading all the tweaks and asking them for their opinion on how to launch the game and letting them hook into the classloader, then it launches the main class specified by the primary tweaker.
Kind of, add your jar to the class path as well as the tweak system itself, add an entry on the command line specifying your tweak class and any others you want to load, and set the main class to the tweaker main, the installer does all that for you.
The tweaker main then handles setting up the funky classloader and loading all the tweaks and asking them for their opinion on how to launch the game and letting them hook into the classloader, then it launches the main class specified by the primary tweaker.
Thanks! Earlier you said it would also be possible to use ASM to change to main() method of Main.class. Does the vanilla launcher support that?
Thanks! Earlier you said it would also be possible to use ASM to change to main() method of Main.class. Does the vanilla launcher support that?
No but the tweak system does, because it replaces the default AppClassLoader with the hookable LaunchClassLoader which supports transforming classes on the fly using ASM (just add ASM into your class path as well), there's even some really good examples in Mojang's code of the kind of approach that can be used to achieve this.
No but the tweak system does, because it replaces the default AppClassLoader with the hookable LaunchClassLoader which supports transforming classes on the fly using ASM (just add ASM into your class path as well), there's even some really good examples in Mojang's code of the kind of approach that can be used to achieve this.
If you're going to modify the class for it, you can use a event system, so all class that register it are called in the place when event is registered.
<Or a ArrayList, also>
Woah woah!
The way I have currently been doing events is to add a method event<whatever> to the base Mod class, load all mods into a single ArrayList, and iterate over it calling the event<whatever> method for whatever event. Mod that want to handle that event only have to override the event<whatever> for that event.
Glad you are interested! If you watch the GitHub repo you will be notified when I upload new code. I try to push at least 1 commit a day.
They are, but they don't have specific functions to make it really easy. You can do most anything in forge with ASM, but without it it becomes a bit harder to override vanilla behavior.
Exactly! And with BL I am also trying to cover ground that forge does not have much API for.
Sorry but just to clarify, LiteLoader doesn't modify any base classes except for "CallableJVMFlags" which is only used to hook into crash reports. I nearly posted on your reddit thread actually because I wondered if you wanted to use LiteLoader as the "loader" base (it literally is a loader not an API in any way) because you could build your API on top of it and leverage the quite robust versioning/metadata system that I have already developed with LiteLoader - kind of like the relationship Forge has to FML.
I'd be happy to discuss it with you if you're interested in going down that route, and if not then it'll be great to have yet more options for players in the form of another API/Loader, since the very reason I persist with LiteLoader is that I feel like choice is good for end-users.
Just a final thought, is there a reason you're not using the tweak system? My experience with it, and talking with cpw to ensure compatibility etc, has been nothing but good and the power it puts in your hands is very great, just wondered why the choice to override Main rather than going with a tweak.
Anyway, best of luck with your project, if my experiences are anything to go by players will be quite confrontational about another loader to deal with, but my advice is to ignore them and try to do what's best regardless of criticism.
EDIT: LiteLoader sources are here if you are interested
Thanks!
Sorry about the confusion with LiteLoader, last time I used it I thought it modified Minecraft.class. I will correct that! The reason I am not using the tweak system is that I don't really know how. I could look into using it but I would need to know more about it.
Nope, base clean as much as possible because I've always been dead set against jar modding, the only reason for the single base mod is like I said because there's no other way to hook into crash reports and I felt it was important enough to break my rule.
It's actually really simple, that's the big secret. cpw was really helpful in getting me started with it and I'm more than happy to pay on that favour if you're interested. It gives you a lot of power and also buys you some extra compatibility to boot, the reason I linked the liteloader source is that it's a pretty bijou implementation of a tweaker and only really uses the tweaker as a jumping-off point to save having to override base classes. The other thing is you get a neat "inb4 x" functionality in being able to hook into the classloader itself before the game is loaded - very handy for injecting external jar mods if that was likely to be a route you'd consider, without needing to get people to touch the mc jar itself.
Also, whilst the FML sources need the forge version of MCP, all the liteloader sources are against vanilla MCP so they may be a bit easier to follow what's going on and experiment with the source yourself if you're already familiar with MCP.
I'll check out the source, thanks! One question would I be able to disable Main.class's main() function? The way I load BL is by replace the call to create a new Minecraft with a call to create a new MinecraftProxy (which extends Minecraft). I would have to disable that call in order to load the proxy class.
The "primary" tweaker has the opportunity to nominate the main class, so yes you could actually call an entirely different main without having to resort to redistributing Mojang's, you could also register a class transformer and just replace the reference to the Minecraft class with your own using asm (hint, check out Mojang's own source for the tweak system to see the simple transformations they apply to load old indev versions and such).
So yeah, lots of options
Edit: sorry to clarify, the primary tweaker is the first one in the chain, since multiple tweakers can be active at once but only one can nominate the "Main"
That will do exactly what I want, thanks a lot! So if I were to write a Tweaker for BL, how would you install the mod? And would it still be possible to install as a JAR mod or with a launcher like MagicLauncher?
Well no, unless you put base class mods in there as well, using the tweaker is a deliberate step away from wantonly violating the Mojang ToU by distributing base classes, however there is a convenient open source installer that installs the tweak library and required arguments. MagicLauncher isn't an issue because it doesn't really do anything any more, it just loads the "environment" that is defined in the real launcher anyway since the new launcher is orders of magnitude more powerful now.
Don't forget also that being a tweak means that other tweakers that support it can also load you, so for example in the near future it will be possible for FML to load liteloader and vice versa (and also other tweakers like Optifine), so that means that once you have one tweak installed, installing others is a drag-n-drop affair, but with more power than just being a plain mod.
In addition, in the future even that won't be necessary, since when the new launcher is completed there will be a nice GUI for all of this, it just doesn't exist yet, making the installers the easiest way for now.
From minecraft.net/terms: "Basically, mods (or plugins, or tools) are cool (you can distribute those)" But anyway how would I install the tweaker version? Just add it to the classpath?
Kind of, add your jar to the class path as well as the tweak system itself, add an entry on the command line specifying your tweak class and any others you want to load, and set the main class to the tweaker main, the installer does all that for you.
The tweaker main then handles setting up the funky classloader and loading all the tweaks and asking them for their opinion on how to launch the game and letting them hook into the classloader, then it launches the main class specified by the primary tweaker.
Thanks! Earlier you said it would also be possible to use ASM to change to main() method of Main.class. Does the vanilla launcher support that?
No but the tweak system does, because it replaces the default AppClassLoader with the hookable LaunchClassLoader which supports transforming classes on the fly using ASM (just add ASM into your class path as well), there's even some really good examples in Mojang's code of the kind of approach that can be used to achieve this.
Thanks! I will work on a tweak launcher, then!
No worries, feel free to hit me on IRC or whatever if you have any other questions.
For your reference, my tweak code is here in the LiteLoader source
FML's is here in the FML sourceAlso, feel free to steal my ant build scripts and use them as a template.
I tried to reference the LaunchWrapper source but it wants a ton of libraries. Do I need to go download them all? Or am I doing this wrong?