Well, currently i working on addon\mod that alter behaivior of IC2e devices (replace tileentity class at runtime) (allow replicator to replicate all registered items without scanning process or patern storage).
For some reasons (i dont like APIs) i can's import IC2e API or state loadafter in mod's header soo i "developed" (actually joke, but still, there is no direct answer about it on google) method to change loadorder in runtime.
Also this method useless if you gone ASM coremod.
Source code below:
Code
private void EnsureLastWord() throws Throwable
{
//this method allow mod to run LAST no matter what
//if other mod use similar tecnique result is undefined
Loader load = Loader.instance();
UnsafeImp us = new UnsafeImp();
LoadController lc = (LoadController) us.Read_Object(load, "modController");
Object[] mcsA = lc.getActiveModList().toArray();
List<ModContainer> lcn = new ArrayList();
ModContainer last = null;
for (Object x : mcsA)
{
if (((ModContainer) x).getName().equals(modid))
{
last = (ModContainer) x;
continue;
}
lcn.add((ModContainer) x);
}
lcn.add(last);
us.Write_Object(lc,"activeModList",lcn);
}
@Mod.EventHandler
public void StageA(FMLPreInitializationEvent e) throws Throwable
{
EnshureLastWord();
}
Display More
Stage B run at postinit and ensured to run last.
Classcast done such wierd way for a reason.