Jump to content

How to bypass cpw.mods.fml.common.LoaderException


pitman-87

Recommended Posts

Hey,

 

My TF2 Teleporter, Sentry and Dispenser are done, and I'm on the TeamAddon now.

I use this addon to change fields in the other mod-classes, it worked fine with 1.2.5.

But if I'm using this code:

 

@PostInit
public void modsLoaded(FMLPostInitializationEvent evt)
{
	updateMods();
}

private static void updateMods()
{
	List<ModContainer> mods = Loader.instance().getActiveModList();
	try
	{

		for(ModContainer mod : mods){
			if(mod.getMod() instanceof TF2.Sentry.common.TF2SentryMod){
				TF2.Sentry.common.TF2SentryMod.teamsEnabled = teamsEnabled;
			}else if(mod.getMod() instanceof TF2.Dispenser.common.TF2DispenserMod){
				TF2.Dispenser.common.TF2DispenserMod.teamsEnabled = teamsEnabled;
			}else if(mod.getMod() instanceof TF2.Teleporter.common.TF2TeleporterMod){
				TF2.Teleporter.common.TF2TeleporterMod.teamsEnabled = teamsEnabled;
			}
		}

	}catch (Exception e){

	}

}

 

I get that error everytime, if I start minecraft without telporter and so on:

 

 

2012-08-22 02:11:30 [iNFO] [ForgeModLoader] Forge Mod Loader version 3.0.68.286 for Minecraft client:1.3.2, server:1.3.2 loading
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] All core mods are successfully located
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Discovering coremods
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Found library file argo-2.25.jar present and correct in lib dir

2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Found library file guava-12.0.1.jar present and correct in lib dir

2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Found library file asm-all-4.0.jar present and correct in lib dir

2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Running coremod plugins
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Running coremod plugin FMLCorePlugin
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Coremod plugin FMLCorePlugin run successfully
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Running coremod plugin FMLForgePlugin
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Coremod plugin FMLForgePlugin run successfully
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Validating minecraft
2012-08-22 02:11:30 [FINEST] [ForgeModLoader] Minecraft validated, launching...
2012-08-22 02:11:31 [iNFO] [sTDOUT] 27 achievements
2012-08-22 02:11:31 [iNFO] [sTDOUT] 195 recipes
2012-08-22 02:11:31 [iNFO] [sTDOUT] Setting user: pitman87, fa4bc96c82f1f01a4b75b31cecd3f09de4bbd7fa
2012-08-22 02:11:31 [iNFO] [sTDOUT] LWJGL Version: 2.4.2
2012-08-22 02:11:32 [iNFO] [ForgeModLoader] Attempting early MinecraftForge initialization
2012-08-22 02:11:32 [iNFO] [ForgeModLoader] Completed early MinecraftForge initialization
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Building injected Mod Containers [cpw.mods.fml.common.FMLDummyContainer, net.minecraftforge.common.ForgeDummyContainer]
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Attempting to load mods contained in the minecraft jar file and associated classes
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Skipping known library file C:\Users\pitman\AppData\Roaming\.minecraft\bin\lwjgl.jar
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Skipping known library file C:\Users\pitman\AppData\Roaming\.minecraft\bin\jinput.jar
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Skipping known library file C:\Users\pitman\AppData\Roaming\.minecraft\bin\lwjgl_util.jar
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Found a minecraft related file at C:\Users\pitman\AppData\Roaming\.minecraft\bin\minecraft.jar, examining for mod candidates
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Skipping known library file C:\Users\pitman\AppData\Roaming\.minecraft\lib\argo-2.25.jar
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Skipping known library file C:\Users\pitman\AppData\Roaming\.minecraft\lib\guava-12.0.1.jar
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Skipping known library file C:\Users\pitman\AppData\Roaming\.minecraft\lib\asm-all-4.0.jar
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Minecraft jar mods loaded successfully
2012-08-22 02:11:32 [iNFO] [ForgeModLoader] Searching C:\Users\pitman\AppData\Roaming\.minecraft\mods for mods
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Found a candidate zip or jar file TF2.zip
2012-08-22 02:11:32 [FINE] [ForgeModLoader] Examining file minecraft.jar for potential mods
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Examining file TF2.zip for potential mods
2012-08-22 02:11:33 [FINER] [ForgeModLoader] Located mcmod.info file in file TF2.zip
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Identified a FMLMod type mod TF2.TeamAddon.common.TF2TeamAddon
2012-08-22 02:11:33 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 3 mods to load
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Received a system property request ''
2012-08-22 02:11:33 [FINE] [ForgeModLoader] System property request managing the state of 0 mods
2012-08-22 02:11:33 [FINE] [ForgeModLoader] After merging, found state information for 0 mods
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Verifying mod requirements are satisfied
2012-08-22 02:11:33 [FINE] [ForgeModLoader] All mod requirements are satisfied
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Sorting mods into an ordered list
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Mod sorting completed successfully
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Mod sorting data:
2012-08-22 02:11:33 [FINE] [ForgeModLoader] 	pitman-87_TF2_TeamAddon(TF2 TeamAddon): TF2.zip (null)
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Activating mod FML
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Activating mod Forge
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Enabling mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Activating mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:33 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLConstructionEvent@12a4ed99 to mod FML
2012-08-22 02:11:33 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLConstructionEvent@12a4ed99 delivered to mod FML
2012-08-22 02:11:33 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLConstructionEvent@12a4ed99 to mod Forge
2012-08-22 02:11:33 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLConstructionEvent@12a4ed99 delivered to mod Forge
2012-08-22 02:11:33 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLConstructionEvent@12a4ed99 to mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:33 [FINE] [ForgeModLoader] Attempting to inject @SidedProxy classes into pitman-87_TF2_TeamAddon
2012-08-22 02:11:33 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLConstructionEvent@12a4ed99 delivered to mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:33 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLPreInitializationEvent@10bfb545 to mod FML
2012-08-22 02:11:33 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLPreInitializationEvent@10bfb545 delivered to mod FML
2012-08-22 02:11:33 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLPreInitializationEvent@10bfb545 to mod Forge
2012-08-22 02:11:33 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLPreInitializationEvent@10bfb545 delivered to mod Forge
2012-08-22 02:11:33 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLPreInitializationEvent@10bfb545 to mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:33 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLPreInitializationEvent@10bfb545 delivered to mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:33 [iNFO] [sTDOUT] Starting up SoundSystem...
2012-08-22 02:11:33 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2012-08-22 02:11:33 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2012-08-22 02:11:33 [iNFO] [sTDOUT] OpenAL initialized.
2012-08-22 02:11:34 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLInitializationEvent@ca8e2b8 to mod FML
2012-08-22 02:11:34 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLInitializationEvent@ca8e2b8 delivered to mod FML
2012-08-22 02:11:34 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLInitializationEvent@ca8e2b8 to mod Forge
2012-08-22 02:11:34 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLInitializationEvent@ca8e2b8 delivered to mod Forge
2012-08-22 02:11:34 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLInitializationEvent@ca8e2b8 to mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:34 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLInitializationEvent@ca8e2b8 delivered to mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:34 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLPostInitializationEvent@23bca486 to mod FML
2012-08-22 02:11:34 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLPostInitializationEvent@23bca486 delivered to mod FML
2012-08-22 02:11:34 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLPostInitializationEvent@23bca486 to mod Forge
2012-08-22 02:11:34 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLPostInitializationEvent@23bca486 delivered to mod Forge
2012-08-22 02:11:34 [FINER] [ForgeModLoader] Posting state event cpw.mods.fml.common.event.FMLPostInitializationEvent@23bca486 to mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:34 [FINER] [ForgeModLoader] State event cpw.mods.fml.common.event.FMLPostInitializationEvent@23bca486 delivered to mod pitman-87_TF2_TeamAddon
2012-08-22 02:11:34 [sEVERE] [ForgeModLoader] Fatal errors were detected during the transition from POSTINITIALIZATION to AVAILABLE. Loading cannot continue
2012-08-22 02:11:34 [sEVERE] [ForgeModLoader] 
Forge Mod Loader (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized
TF2 TeamAddon (TF2.zip) Unloaded->Constructed->Pre-initialized->Initialized->Errored
Minecraft Forge (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized
2012-08-22 02:11:34 [sEVERE] [ForgeModLoader] The following problems were captured during this phase
2012-08-22 02:11:34 [sEVERE] [ForgeModLoader] Caught exception from pitman-87_TF2_TeamAddon
2012-08-22 02:11:44 [iNFO] [sTDERR] cpw.mods.fml.common.LoaderException: java.lang.reflect.InvocationTargetException
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.transition(LoadController.java:106)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.initializeMods(Loader.java:605)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:217)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.a(Minecraft.java:447)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:734)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] Caused by: java.lang.reflect.InvocationTargetException
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:306)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.post(EventBus.java:268)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:127)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.post(EventBus.java:268)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:85)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.initializeMods(Loader.java:604)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	... 4 more
2012-08-22 02:11:44 [iNFO] [sTDERR] Caused by: java.lang.NoClassDefFoundError: TF2/Sentry/common/TF2SentryMod
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at TF2.TeamAddon.common.TF2TeamAddon.updateMods(TF2TeamAddon.java:67)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at TF2.TeamAddon.common.TF2TeamAddon.modsLoaded(TF2TeamAddon.java:57)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	... 30 more
2012-08-22 02:11:44 [iNFO] [sTDERR] Caused by: java.lang.ClassNotFoundException: TF2.Sentry.common.TF2SentryMod
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:99)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at java.lang.ClassLoader.loadClass(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at java.lang.ClassLoader.loadClass(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	... 32 more
2012-08-22 02:11:44 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:28)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.relauncher.RelaunchClassLoader.runTransformers(RelaunchClassLoader.java:141)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:92)
2012-08-22 02:11:44 [iNFO] [sTDERR] 	... 34 more

 

 

In generall catching an Exception would work, but I still get this LoaderException :/

Any ideas how I can get rid of that problem?

Link to comment
Share on other sites

Doing instanceof of is a really really bad thing you're making a hard dependancy on the other mods.

What you *should* be doing is checking if the class name equals a string, or something to that effect.

 

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

I have tried it without instanceof at first, but with same error:

 

	try
	{
		TF2.Sentry.common.TF2SentryMod.teamsEnabled = teamsEnabled;
		TF2.Dispenser.common.TF2DispenserMod.teamsEnabled = teamsEnabled;
		TF2.Teleporter.common.TF2TeleporterMod.teamsEnabled = teamsEnabled;

	}catch (Exception e){

	}

Link to comment
Share on other sites

It's working now, thx!

 

	@PostInit
public void modsLoaded(FMLPostInitializationEvent evt)
{
	updateMods();
}

private static void updateMods()
{
	try
	{

		for(ModContainer mod : Loader.instance().getModList()){
			if(mod.getMod() == null){
				continue;
			}
			Class<?> c = mod.getMod().getClass();
			String s = c.toString();
			if(s.equals("class TF2.Sentry.common.TF2SentryMod")){
				c.getDeclaredField("teamsEnabled").setBoolean(null, true);
			}else if(s.equals("class TF2.Dispenser.common.TF2DispenserMod")){
				c.getDeclaredField("teamsEnabled").setBoolean(null, true);
			}else if(s.equals("class TF2.Teleporter.common.TF2TeleporterMod")){
				c.getDeclaredField("teamsEnabled").setBoolean(null, true);
			}
		}

	}catch (Exception e){
		e.printStackTrace();
	}

}

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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