Jump to content

How do I specify when my mod loads?


Gibbynator

Recommended Posts

So here's the scoop:

I'm writing Gibbycraft, and it causes me some NoClassDef found errors. I harassed the members of this forum by posting my issue, and I learned that when you are modding and using other mods (either as an addon mod or for extra compatibility), NEVER to use StartClient.bat in MCP, as MCP doesn't like other mods. But now, a new problem occurs: The mods must load in a certain order, otherwise stuff isn't there when my mod needs it. I have been doing it the cheap way: renaming my reobfuscated mod folder with the letter "Z" in front of it. My question is this:

Is there a way to see if a mod exists in the mods folder before initializing my mod, and making sure that mod initializes first? I think there was some trick using modsLoaded(), but I can't find an example of how to use it. Can anyone elaborate on this?

Thanks again!

Link to comment
Share on other sites

That worked. For everyone else, trying to do this, here are some notes about getPriorities() that are really useful:

  • You can use

    before:mod_Name
     and 
    
    after:mod_Name
     instead of required-after/before.
    
  • Separate multiple mod priorities with a semicolon(no spaces). For example:


return "before:mod_IC2;before:mod_Buildcraft";
Do your before declarations BEFORE your after declarations, otherwise it won't work.

Link to comment
Share on other sites

There's actually a slight difference between the required-before/after and simple before/after. The required version should make modloader spit out errors if the mod listed isn't there while at the same time making sure you load before or after it. The simple before/after version makes no such check, only ensuring ordering if the listed mod is there, but not complaining if it's not.

An example of a place to use the required version is if one of your crafting recipes uses an item from another mod. You need that mod to be there for it's item to exist, so you require it.

An example of a place to use the simple ordering is if you know your mod conflicts with another in some way, and one of them has to have the final say on something, you can use after to make sure it loads after the other mod. If the other mod isn't there though, there's no conflict and things can proceed as normal.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...